Set Static IP on Debian

In /etc/network/interfaces find interface for which you want to set static IP and edit it like in the example bellow.

If you’re unsure what to enter, you can check you current settings with: /sbin/ifconfig and to find your gateway address ip route show (see the first line where is written via).

iface [interface] inet static # <-- Change DHCP to static here!
address         # <-- Your new static IP address
gateway           # <-- Your gateway address
netmask         # <-- Net mask (Mask)
network           # <-- Network usually ends with .0
broadcast       # <-- Broadcast (Bcast)

If you need to modify your name server(s), you can edit the /etc/resolv.conf file, and enter servers one by line, like in the example bellow (in my case this was already set):


Finally restart networking with following command:

# ifdown eth0
# ifup eth0

This is archived version of blog, preventing broken links. This version will stay online indefinitely.