Debian

Debians network interface configuration is located in /etc/network/interfaces.

It is also possible to divide your configuration into multiple files inside the directory /etc/network/interfaces.d/. A use-case for this could be to store individual interfaces configuration inside individual config files.

Static IP Address

Configuring a static IP address, adjust your configuration in the file /etc/network/interfaces:

allow-hotplug eth0
iface eth0 inet static
  address 82.103.128.15/26
  gateway 82.103.128.1
  dns-nameservers 82.103.191.3 82.103.143.251
  dns-search cust.asergo.com

VLAN Interface

To add a VLAN interface, you can simply add the configuration to /etc/network/interfaces. This example will create a new interface named eth0.10 for VLAN ID 10 using the physical interface eth0 and assign it an IP address:

allow-hotplug eth0.10
iface eth0.10 inet static
        address 10.0.0.15/24
        vlan-raw-device eth0

Enable the interface by running:

$ ifup eth0.10

Systemd

Under systemd, the network may be configured in /etc/systemd/network/.

Static IP

Static IP configuration example:

/etc/systemd/network/enp3s0.network
[Match]
Name=enp3s0

[Network]
Address=82.103.128.15/26
Gateway=82.103.128.1
DNS=82.103.191.3
DNS=82.103.143.251

VLAN

To establish a VLAN, we need to create a config file for the VLAN with an arbitrary name. The name must end with .netdev and .network Example for configuration of VLAN interface:

/etc/systemd/network/enp3s0.network
[Match]
Name=enp3s0

[Network]
DHCP=ipv4
VLAN=enp3s0.10
/etc/systemd/network/enp3s0.10.netdev
[NetDev]
Name=enp3s0.10
Kind=vlan

[VLAN]
Id=10
/etc/systemd/network/enp3s0.10.network
[Match]
Name=enp3s0.10

[Network]
Address=10.0.0.55/24

Bonding

To create a bond interface with Link Aggregation we will create a .netdev file. By default, systemd will create a default bond0 interface with balance round robin mode. This mode cannot be changed so to use another mode we will create a bond1.netdev interface:

/etc/systemd/network/bond1.netdev
[Netdev]
Name=bond1
Kind=bond

[Bond]
Mode=802.3ad

Next we will create a .network with the same name as before. Here we will create a link with the physical interfaces. We will use the pci-id of the interfaces:

Note

To find the pci-id, use the command lspci | grep Ether and locate the network interfaces

/etc/systemd/network/bond1.network
[Match]
Path=pci-0000:02:00.0
Path=pci-0000:02:00.1

[Network]
Bond=bond1

The name of the interface can also be used:

[Match]
name=enp2s0f0
name=enp2s0f1

[Network]
Bond=bond1

The last thing to do is give the bond interface an IP. We will create a new .network file to assign an IP to the network interface:

/etc/systemd/network/bond1-ip.network
[Match]
Name=bond1

[Network]
Address=82.103.128.15/26
Gateway=82.103.128.1