Why do I Want a Static IP Address?
An IP Address (Internet Protocol) is a a set of numerical digits that identify a device and its location on a network. It is similar to your house address except that it uses numbers. If your Raspberry Pi is connected your Router then it will automatically be given its own IP address. The issue is that this address will change each time you log on and off. This is know as a Dynamic Address - it changes. A Static IP Address remains the same all the time and makes it easier to access your Pi.
Getting Started
Basically you need to identify your current network settings and modify them so that the IP Address remains static. Firstly check that your address is not already Static .
In the LX Terminal type: cat /etc/network/interfaces This will load an overview of the connected network devices, you are looking for the third line which states: iface eth0 inet dhcp The DHCP means that your IP Address is Dynamic and will change when you turn the Pi off. |
Collecting the Information: Part 1
The next part is to collect the information relating to the your current IP Address, the Broadcast address and the Netmask address, these are abbreviated to Inet, Bcast and Mask. All the values are on the same line so it is easy to coppy them down in one go
In the LX Terminal type: ifconfig Write these three values down as you will require them later
|
Collecting the Information: Part 2
Making the IP Address Static
The final part of the Static IP process is to open the original cat /etc/network/interfaces file in edit mode.
In the LX Terminal type: sudo nano/etc/network/interfaces Change the iface etho0 inet dchp to iface etho0 inet static Next enter the previous information you collected in parts 1 and 2 , in a list below the statement iface etho0 inet static, address 192.34..... etc (inet address) broadcast 194.34..... etc (Bcast) netmask 255.25..... etc (Mask) network 192.34..... etc (Destination ) gateway 192.34..... etc (Gateway) Remember to replace the addresses with the ones from your network that you collected earlier. |
And to Finish with....
If you are comfortable with IP addressing schemes you can also change the inet address, the first one, to one of your choice - or keep it the same as it is. To complete the process reboot your Raspberry Pi,
In the LX Terminal type:
sudo reboot
You are all finished, you could ping the IP address to check the settings,
In the LX Terminal type:
ping 192.156.23.5 c-10
The c-10 only sends 10 pings!
In the LX Terminal type:
sudo reboot
You are all finished, you could ping the IP address to check the settings,
In the LX Terminal type:
ping 192.156.23.5 c-10
The c-10 only sends 10 pings!