Passer au contenu principal
  • Passer des commandes rapidement et facilement
  • Voir les commandes et de suivre l'état de votre expédition
  • Profitez membres seulement récompenses et des remises
  • Créez et accédez à une liste de vos produits

Ubuntu Server Networking

Sommaire: In Ubuntu Server, configuring network interfaces is surprisingly straight-forward. As opposed to other Linux distributions, where there is a configuration

Cet article s’applique à Cet article ne s’applique pas à Cet article n’est lié à aucun produit spécifique. Toutes les versions de produits ne sont pas identifiées dans cet article.

Symptômes

In Ubuntu Server, configuring network interfaces is surprisingly straight-forward. As opposed to other Linux distributions, where there is a configuration file per each interface (which can be hard to manage), there is only one network interface configuration file in Ubuntu:

/etc/network/interfaces

Here is a basic example:

# The loopback network interface
auto lo
iface lo inet loopback

# Built-in NIC, port 1
auto em1
iface em1 inet dhcp

As you can see, the loopback interface and only one NIC port is defined, which is using DHCP. This file will be automatically populated when the OS is installed.

Say that you want to change from DHCP to a static IP address. How do you do it? Easy, though there is an extra step that may not be obvious:

1. Edit config file to look like this:

# The loopback network interface
auto lo
iface lo inet loopback

# Built-in NIC, port 1
auto em1
iface em1 inet static
address 192.168.1.7
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.254 # Your DNS server, if any
dns-search dlr.com # Your DNS search domain, if any

2. Restart networking service:

$ sudo /etc/init.d/networking restart

If using 12.04 or earlier, ignore the 'deprecated' warning message. If using 12.10 or later, you can instead use:

$ sudo restart networking

3. Shutdown the dhclient daemon, otherwise you will get an IP address from DHCP when the lease is renewed, regardless of what's specified in the configuration file:

$ sudo killall dhclient
$ sudo apt-get -y purge isc-dhcp-client

Propriétés de l’article
Numéro d’article: 000146536
Type d’article: Solution
Dernière modification: 21 févr. 2021
Version:  3
Obtenez des réponses à vos questions auprès d’autre utilisateurs de Dell
Services de soutien
Vérifiez si votre appareil est couvert par les services de soutien.