0

Today I've managed to SSH into RaspberryPi (which was connected to Laptop using Ethernet cable) using the following IP address: 10.248.105.60

on Windows OS.

This was done in the university lab, where I had a proper monitor / mouse / keyboard connected to the RaspberryPi. I then made this IP address static on the Pi device itself by editing the /etc/network/interfaces file.

Some lines edited in the file were:

iface eth0 inet static
address 10.248.105.60
netmask 255.255.224.0
# something about BCast
# something about Gateway
# something about Destination, sorry can't remember exact code. 

I turned on / off Pi and my laptop several times to make sure that it works. Everything was fine.

But now I am back home, and want to connect to raspberry pi using the same IP address (10.248.105.60). However, after launching SSH program, I get an error connection timed out.

Why that happens?

Some of the possible issues I can think of are:

  • as my new IP address is different, the netmask stored on SD of RaspberryPi is no longer valid.
  • I am on different network than the device, so I can not SSH into it.
  • destination is the IP address of my laptop, which no longer matches.

Could any of the above be the problem?

I would like to connect to my Pi device, but I do not have a monitor now.

So, a few more concrete questions:

  • How to check that RaspberryPi connected through Ethernet cable is properly connected (i.e. is it possible to send some "ping" command through the Ethernet cable)

  • Is it possible to determine RaspberryPi current IP address, if it has changed (though I would believe that it has not)?

  • Apart from SSH terminal (which is currently not functioning), I can not shutdown my device otherwise than just plugging the power off. Is that safe to do?

  • Add another IP addres to your interface, e.g. ifconfig eth0 10.248.105.61/20 and you'll be able to connect. If you're not on the same subnet with the Pi the traffic will be routed through your default gateway, and there's no Pi on the internets ;) – nsilent22 Jan 20 '16 at 22:17
  • Do you perhaps know the equivalent shell command in Windows? – mercury0114 Jan 20 '16 at 22:39
  • Oh... Windows... AFAIK you can add an additional address in the TCP/IP section of your card/connection properties, BUT you can't mix static and dynamic addresses on modern Windows systems (you could do it in XP, next systems had this removed). So if you use dynamic address (DHCP) to connect to Pi you have to switch to static addressing, and then go back to DHCP when you're done. Or better install Linux ;) – nsilent22 Jan 20 '16 at 22:45
1

"I then made this IP address static on the Pi device itself by editing the /etc/network/interfaces file". No you didn't — dhcpcd will still be allocating an address See How do I set up networking/WiFi/Static IP

Even if you correctly set a static IP address this may not work. You need to use an address range from the same subnet your network uses.

0

To connect to a Raspberry Pi that has a fixed IPv4 address (e.g. 10.248.105.60 netmask 255.255.224.0) from say a laptop, you need a similar IPv4 address on the laptop that matches the one on the Raspberry Pi for the length of the netmask (e.g. 10.248.105.61, and same netmask 255.255.224.0).

Probably the laptop is set to receive the IP address automatically through DHCP, and the value it receives is different at home from at uni.

You can list the IP addresses of your laptop using ipconfig from a command prompt, and can change the settings from Control Pannel.

0

You need to change your gateway to match that of the router.

Try netstat -nr from another (Unix) computer on the network to get the gateway and change the gateway in /etc/network/interfaces to match.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.