Configuring a Static IP and Static Routes on a Raspberry Pi running Raspbian Jessie using the CLI

Since the release of Raspbian Jessie a few things have changed regarding configuration of the network stack from the CLI. I got stuck on this today and it took me a while to sort out so I figured it was worth a quick post.

Previous to Raspbian Jessie, network parameters could be adjusted by editing /etc/network/interfaces. This functionality has now been moved to /etc/dhcpcd.conf, the reasons why are beyond the scope of this post.

To enter a static IP, fire up your favourite text editor and open /etc/dhcpcd.conf

The syntax is as per below

nohook lookup-hostname
interface eth0
static ip_address=
static routers=
static domain_name_servers=

To add a persistent static route, create or edit the following file


and use the following syntax

ip route add via



Leave a Reply

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