Hackviking He killed Chuck Norris, he ruled dancing so he took up a new hobby…


Raspbian Jessie: Set a static IP-address

For many of my projects on the Raspberry Pi a static, or fixed, IP-address has been needed. Here is a quick tutorial on how to set it up. This is aimed for SSH users who have no GUI on there Pi. Before you configured this by editing the network interfaces config file but not any more. Raspbian Jessie comes with dhcpcd5 by default and you can uninstall it it's just easier to append to it's configuration. Start by opening it's configuration.

sudo nano /etc/dhcpcd.conf


At the end of this line you can add a static IP-address configuration. Here is an example:

#static ip
interface eth0
static ip_address=
static routers=
static domain_name_servers=

First we specify the interface eth0 then all options follows with the prefix static. Ip address is specified with subnet, /24 is the equivalent of a subnet mask of We also specify the networks default gateway for all traffic that will leave the network. In most cases this is your router for home built projects. We also need some DNS servers so we can use FQDN instead of just ip addresses when we communicate. In this example I have used the two Google DNS servers.

Posted by Kristofer Källsbo

Comments (2) Trackbacks (1)
  1. Hey just want to make sure…if my router’s IP address is (for example) instead of, then at static ip_address line should I write something like 181.123.43.X/24 (24 for example) instead of

  2. Correct! It needs to be in the same subnet. But that IP address is not a private address it’s a public one so you should double check the information before proceeding!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.