How to configure a static IP address on Raspberry Pi

This post is a quick how-to article for configuring a static IP address on Raspberry Pi.

The method of configuring a static IP address on Raspberry Pi has changed with the release of Raspbian Jessie. Static address settings are no longer made through the /etc/network/interfaces file, but are instead made through the /etc/dhcpcd.conf file.
  1. Use the nano text editor to modify the /etc/dhcpcd.conf file with the following command:
    sudo nano /etc/dhcpcd.conf

    The nano text editor will open and display the contents of the /etc/dhcpcd.conf file.

  2. Press Alt + / to move to the last line of the file.
  3. Add the following lines to the end of the file:
    interface eth0
    static ip_address=
    static routers=
    static domain_name_servers=

    Adjust the values to suit your network environment.

    Field Description
    interface <iface> Specifies the name of the network interface. On the Raspberry Pi this will generally be eth0, but could also be wlan0 if you are using a WiFi adapter.
    static ip_address=<ipaddress/mask> Specifies the static IP address and subnet mask bits to be configured on the interface. A subnet mask of equates to mask bits of 24. For other values, you can use the Subnet Calculator.
    static routers=<ipaddress> Specifies one or more router/gateway addresses to be configured on the interface. Multiple addresses should be space delimited.
    static domain_name_servers=<ipaddress> Specifies one or more domain name service (DNS) server addresses to be configured on the interface. Multiple addresses should be space delimited.
  4. Press Ctrl + X to exit nano, press Y to save changes, and press Enter to confirm the existing filename.
  5. Reboot the Raspberry Pi, using the following command:
    sudo reboot

    The Raspberry Pi will reboot immediately.

  6. Once rebooted, login to the Raspberry Pi. If you are connecting remotely via SSH, remember to use the new static IP address!
  7. Show the interface configuration, using the following command:
    ifconfig eth0

    The command produces output similar to the following:

    eth0      Link encap:Ethernet  HWaddr b8:27:eb:d4:08:5a
              inet addr:  Bcast:  Mask:
              inet6 addr: fe80::82c3:4e6:21f:5763/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:138 errors:0 dropped:0 overruns:0 frame:0
              TX packets:122 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:12099 (11.8 KiB)  TX bytes:18829 (18.3 KiB)

    The Raspberry Pi is now configured to use a static IP address.


Raspberry Pi is a trademark of the Raspberry Pi Foundation.

Disclaimer: No liability is accepted (whether under the law of contract, the law of torts or otherwise) in relation to the contents of, or use of, or otherwise in connection with, this website to the extent that the website is provided free-of-charge, for any direct loss; for any indirect, special or consequential loss; or for any business losses, loss of revenue, income, profits or anticipated savings, loss of contracts or business relationships, loss of reputation or goodwill, or loss or corruption of information or data. These limitations of liability apply even when expressly advised of the potential loss.


  1. I had to append the following to /etc/dhcpcd.conf:
    denyinterfaces eth0

    Otherwise dhcpcd was overriding the normal ifup/down commands in /etc/init.d

  2. Chris, YOU SEEM LIKE THE ONLY SANE PERSON WITH REGARD TO THIS SUBJECT! Much thanks for your clear, concise, and sound solution to what plagues so many. I’ve read so much misdirection on the subject of the “new” way to set up a RPi with a static IP and am extremely thankful that I came across yours. Pain is all gone now Doc.!

Leave a Reply