Example network setting for Debian 11 (server) with bridge

Example

The following is an example of /etc/network/interfaces. It configure a bridge br0 with a physical NIC enp6s0.
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp6s0
iface enp6s0 inet manual

auto br0
iface br0 inet static
  bridge_ports enp6s0
  address 192.168.10.12
  netmask 255.255.255.0
  gateway 192.168.10.1
  dns-nameservers 192.168.10.1
  bridge_stp off
  bridge_maxwait 0

Note

The above setting requires 'bridge-utils' package.

Advantege of using a bridge

Adding a physical NIC to the bridge allows LXC containers and QEMU instances to easily connect to the network to which the host machine belongs. With macvlan and macvtap, there is an issue where the host OS and virtual machine cannot communicate, but this method can solve that.

No comments:

Post a Comment