0

I am using Ubuntu 16.04 and I have configured a proper static IP in /etc/network/interfaces

auto lo
iface lo inet loopback

#set static ip
auto usb0
iface usb0 inet static
      address 192.168.0.2
      netmask 255.255.255.0
      gateway 192.168.88.84

where usb0 is the extra interface that appears after plugging my raspberryPi zero through the usb. I have set raspberryPi's address being equal to gateway (192.168.88.84). I have tried restarting the network:

sudo /etc/init.d/networking restart
sudo service network-manager restart

but what I get is

stop: Job failed while stopping

start: Job is already running: networking

in the first case and

network-manager stop/waiting

network-manager start/running, process

in the second case. The command I am trying is:

ssh root@192.168.88.84

I am constantly getting

No route to host

  • What happens if you change address 192.168.0.2 to address 192.168.88.2? Physically connected IP addresses should be in the same subnet (that is the first three octets/parts of the address should match). – Fred Oct 4 at 19:57
  • The address is in one /24 subnet the gateway is in a different /24 subnet. That means the Raspberry will not be able to route anything outside the subnet. If your gateway is at 192.168.88.84 then your RPi needs to have a unique address from 192.168.88.1 to 192.168.88.254 with a 255.255.255.0 (/24) netmask. The alternative would be to use a /17 (255.255.128.0) netmask - but that's unorthodox and not supported with the 192.168.xxx.xxx address blocks. – Dougie Oct 4 at 21:14
  • Why do you try to ssh to the router with ip address 192.168.88.84? The RasPi has ip address 192.168.0.2. Please address me with @Ingo, otherwise I won't see your reply. – Ingo Oct 4 at 22:01
  • @Dougie I have configured my RPi with an address of 192.168.88.84. Isn't that ok? – Giannis Oct 4 at 22:59
  • @Fred I changed the address in interfaces file as you suggested and I restarted the network with the previous two commands that you mentioned but unfortunately when I tried ssh root@192.168.88.84 it gave me the same error – Giannis Oct 4 at 23:07
2

Unless you have changed your router's IP address, neither of these look like a normal router address. 192.168.0.1 or 192.168.1.1 are more common: Google your router's name and "default IP address" to find out what it should be, then browse to that IP it to check it hasn't changed. If it really is 192.168.88.44 then your RPi static address will need to be something like 192.168.88.250.

You are free to choose any static IP address within your subnet, but it's a good idea to choose ones towards the end (avoid 192.168.0.255 as it is the broadcast address), so 192.168.0.250 is good. You should also configure your router's DHCP to avoid your static address range.

Your RPi config would then look like this:

auto lo
iface lo inet loopback

#set static ip
auto usb0
iface usb0 inet static
      address 192.168.0.250
      netmask 255.255.255.0
      gateway 192.168.0.1

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.