Raspberry Pi


Once in a while, your device will benefit or will need to setup a static IP address. Here is a short how-to. Tested on Jessie, but should work for other Raspbian releases as well. This recipe assumes you are already connected to you Pi over SSH, but if you wish the use the Terminal from your desktop, go ahead - same thing.

It is a good idea to plan your network settings so we also assume you have a fresh setup.

Set Static IP Address

Start by editing the dhcpcd.conf configuration file:

sudo nano /etc/dhcpcd.conf

Scroll to the end of the file and add one or both configuration sections. The first section sets the static address for a wired connection - eth0. The second section for wireless - wlan0. Choose one or both options. You need to of course modify your network addresses.

wired connection

interface eth0

static ip_address=
static routers=
static domain_name_servers=

wireless connection

interface wlan0

static ip_address=
static routers=
static domain_name_servers=

What do these names mean?

  • interface = This defines which network interface you are setting the configuration for.
  • static ip_address = This is the IP address that you want to set your device to. (Make sure you leave the /24 at the end)
  • static routers = This is the IP address of your gateway (probably the IP address or your router)
  • static domain_name_servers = This is the IP address of your DNS (probably the IP address of your router). You can add multiple IP addresses here separated with a single space.

Finally, close the editor and save changes by pressing ctrl-X, then typing Y and hitting

Reboot the PI:

sudo Reboot

Tho check your settings once reconnected, type