Static IP Address on Raspberry Pi 2

Using Raspian, howto set a static IP Address on the Raspberry Pi 2.

cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

To set the Pi to a static IP address, you need to know the following:
address
netmask
network
broadcast
gateway

Now you edit /etc/network/interfaces and replace iface eth0 inet dhcp with iface eth0 inet static and add the information as above.  Example below, replace with information to suit the network settings for your Pi.

sudo nano /etc/network/interfaces
pi@pi2 ~ $ cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet static
address 192.168.0.XXX
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Now reboot

sudo reboot

One thought on “Static IP Address on Raspberry Pi 2

  1. Toshi November 17, 2015 / 9:36 PM

    Results in a static ip address but NO internet connection so its useless.

    Like

Leave a comment