ifupdown configuring
Configuring network interface on Ubuntu Server with ifupdown
Show all network interfaces on your server.
ip addr
Open the file and edit:
sudo nano /etc/network/interfaces
Default
auto lo
iface lo inet loopback
DHCP Configuration
auto enp3s0
allow-hotplug enp3s0
iface eth0 inet dhcp
Static interfaces with two local ip adresses.
# The primary network interface
auto enp1s0
iface enp1s0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8
# The secondary network interface
iface enp1s0 inet static
address 192.168.1.101
netmask 255.255.255.0
Install bridge interfaces package.
sudo apt update
sudo apt install bridge-utils
Static bridge interfaces with two local ip adresses.
# Bridge between eth0 and eth1 or enp1s0 enp2s0
auto br0
iface br0 inet static
address 10.0.0.1
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.1
dns-nameservers 10.0.0.1 8.8.8.8
bridge_ports enp1s0 enp5s0 eno1
bridge_stp off
bridge_fd 0
bridge_maxwait 0
# The secondary network interface
iface br0 inet static
address 10.0.0.150
netmask 255.255.255.0
Applying the Changes
restart interfaces
sudo systemctl restart networking