Configure static local IP on Raspberry Pi Raspbian
1. Login to your Raspberry Pi and check your networking
ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:7c:05:22
inet addr:192.168.1.123 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
2. Edit the network config file »interfaces«
sudo nano /etc/network/interfaces
3. You will see these lines
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
auto eth0
iface lo inet loopback
iface eth0 inet dynamic
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.con
4. Change the lines to this configuration (don't mind the comments)
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
auto eth0
iface lo inet loopback
iface eth0 inet static # dynamic is changed to static
address 192.168.1.100 # your custom local IP
netmask 255.255.255.0 # same as Mask on ifconfig
network 192.168.1.0 # same as Bcast on ifconfig but with the zero at the end
broadcast 192.168.1.255 # same as Bcast on ifconfig
gateway 192.168.1.1 # default local network IP
dns-nameservers 8.8.8.8 8.8.4.4 # Google's DNS servers
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
5. Save the file and restart networking
sudo /etc/init.d/networking restart
6. Check your local static IP
ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:7c:05:22
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
7. You may have to reboot your Raspberry Pi
sudo reboot
Note: You can also edit /etc/resolv.conf but these changes will be overwritten on reboot.