I have been trying to set up a static IP for my Raspberry Pi. From what I understand I need to change the interfaces file at /etc/network/interfaces. My file (based on this tutorial) looks like this:

auto lo 
iface lo inet loopback 
auto eth0

iface eth0 inet static 

I then type sudo /etc/init.d/networking restart, which gives me this message:

Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces

I then do sudo reboot.

With the above settings, I do not receive any Internet access on my Raspberry Pi. Can anyone point out where I am going wrong? I have successfully managed to setup static IPs on my Windows/Ubuntu machine, phone and iPad.

  • so what is your question? May 25, 2013 at 22:44
  • lol i see you point edited...
    – Harpal
    May 25, 2013 at 23:18

2 Answers 2


After "ifup" or "networking restart" command, you have to check your network interfaces with "ifconfig" or "ip addr" command. Also checking routes of device may be useful.

Sample "ifconfig eth0" output:

root@pi:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr b8:27:eb:30:42:ef  
          inet addr:  Bcast:  Mask:
          RX packets:243477 errors:0 dropped:0 overruns:0 frame:0
          TX packets:102566 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:197482011 (188.3 MiB)  TX bytes:11086659 (10.5 MiB)

Sample "ip addr" output:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether b8:27:eb:30:42:ef brd ff:ff:ff:ff:ff:ff
    inet scope global eth0

Sample "route -n" output:

root@pi:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0   U     0      0        0 eth0

To connect to internet through "eth0" interface, you should see the line with "UG" flag correctly. That line means that every packet from the local network will go to outside through and eth0 interface. Without this line device can't know where to go.

If there is no route line which has destination, you can test with adding by manually with "route command" ;

route add default gw netmask eth0

Also check your DNS settings by "/etc/resolv.conf" file. Because you not mentioned how you test the internet connection maybe your system does not resolve addresses. Nameserver line should contains a DNS server IP address. To test it you can use Google's DNS server IP addresses. ( or

root@pi:~# cat /etc/resolv.conf 
  • Google saves the day, changing the nameserver worked for me.
    – Mateo
    Jul 10, 2013 at 1:10

Restarting networking may work, but I've never had much luck with it.

I would recommend using the ifup command. Once you have set up your /etc/network/interfaces as you have, try the following:

sudo ifdown eth0

sudo ifup eth0

Example /etc/network/interfaces:

dhcp (automatic)

auto lo
iface lo inet loopback
iface eth0 inet dhcp

static (manual)

auto lo
iface lo inet loopback
iface eth0 inet static

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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