Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

10.7. VLAN on Bond and Bridge Using the NetworkManager Command Line Tool, nmcli

To use VLANs over bonds and bridges, proceed as follows:
  1. Add a bond device:
    ~]$ nmcli connection add type bond con-name Bond0 ifname bond0 bond.options "mode=active-backup,miimon=100" ipv4.method disabled ipv6.method ignore
    Note that in this case a bond connection serves only as a "lower interface" for VLAN, and does not get any IP address. Therefore, the ipv4.method disabled and ipv6.method ignore parameters have been added on the command line.
  2. Add ports to the bond device:
    ~]$ nmcli connection add type ethernet con-name Slave1 ifname em1 master bond0 slave-type bond
    ~]$ nmcli connection add type ethernet con-name Slave2 ifname em2 master bond0 slave-type bond
  3. Add a bridge device:
    ~]$ nmcli connection add type bridge con-name Bridge0 ifname br0 ipv4.method manual ipv4.addresses 192.0.2.1/24
  4. Add a VLAN interface on top of bond, assigned to the bridge device:
    ~]$ nmcli connection add type vlan con-name Vlan2 ifname bond0.2 dev bond0 id 2 master br0 slave-type bridge
  5. View the created connections:
    ~]$ nmcli connection show
     NAME     UUID                                  TYPE            DEVICE
     Bond0    f05806fa-72c3-4803-8743-2377f0c10bed  bond            bond0
     Bridge0  22d3c0de-d79a-4779-80eb-10718c2bed61  bridge          br0
     Slave1   e59e13cb-d749-4df2-aee6-de3bfaec698c  802-3-ethernet  em1
     Slave2   25361a76-6b3c-4ae5-9073-005be5ab8b1c  802-3-ethernet  em2
     Vlan2    e2333426-eea4-4f5d-a589-336f032ec822  vlan            bond0.2