How to set static IP address in Raspbian

I assume that Raspbian has been assigned an IP address automatically by your home wireless router using DHCP. To set a static IP address for it:

  • Run ifconfig. Note the interface (say eth0) and the values of the inet addr, Bcast and Mask entries.

  • Run netstat -nr. Note down the values of the Gateway and Destination entries.

  • Open the /etc/network/interfaces file in an editor.

  • Change the interface dhcp parameter to static.

  • Add these lines below that and save the file:

address 192.168.0.99
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
  • 192.168.0.99 is the static IP address you want to assign to the system. 255.255.255.0 is the Mask value noted above. 192.168.0.0 is the Destination value noted above. 192.168.0.255 is the Bcast value noted above. 192.168.0.1 is the Gateway value noted above.

  • You will also need to set the DNS servers manually, as described here.

  • Reboot the system and it should have the static IP address you assigned.

Tried with: Raspbian 7

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s