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 192.168.1.100         # <-- Your new static IP address
gateway 192.168.1.1           # <-- Your gateway address
netmask 255.255.255.0         # <-- Net mask (Mask)
network 192.168.1.0           # <-- Network usually ends with .0
broadcast 192.168.1.255       # <-- 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):

nameserver 192.168.1.2
nameserver 192.168.1.3

Finally restart networking with following command:

# ifdown eth0
# ifup eth0