The way you set a static IP address has changed from Raspbian Wheezy to Raspbian Jessie. This is how you set a static IP in Raspbian Jessie. This tutorial works for a Pi connected via ethernet, but you can follow a similar approach for a Pi connected over wifi. First, connect your Raspberry Pi to your network you want a static IP on. SSH into your Pi. Your router will automatically give you an ip address.
Now, let’s see what credentials the network gave you. Type the following command in the terminal.
1 |
ifconfig |
You will get an output like this. We want the first 3 sets of numbers in the field named inet addr.
In my case, we see 192.168.1.
Now, lets edit the dhcp.conf file and set our desired ip address.
1 |
sudo nano /etc/dhcpcd.conf |
Go to the very bottom of the file and enter the following. You may need to change these numbers to fit your network. Replace the first 3 sets of numbers with the numbers we got earlier for every case. Leave the last number the same, except for the ip_address field. Put a custom number for the last number, 1-254. If you want to set a static ip for WIFI, change eth0 to wlan0. be sure to end your desired ip address in the ip_address field with /24. So you end up with 192.168.1.XXX/24.
1 2 3 4 |
interface eth0 static ip_address=192.168.1.100/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1 |
In this case, my ip address will be 192.168.1.100. Be sure to pick an ip address not currently being used. There are many ways to check this. For windows, there is a great tool called Angry IP scanner that I like.
Save this file by pressing Ctrl + x, then hit y.
Now reboot.
1 |
sudo reboot |
Let’s make sure it worked. Check your current ip.
1 |
ifconfig |
Under eth0 in the inet addr:, your ip address should be what you requested.
That is it. Enjoy.