Bridged network
This example shows how to configure a simple bridge interface using netplan.
Step 1 - (Pre)configure the bridge on the host
In order to use the bridged network, bridge interface needs to be preconfigured on the host machine.
Create the bridge interface (br0
in our case) by creating a file with the following content:
network:
version: 2
renderer: networkd
ethernets:
eth0: {} # (1)!
bridges:
br0: # (2)!
interfaces:
- eth0
dhcp4: true
dhcp6: false
addresses: # (3)!
- 10.10.0.17
-
Existing ethernet interface to be enslaved.
-
Custom name of the bridge interface.
-
Optionally a static IP address can be set for the bridge interface.
Tip
See the official netplan configuration examples for more complex configurations.
Validate if the configuration is correctly parsed by netplan.
sudo netplan generate
Apply the configuration.
sudo netplan apply
Step 2 - Disable netfilter on the host
The final step is to prevent packets traversing the bridge from being sent to iptables for processing.
cat >> /etc/sysctl.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
EOF
sysctl -p /etc/sysctl.conf
Tip
For more information, see the libvirt documentation.
Step 3 - Set up a cluster over bridged network
In the cluster configuration file, set the following variables:
cluster.network.mode
tobridge
,cluster.network.bridge
to the name of the bridge you have created (br0
in our case) andcluster.network.gateway
if the first host innetwork_cidr
is not a gateway.
cluster:
network:
mode: "bridge"
cidr: "10.10.13.0/24"
gateway: "10.10.13.1"
bridge: "br0"
...