Netplan - configuring 2 vlan on same bonding

8,201

Here is the solution :

network:
    version: 2
    renderer: networkd
    ethernets:
        enp61s0f0:
          match:
            macaddress: a0:42:3f:3a:f7:76
          set-name: enp61s0f0
          mtu: 9000
        enp61s0f1:
          match:
            macaddress: a0:42:3f:3a:f7:77
          set-name: enp61s0f1
          mtu: 9000
    bonds:
        bond0:
          mtu: 9000
          dhcp4: false
          dhcp6: false
          interfaces: [ enp61s0f0, enp61s0f1 ]
          parameters:
            mode: balance-xor
            mii-monitor-interval: 100
    vlans:
        bond0.170:
          id: 170
          link: bond0
          addresses : [192.168.170.190/24]
          gateway4: 192.168.170.1
          nameservers:
            search: [network.lan]
            addresses: [192.168.170.100, 192.168.170.101]
          mtu: 9000
        bond0.186:
          id: 186
          link: bond0
          addresses: [192.168.186.225/24]
          mtu: 9000

The MTU settings on every interfaces and vlans seems to be important, moreover it requires to specify mac address for the interfaces.

If you need to set a different MTU on your vlans, you must set the higher under "bond0" like it is above and then change the one you want under vlan section to 1500 for example.

Ludwig

Share:
8,201

Related videos on Youtube

Ludw
Author by

Ludw

Updated on September 18, 2022

Comments

  • Ludw
    Ludw over 1 year

    On my Ubuntu servers (16.04) I used to create a bonding between 2 interfaces and set 2 adresses on it from 2 different vlan.

    I can't manage to create the same configuration with Netplan for my new servers, I only see examples with 1 bonding and 1 address, or 2 vlan but no bonding...

    Here is the interface file file I would like to reproduce :

    auto enp61s0f0
        iface enp61s0f0 inet manual
        bond-master bond0
        mtu 9000
    auto enp61s0f1
        iface enp61s0f1 inet manual
        bond-master bond0
        mtu 9000
    auto bond0
        iface bond0 inet manual
        bond-mode balance-xor
        bond-miimon 100
        bond-slaves none
        mtu 9000
    auto bond0.170
        iface bond0.170 inet static
        vlan-raw-device bond0
        address 192.168.170.190
        netmask 255.255.255.0
        network 192.168.170.0
        broadcast 192.168.170.255
        gateway 192.168.170.1
        dns-nameservers 192.168.170.100 192.168.170.101
        dns-search network.lan
        mtu 9000
    auto bond0.186
        iface bond0.186 inet static
        vlan-raw-device bond0
        address 192.168.186.225
        netmask 255.255.255.0
        network 192.168.186.0
        broadcast 192.168.186.255
        mtu 9000
    

    Do you have any idea how I could do it ?

    Thank you !

    Ludwig