This article gives an overview of how the network configuration in Debian can be stored and modified in the configuration file / etc / network / interfaces .
Automatic activation at startup
In order for certain interfaces to be activated automatically during the boot process, these must be entered with the auto parameter in the configuration file.The following example shows a system with a network card eth0 (the loopback interface lo should also always be activated):
auto lo eth0
Configuration of the individual interfaces
The following examples show different possible network interface configurations
Configuration of the loopback interface
The loopback interface should always be present and is also entered automatically:
iface lo inet loopback
Configuration of a static IP address
A static IP address is iface eth0 inet static
configured by means of .The following example shows the configuration with an IP address, a subnet mask, a default gateway and a DNS server:
iface eth0 inet static address 192.168.0.111 netmask 255.255.255.0 gateway 192.168.0.1 dns-search somedomain.org dns-nameservers 192.168.0.1
Configuring a Dynamic IP Address (DHCP)
A dynamic IP address is iface eth0 inet dhcp
configured by:
iface eth0 inet dhcp
Example of a system with two network cards
The following example shows the configuration file of a system with two network adapters. The first network card (eth0) automatically gets an IP address via DHCP (a default gateway is also configured here by DHCP). The second network card (eth1) is configured with a fixed IP address.
debian: ~ # cat / etc / network / interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces (5). # The loopback network interface car lo eth1 iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet dhcp iface eth1 inet static address 192.168.56.2 netmask 255.255.255.0 debian: ~ #
0 Comments