I got a Raspberry Pi running Raspbian, connected via Ethernet on my home LAN (on the ISP's default router). The router is configured to give addresses from onwards with dhcp. I wanted to give a static ip to the Pi, so I assigned to it by editing /etc/network/interfaces as follows:

auto lo
iface lo inet loopback

# auto eth0
# allow-hotplug eth0
# iface eth0 inet manual
iface eth0 inet static

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

After rebooting and running ifconfig I see correctly(?) my ip to be

eth0      Link encap:Ethernet  HWaddr b8:27:eb:d2:e5:5b
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::ba27:ebff:fed2:e55b/64 Scope:Link
          RX packets:17019 errors:0 dropped:16 overruns:0 frame:0
          TX packets:1707 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2183986 (2.0 MiB)  TX bytes:241230 (235.5 KiB)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:264 errors:0 dropped:0 overruns:0 frame:0
          TX packets:264 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:21840 (21.3 KiB)  TX bytes:21840 (21.3 KiB)

Yet, my router shows the raspberry to have an ip taken from dhcp ( and the weirdest thing is that I can access the Pi with ssh on both and ips. Any idea why that happens? How can I set the Pi to have only the static address I give to it?

Edit: For future reference: I found out that the problem is a bug of the last update of raspbian and others experience it as well (https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=111709)

  • 2
    ifconfig is deprecated. Use the ip addr command and provide its output. – Daniel B Oct 7 '15 at 9:47
  • 1
    Or Give your raspberry a static IP from your router, and don't forget to restart the router! to clean the lease – Narzan Q. Oct 7 '15 at 9:49
  • 1
    The router handles DHCP, not the Pi. You need to set a static IP on the router for your Pi's MAC address. If you can't do that due to restrictions by your ISP on the router, buy a new router. – AStopher Oct 7 '15 at 11:53
  • It's weird it's responding with two addresses at the same time. Is it possible your wireless isn't using Does the DHCP entry for the Pi have the same mac address as what appears in ifconfig eth0? – Ryan Babchishin Oct 7 '15 at 12:39
  • Oh and by the way: Whether or not the DHCP lease is still lingering is totally irrelevant. A regular computer drops packets not directed at its IP addresses. – Daniel B Oct 8 '15 at 9:06

There are three problems with your configuration: first, DHCP leases have an expiration time which is generally set at 1hour, but can also be much longer. Since static addresses are completely unknown to the DHCP server, there is no way it can possibly know that your Ethernet MAC address is now associated with two IP addresses.

So far, if someone searched for your RPI via its name, the connection would have been made to the old IP address, where there is no one to reply. For this reason, from now on connections to your RPI via its name will be impossible, unless you activate SAMBA or Bonjour services on it.

This is why I prefer reserved addresses, where the DHCP is configured to give always the same IP address to the given MAC address, but negotiation of DNS servers and machine name occur as if a new lease was being negotiated.

Second, you have not configured DNS servers in your static stanza: add the following line,


(notice the plural, servers, and the lack of punctuation between the two IP addresses). If you don't like Google DNSes, replace with whatever suits you.

Third, you have a wrong broadcast address, given your network and netmask: both in your /etc/network/interfaces stanza, and in the output of ifconfig (which, by the way, is obsolete, you should be using ip from the iproute2 suite), it can be seen to be It should be instead When these computations are complex, use ipcalc:

Address:          11000000.10101000.00000000. 00000000
Netmask: = 24   11111111.11111111.11111111. 00000000
Wildcard:            00000000.00000000.00000000. 11111111
Network:       11000000.10101000.00000000. 00000000
HostMin:          11000000.10101000.00000000. 00000001
HostMax:        11000000.10101000.00000000. 11111110
Broadcast:        11000000.10101000.00000000. 11111111
Hosts/Net: 254                   Class C, Private Internet

I am not positive that this is the root of your problem, but it will surely add to it in the near future, as your broadcasts (including ARP traffic) will be neglected by all other machines on the LAN.


as Narzan pointed out, your router most likely still has the lease for

It is not clear that rebooting you router will be of any use, try to log in the router and

  1. clear IP associate to b8:27:eb:d2:e5:5b if possible.
  2. clear DHCP lease table (this will of course change all other devices IPs).

How to set static IP address on Rasperry Pi Raspian

Don't use /etc/network/interfaces to set static IP. Use /etc/dhcpcd.conf instead.

Restore your /etc/network/interfaces to the original file, or undo your changes:

sudo nano /etc/network/interfaces

Replace your changes with manual setting in /etc/network/interfaces:

iface eth0 inet manual

Configure dhcpcd:

sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.bak
sudo nano /etc/dhcpcd.conf

Add your static profile options to the bottom of /etc/dhcpcd.conf:

interface eth0
static ip_address=
static routers=
static domain_name_servers=

Remove leases:

sudo rm /var/lib/dhcp/*



Another option is to disable dhcpcd. After you disable dhcpcd, you can use /etc/network/interfaces instead to set static IP.

Configure /etc/network/interfaces:

sudo cp /etc/network/interfaces /etc/network/interfaces.bak
sudo nano /etc/network/interfaces

Replace manual setting with static settings in /etc/network/interfaces:

auto eth0
iface eth0 inet static

Configure dhcpcd:

sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.bak
sudo nano /etc/dhcpcd.conf

Add the option to the bottom of /etc/dhcpcd.conf:

denyinterfaces eth0

Or you can disable the dhcpcd service:

systemctl disable dhcpcd.service

Remove leases:

sudo rm /var/lib/dhcp/*




  • 1
    “Don't use /etc/network/interfaces to set static IP.” — I wholeheartedly disagree. This may be a viable workaround for the bug the OP is experiencing, but it’s not good advice in general. – Daniel B Jul 7 '16 at 5:36
  • 1
    @Daniel B, it is not a bug. Raspian's own /etc/network/interfaces file even says to use /etc/dhcpcd.conf instead: "For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'". It is Raspian's recommended way of setting static IP. – XP1 Jul 7 '16 at 5:48
  • This really should be the accepted answer. – Dan Loewenherz Feb 2 at 21:24

First some background.

Debian and hence Raspbian have multiple ways of configuring a network. Two of the most commonly used are.

  1. "ifupdown", the traditional soloution which works well for static network setups like desktops and servers but doesn't really work very well for devices that roam around.
  2. network manager, the tool preffered by the gnome folks and now used by default on Debian desktop installations. Handles dynamic situations well but is rather heavy and is difficult to work with if you don't have a GUI running and policykit working correctly.

The raspberry pi foundation chose to use neither of these and instead use dhcpcd5 for network configuration in their raspbian images. dhcpcd5 is packaged in Debian but the raspberry pi foundation raspbian images are the only Debian-based system I know of to use it by default.

I can understand why they wanted to move away from ifupdown to something that better handled roaming devices but I'm not really sure why they chose dhcpcd over network manager. Maybe they found it more lightweight or easier to integrate into their desktop setup or something.

Anyway due to the choices the Raspberry pi foundation made, if you configure an IP address through /etc/network/interfaces then ifupdown sets up your static address as you expect, then dhcpcd comes along and adds a dhcp address as well.

There are two possible soloutions to this.

  1. Use dhcpcd configuration to set up the static address.
  2. Get rid of dhcpcd5 and configure your network soley using ifupdown.

Which is the better option probablly depends on what you want to use the Pi for.

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.