Static addresses and the Raspberry PI

Raspberry PIs have become somewhat of a standard in home automation setups. But if you have recently upgraded to the latest Raspbian image you may have been caught out with one of the latest changes (especially if you don’t use DHCP on your network).

The network used to be configured in the file /etc/network/interfaces, and changing from DCHP to static addresses used to involve finding the line:

iface eth0 inet dhcp

and changing it to

iface eth0 inet static




where the values in italics change according to your network.

However if you look at the interfaces file now, you will see that the entry for eth0 has been changed to “manual”. You can still make the old changes, but these will be ignored.

There are a couple of ways to fix this.

The new behaviour is caused by the new DHCP client, which is in a package dhcpcd5, you can remove this by typing

sudo apt-get remove dhcpcd5

You will also need to add the line

auto eth0

before the iface command in /etc/network/interfaces

However this removes DHCP for all interfaces (which you may not want to do), so an alternative is to just change the (new) DHCP config.

Editing the file /etc/dhcpcd.conf and adding to the bottom:

interface eth0
static ip_address=	
static routers=
static domain_name_servers=

Will force a static IP address for that interface (while leaving the others free).

Be Sociable, Share!

    Leave a Reply

    Your email address will not be published. Required fields are marked *