NIC Bonding and VLAN Tagging with nmcli
Configured an active-backup bond across two virtual NICs and added 802.1Q VLAN sub-interfaces on top of it, entirely through nmcli and NetworkManager connection profiles.
Environment
- ›RHEL 9.4
- ›2 virtual NICs (enp0s8, enp0s9)
- ›NetworkManager (nmcli, nmtui)
Objectives
- 01Create an active-backup bond from two interfaces
- 02Add tagged VLAN sub-interfaces (VLAN 10 and 20) on top of the bond
- 03Verify failover by downing the active slave and confirming connectivity holds
Walkthrough
Step 1
Create the bond and add slaves
Created a bond0 connection in active-backup mode, then attached both physical interfaces as slaves and brought everything up.
$ nmcli con add type bond ifname bond0 mode active-backup$ nmcli con add type ethernet ifname enp0s8 master bond0$ nmcli con add type ethernet ifname enp0s9 master bond0$ nmcli con up bond0
Step 2
Assign a static IP to the bond
Set a static address on bond0 rather than DHCP, matching the lab's static addressing scheme, and confirmed it came up.
$ nmcli con mod bond0 ipv4.addresses 192.168.56.20/24 ipv4.method manual$ nmcli con up bond0$ ip -4 addr show bond0
Step 3
Add tagged VLAN sub-interfaces
Created two VLAN interfaces on top of bond0 — VLAN 10 for a 'servers' segment and VLAN 20 for 'management' — each with its own subnet.
$ nmcli con add type vlan con-name bond0.10 ifname bond0.10 dev bond0 id 10 ip4 10.0.10.5/24$ nmcli con add type vlan con-name bond0.20 ifname bond0.20 dev bond0 id 20 ip4 10.0.20.5/24$ nmcli con up bond0.10 && nmcli con up bond0.20
Step 4
Test failover
Started a continuous ping over bond0.10, then set the active slave down with nmcli and watched cat /proc/net/bonding/bond0 to confirm the backup slave took over with no dropped pings.
$ ping -c 100 10.0.10.1 &$ nmcli dev disconnect enp0s8$ cat /proc/net/bonding/bond0
Outcomes
- ✓Bond + VLAN config survives a reboot — all stored as NetworkManager connection profiles, no manual ifcfg editing
- ✓Confirmed active-backup failover with zero packet loss in the lab
- ✓Comfortable explaining the difference between nmcli con and nmcli dev commands