Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using a BT Homehub 3 and trying to set up my PI using raspbian with a static local IP.

Before any changes, using dhcp, the output of $ netstat -nr is

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface         UG        0 0          0 eth0   U         0 0          0 eth0

The dhcp normally starts at but I've changed this to My windows server uses and I want the Pi to use The following shows changes I've made (commented out line 5,6 added line 8-14) to config in /etc/networking/interfaces:

auto lo

iface lo inet loopback

#auto eth0
#iface eth0 inet dhcp

auto eth0
iface eth0 inet static

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

The config changes result in the local IP for the Pi changing but the output of $ netstat -nr is now the below and whilst I can access the Pi from the network on, I cannot access the internet from the Pi. I can see the problem, no gateway but as this is configured in the interfaces file above I'm stuck as to how to fix it.

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eth0

$ sudo /sbin/route add -net gw eth0 at this point adds the requisite gateway and all works as required but I want this to be done automatically on startup.

Any help? Thank you.

share|improve this question
up vote 0 down vote accepted

Your configuration has the broadcast and gateway on a different network I think you meant this:


(instead of 192.168.100.x)

share|improve this answer
Brilliant! Of course! Thank you. – Richard Apr 25 '13 at 7:08

When you execute the following command on the shell, you are giving a Gateway IP Address that falls in the range of your Subnet Mask (

$ sudo /sbin/route add -net gw eth0

But in your /etc/networking/interfaces file, the gateway that you are giving is, which is not in the range of the subnet mask, hence possibly the problem.

I personally dont give the Gateway Address in the interfaces file, and it still works for me, when I use Static IP. (I never connect it to the internet though).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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