Setting up a static ip on debian

February 23, 2015

To configure a static IP (an IP that will never change) in debian you must edit the file /etc/networking/interfaces and do the following changes.

Determine the interface you want to make static. (If there are multiple)

$ ifconfig

The edit /etc/network/interfaces and find the following line.

iface eth0 inet dhcp

Replace it with this:

iface eth0 inet static
   address 192.168.1.10
   netmask 255.255.255.0
   network 192.168.1.0
   broadcast 192.168.1.255
   gateway 192.168.1.1

Make sure you replace all values so they fit your network settings.

Restart the network interface to enable the changes. After running this command you might get logged out when then network interface is down.

$ ifdown eth0 && ifup eth0

Check if all settings are correct.

$ ifconfig

comments powered by Disqus