- Published on : 08 March 2014 at 19:32 UTC
- By Lionel Eppe
When you install Ubuntu on a machine to use it as a server, it is recommended to set a static IP address on that server to prevent the IP address of the server changes all the time.
- Uninstall the network manager (networkmanager)
- Configure the network interfaces manually
- Restart the network service to apply the changes
- Connaitre sa configuration réseau
To set a static IP and make this setting persists address, you MUST remove the installed Ubuntu 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 :
sudo apt-get remove network-manager-gnome network-manager
Note : The network icon appear in the top bar (Ubuntu Desktop) has disappeared after uninstalling this program.
To configure your network interfaces, you must edit the "/etc/networks/interfaces" file.
sudo vi /etc/network/interfaces
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, do not delete these lines.
To configure your network interface (eth0), you must add the following lines :
- Leave a blank line to separate the two interfaces.
- You can specify the DNS server because as indicated on the Ubuntu website , the utility "resolvconf" uses this file to get the regarding information servers (DNS servers).
auto eth0 iface eth0 inet static # IP Configuration address 192.168.1.6 netmask 255.255.255.0 gateway 192.168.1.1 # Serveurs DNS dns-nameservers 192.168.1.1 220.127.116.11
Note : It is mandatory to specify which DNS servers to use as they had previously received from the DHCP server. Being that it has disabled use the DHCP server, we therefore find no DNS server address. It is therefore necessary to specify in order to regain access to google.com ...
If you then want to reset your network dynamic map, you can simply reset dhcp instead of static :
auto eth0 iface eth0 inet dhcp
To restart the network service, you can simply type this command.
Ubuntu will show the command is deprecated but still it works correctly.
We do not recommend using this command stop and start as it crashed we graphical interface of Ubuntu and we did just restart our Ubuntu machine.
sudo /etc/init.d/networking restart
To know your IP address, MAC address and other information about your network configuration, type the following command :