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.
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 :
Bash
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.
Bash
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".
Bash
auto lo iface lo inet loopback
Warning, do not delete these lines.
To configure your network interface (eth0), you must add the following lines :
Notes :
- 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).
Bash
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 8.8.8.8
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 :
Bash
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.
Bash
sudo /etc/init.d/networking restart
To know your IP address, MAC address and other information about your network configuration, type the following command :
Bash
ifconfig
Linux 3/12/2015
Linux 12/20/2014
Linux 10/2/2016
Linux 9/18/2016
Pinned content
Contact
® InformatiWeb-Pro.net - InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.
Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.
You must be logged in to post a comment