Debian: Configure a static IP address

In order to configure a network device statically, you have to edit /etc/network/interfaces:

# vi /etc/network/interfaces

There you can configure a static IP address and the subnet mask:

auto eth0
iface eth0 inet static
address 192.168.128.128
netmask 255.255.255.0

In order to have the changes enabled, you need to restart the network interface either with:

# /etc/init.d/networking restart

or

# /etc/init.d/networking stop
# /etc/init.d/networking start

or

# ifdown eth0
# ifup eth0

You can then check the new eth0 settings with:

# ifconfig -a

 

Leave a Reply

Your email address will not be published. Required fields are marked *