- Published on : 05 March 2015 at 13:31 UTC
- By Lionel Eppe
When you install Debian on a machine to use it as a server, it's recommended to set a static IP address for it.
Tested under Debian 7.7.0.
- Uninstall the network manager (networkmanager)
- Configure the network interfaces manually
- Restart the network service to apply the changes
To set a static IP and make this setting persists address, you MUST remove the installed Debian network manager. This program tends to do everything he can to keep the network connection, even delete your settings and reset your network connection automatically (Assigning the IP address via a DHCP server).
For this program avoids deleting your custom configuration, the easiest way is to remove it :
apt-get remove network-manager-gnome network-manager
Note : The network icon appear in the top bar has disappeared after uninstalling this program.
To configure your network interfaces, you must edit the "/etc/networks/interfaces" file.
By default, you will find the following lines :
Note : This is the configuration of the network card loopback called "local loop". This information is displayed by the command "ifconfig".
auto lo iface lo inet loopback
Warning, don't delete these lines.
To configure your network interface (eth0), you must add the following lines :
- Leave a blank line to separate the two interfaces.
auto eth0 iface eth0 inet static address 10.0.0.6 netmask 255.0.0.0 gateway 10.0.0.1
And edit the "/etc/resolv.conf" file for DNS servers :
nameserver xx.xx.xx.xx nameserver xx.xx.xx.xx
Warning : DNS servers listed in the "/etc/resolv.conf" file will be overwritten by those received via DHCP, if you change the interface into "dhcp" instead of "static".
service networking restart
Check the network configuration by typing this :
If the IP address isn't correct, restart the machine :
Now, the IP address and DNS servers are correctly defined.