Setting a static IP address on the Raspberry Pi running Jessie Lite

networking

Jeff Geerling has discovered in his work on the Raspberry Pi Dramble cluster that Raspbian Jessie does networking a bit differently. Whereas before (with Wheezy) it was just a case of adding some lines to /etc/network/interfaces, now you need to add some lines to /etc/dhcpcd.conf to make dhcpcd5 set the static IP address. He’s blogged about it here but just for posterity (in case his blog disappears, as others have), here are the essentials for setting a static IP for your wired connection:

So, in /etc/network/interfaces, you add:

auto lo
iface lo inet loopback
iface eth0 inet static
  address 10.0.1.60/24
  netmask 255.255.255.0
  gateway 10.0.1.1
  dns-nameservers 8.8.8.8 8.8.4.4

And then to /etc/dhcpcd.conf you add:

interface eth0
static ip_address=10.0.1.60/24
static routers=10.0.1.1
static domain_name_servers=8.8.8.8 8.8.4.4

This should give you a static IP of 10.0.1.60.

He has some other tips on his blog, so head over there if you want to read more.

4 comments for “Setting a static IP address on the Raspberry Pi running Jessie Lite

  1. Pete Shew
    15 April 2016 at 4:10 pm

    It’s just wrong! the DHCP client should have nothing to do with static IPs (except via DHCP server leases) and should honour an interface’s desire not to be controlled by DHCP.

  2. Neil Wallace
    15 April 2016 at 5:46 pm

    I will certainly try this, so that I can pin down a static IP for my Pi – and my Zero.
    A query before I start again on my quest for the elusive static IP: can I, and indeed should I, try to assign separate IP addresses for my Pi and my Zero?
    Thanks

    • Michael Horne
      17 April 2016 at 5:52 pm

      It’s a good idea to set static IPs for all the Pis on your network. Remember, though: it’s essentially the SD card you’re setting the address on, so if you were to swap the SD cards of a couple of Pis, you would be swapping the IP addresses as well.

  3. Lungfish
    15 April 2016 at 5:47 pm

    Nothing needs to be added to /etc/network/interfaces when implementing a static IP on Raspbian Jessie. (this is somewhat counter-intuitive to other Linux distros, but it is what it is…)

    As it says at the head of the file:
    # Please note that this file is written to be used with dhcpcd
    # For static IP, consult /etc/dhcpcd.conf and ‘man dhcpcd.conf’

    The only file requiring an edit is /etc/dhcpcd.conf as shown in the article.

Leave a Reply to Pete Shew Cancel reply

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

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