Static IP address in Raspbian

If you installed Raspbian on RaspberryPi and tried to set static IP address using /etc/network/interfaces  you have noticed that it doesn’t work.

Problem is, Raspbian is using dhcpcd – a DHCP client for setting IP address. You can try to:

  • remove dhcpd daemon and set the address in interfaces  file, or
  • set the static IP address for your RaspberryPi in your DHCP server.

But, the really best and simplest solution is to set static IP address thru dhcpcd.

Open /etc/dhcpcd.conf  file and add this content at the end of the file:

static ip_address=192.168.1.10/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

This IP address is then set for eth0  interface. If you have more than one interface, you need to add interface interface_name  before static ip_address line:

interface wlan0
static ip_address=192.168.1.11/24
...