Advanced Network Setup

Network Bridge

Kernel Configuration

Enable the following options in the kernel configuration and recompile the kernel if necessary:

Networking support: Y
  Networking options:
    802.1d Ethernet Bridging: M or Y

Setting up a Network Bridge

In this section we are going to discuss how to set up a network bridge using systemd-networkd. In the examples below, eth0 represents the external interface that is being bridged, while br0 represents the bridge interface.

To create a bridge interface, create the following configuration file by running the following command as the root user:

cat > /etc/systemd/network/50-br0.netdev << EOF
[NetDev]
Name=br0
Kind=bridge
EOF

To assign a network interface to a bridge, create the following configuration file by running the following command as the root user:

cat > /etc/systemd/network/51-eth0.network << EOF
[Match]
Name=eth0

[Network]
Bridge=br0
EOF

Repeat the process for any other interfaces that need to be bridged. Note that it is important that nothing assigns any addresses to the bridged interfaces. If you are using NetworkManager-1.44.2, make sure you configure them to ignore the bridged interfaces, as well as the bridge interface itself.

If you are on a network which uses DHCP for assigning ip addresses, create the following configuration file by running the following command as the root user:

cat > /etc/systemd/network/60-br0.network << EOF
[Match]
Name=br0

[Network]
DHCP=yes
EOF

Alternatively, if using a static ip setup, create the following configuration file by running the following command as the root user:

cat > /etc/systemd/network/60-br0.network << EOF
[Match]
Name=br0

[Network]
Address=192.168.0.2/24
Gateway=192.168.0.1
DNS=192.168.0.1
EOF

To bring up the bridge interface, simply restart the systemd-networkd daemon by running the following command as the root user:

systemctl restart systemd-networkd