How to configure a Static IP Address on the Raspberry Pi
Please share with your friends...
  • 8
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    8
    Shares

This article is a quick how-to for configuring a Static IP Address on the Raspberry Pi.

The method of configuring a Static IP Address on Raspberry Pi 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=192.168.0.10/24
    static routers=192.168.0.1
    static domain_name_servers=192.168.0.1 8.8.8.8

    Adjust the values to suit your network environment.

    FieldDescription
    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 255.255.255.0 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:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
              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. Linux® is a registered trademark of Linus Torvalds.
How to configure a Static IP Address on the Raspberry Pi

Please share with your friends...
  • 8
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    8
    Shares
Tagged on:                             

Leave a Reply

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