Social Icons

How to configure Static IP on Raspbian (Raspberry Pi)

It's a common requirement to have a Static IP address assigned to your Raspberry Pi, as it makes life a lot easier to SSH into a box for which you know the IP address, instead of looking around in your router's pages.

This guide is for Raspbian OS for Raspberry Pi, and also tested on B+ model

Log on into Raspbian onto command line and list the network interfaces currently available:
cat /etc/network/interfaces

Note, eth0 is by default configured as dhcp (dynamic ip address)

We will change this behavior to static.

Before we proceed we need to determine the following information. All of these you can easily determine if you have setup your local network (wifi router/switch/hub/etc..), alternatively if your have your Raspberry Pi connected to LAN (eth0) you can run the following commands to get details:

Now note the following values:
inet addr:

Next get the Gateway and Destination address (ideally your router IP addess, or use below command):
netstat -nr

Gateway Address –
Destination Address –

Now, we will edit config and set the static ip details:
sudo nano /etc/network/interfaces

Change the line that reads:
iface eth0 inet dhcp


iface eth0 inet static

Next enter the details that you have collected in previous steps:

address                Pi's IP address
netmask           Mask address
network                Destination address
broadcast      Broadcast address
gateway          Gateway address

Now reboot your Raspberry Pi, and next check the config once again:
sudo reboot

after reboot

That's all folks!


  1. I see the problem. In the description of the text you enter as the gateway, and the screenshot you have an IP gateway (IMHO: It is correct).

    1. Thanks for pointing out the typo! Corrected.

  2. sudo dhclient works too