Inspecting the Bridge Example
Begin by reviewing the example bridge configuration file located at/usr/share/doc/netplan/examples/bridge.yaml:
enp3s0) with DHCP disabled, and a bridge (br0) that obtains an IP address via DHCP. This file serves as our starting template.
Before making any modifications, verify that the network interfaces referenced in the configuration match your system’s hardware.
Copying and Securing the Configuration File
Copy the example file to the Netplan configuration directory and set secure permissions:Identifying Network Interfaces
Determine the network interface names in your system with:enp0s3 is used for primary connectivity (e.g., SSH access) and should not be modified to avoid disconnection. In this lesson, we will use enp0s8 and enp0s9 for the bridge.
Editing the Netplan File for Bridging
Update the Netplan configuration to create a bridge that combinesenp0s8 and enp0s9. Disable DHCP on the individual Ethernet interfaces and enable it solely on the bridge:
enp0s8 and enp0s9 are now slaves to the bridge br0, which is assigned an IP address via DHCP.
Reverting the Bridge Configuration
To remove the bridge configuration and free up the network interfaces, simply delete the YAML file and remove the bridge interface:For a complete reset of network settings in a production environment, consider rebooting the system after deleting the configuration.
Configuring Network Bonding
Next, let’s configure network bonding to provide redundancy and load balancing. Begin by copying the bonding example file and setting secure permissions:/etc/netplan/99-bond.yaml) using your favorite text editor. The corrected configuration below ensures that the Ethernet interfaces are properly defined:
- The Ethernet interfaces
enp0s8andenp0s9have DHCP disabled. - A bond named
bond0is configured with DHCP enabled. - The bonding mode is set to active-backup (Mode 1) with
enp0s8designated as the primary interface. - The MII monitor checks link status every 100 milliseconds.
For a deeper understanding of the bonding options and Netplan configuration, consult the manual by running:sudo man netplanThen search for “bonding” within the manual.
enp0s8 and enp0s9 are slaves of bond0, which is receiving its IP configuration via DHCP.
Viewing Bond Details
To inspect the bond’s details, read the bond status file:Managing Bonded Interfaces
Bonded interfaces can be managed like regular Ethernet interfaces. For example, to bring the bond interface down and assign a static IP address, use:Changes made with the IP command are temporary and will be reset after a system reboot.