Skip to main content

Netplan, Bonding, and VLANs

Example

This is a configuration using from Ubuntu 18.04 LTS. Two Ethernet interfaces are bonded using the active-passive mode. The untagged bond0 interface is for private traffic, while a public IP address is being delivered to a tagged VLAN sub interface using VLAN 262.

The following packages are required: ifenslave and vlan

network:
  version: 2
  ethernets:
    enp1s0:
      optional: true
    enp2s0:
      optional: true
  bonds:
    bond0:
      addresses: [ 192.168.168.115/24 ]
      interfaces: [ enp1s0, enp2s0 ]
      parameters:
        mode: active-backup
        primary: enp1s0
        mii-monitor-interval: 100
        up-delay: 10000 # must be a multiple of mii-monitor-interval
#      routes:
#        - to: 10.0.0.0/8
#          via: 192.168.168.1
#        - to: 172.16.0.0/12
#          via: 192.168.168.1
#        - to: 192.168.0.0/16
#          via: 192.168.168.1
  vlans:
    bond0.262:
        id: 262
        link: bond0
        addresses: [ 1.1.1.123/28 ]
        gateway4: 1.1.1.113
        nameservers:
            search: [ servers.domain.com ]
            addresses:
            - "8.8.8.8"
            - "8.8.4.4"

References