How to Set static IP in Raspberry Pi 2?

Generally Raspberry Pi sets IP address automatically from the wired or wireless network.This type of assigning IP address is called DHCP(Dynamic Host Configuration Protocol,sometimes referred as Dynamic IP.

So your router will change the IP address everytime when you are connecting to the network.It will be a problem when you are trying to access it remotely or if you are show casing it as a end product.
So how do we set Static IP in Raspberry Pi 2?
Open your command prompt and enter the following command
sudo ifconfig
Make note of your Current IP ,broadcast and netcast(These details you can get from your windows machine also which is connected to the same network)
Now you need to edit your interface files to set the static information.Before changing please check your windows machine for gateway,broadcast and other information.
Open the interface files with you favourite editor(nano,gedit,emacs) and mine is nano.
iface eth0 inet static
address YOUR IP
After setting your configurations ,press Ctrl+x to save your configurations.
Now your raspberry pi and check your Pi’s IP and ping it from other PC it should work.
For reboot Raspberry Pi type the following command.
sudo reboot


For more queries:


Posted in Breakout boads, Breakout Board, Raspberry P and tagged , .