Pi Static IP Address

Setting a Static IP Address on Your Pi


To perform the following steps, you’ll need to have a USB keyboard plugged into your Pi and the Pi plugged into a TV or monitor.

  1. Wait for the Pi to fully boot up and take note of the IP address after “My IP address is”. If you don’t see this line, you can use the ifconfig command after logging in to find the IP address (it will be labeled as “inet”).
  2. Log in using pi as the username and raspberry as the password.
  3. Type this command: sudo pico /etc/network/interfaces and hit Enter.
  4. Delete the contents of the document that appears and enter the following:

auto eth0
iface eth0 inet static
address 192.168.1.97 <<< NOTE: This should start with the first three octets of the IP that you noted in step 1 (e.g. 192.168.1, 10.0.0, etc.), followed by .97.
netmask 255.255.255.0
gateway 192.168.1.1 <<< NOTE: Same as note above except the last digit should be 1.

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.96 <<< NOTE: This should start with the first three octets of the IP that you noted in step 1 (e.g. 192.168.1, 10.0.0, etc.), followed by .96.
netmask 255.255.255.0
gateway 192.168.1.1 <<< NOTE: Same as note above except the last digit should be 1.
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

  1. Press Ctrl + O to save and then press Ctrl + X to close the document.
  2. Type sudo systemctl disable dhcpcd and hit Enter.
  3. Type sudo systemctl enable networking and hit Enter.
  4. Reboot the Pi by typing sudo reboot and hitting Enter.

Your Pi should now have a static IP address. You can double-check this when the Pi boots up again by making sure the IP ends in .97 or .96 (depending on if you’re using Wi-Fi or Ethernet).