Netplan bond/bridge MTU setting not being honored on Bionic system

9,198

Solution 1

I resolved this by adding the MTU settings to both the "bonds:" and "bridges:" sections (removed from the "ethernets:" section). Here is the working config:

# Ceph network configuration
network:
  version: 2
  renderer: networkd
  ethernets:
    eth2:
      dhcp4: no
      optional: true
    eth3:
      dhcp4: no
      optional: true
  bonds:
    bond1:
      interfaces: [ eth2, eth3 ]
      mtu: 9000
      parameters:
        mode: 802.3ad
        mii-monitor-interval: 100
        lacp-rate: fast
  vlans:
    bond1.220:
      id: 220
      link: bond1
      optional: true
  bridges:
    br-ceph-access:
      optional: true
      addresses: [ 172.16.238.133/24 ]
      interfaces: [ bond1.220 ]
      mtu: 9000
      parameters:
        forward-delay: 9
        hello-time: 2
        max-age: 12
        stp: false

Solution 2

I think you want to match devices by MAC address, otherwise it's hard for systemd-networkd to know exactly which devices to apply the MTU to. You should also specify the MTU is 9000 for the bond itself, as its options will be applied to the underlying interfaces when they are added to the bond:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth2:
      match:
        macaddress: 00:00:aa:bb:cc:dd
      dhcp4: no
      dhcp6: no
      optional: true
      mtu: 9000
    eth3:
      match:
        macaddress: 01:01:aa:bb:cc:de
      dhcp4: no
      dhcp6: no
      optional: true
      mtu: 9000
  bonds:
    bond1:
      mtu: 9000
      interfaces: [ eth2, eth3 ]
      parameters:
        mode: 802.3ad
        mii-monitor-interval: 100
        lacp-rate: fast
  vlans:
    bond1.220:
      id: 220
      link: bond1
      mtu: 9000
  bridges:
    br-ceph-access:
      addresses: [ x.x.x.x/24 ]
      interfaces: [ bond1.220 ]
      parameters:
        forward-delay: 9
        hello-time: 2
        max-age: 12
        stp: false

Watch out though, matching devices comes with its own set of issues; see https://github.com/CanonicalLtd/netplan/commit/a27122bc8d8e066b1a90a7fd8d65342e8b906a8e

Share:
9,198

Related videos on Youtube

Andre Goree
Author by

Andre Goree

Updated on September 18, 2022

Comments

  • Andre Goree
    Andre Goree over 1 year

    I'm running Netplan on an 18.04 system. I've been able to workout and convert most of my network configuration from my 16.04 systems to Netplan for 18.04, however I've run into an issue now when trying to set the MTU to 9000 on a bridge that uses a bond that is part of a VLAN.

    My configuration:

    # Ceph network configuration
    network:
      version: 2
      renderer: networkd
      ethernets:
        eth2:
          dhcp4: no
          dhcp6: no
          optional: true
          mtu: 9000
        eth3:
          dhcp4: no
          dhcp6: no
          optional: true
          mtu: 9000
      bonds:
        bond1:
          interfaces: [ eth2, eth3 ]
          parameters:
            mode: 802.3ad
            mii-monitor-interval: 100
            lacp-rate: fast
      vlans:
        bond1.220:
          id: 220
          link: bond1
          mtu: 9000
      bridges:
        br-ceph-access:
          addresses: [ x.x.x.x/24 ]
          interfaces: [ bond1.220 ]
          parameters:
            forward-delay: 9
            hello-time: 2
            max-age: 12
            stp: false
    

    I've added 'mtu: 9000' to both NICs that are part of the bond, and to the VLAN as well. I've done this, because the adding 'mtu: 9000' to the bond interface or the bridge interface produces the error "unknown key mtu"

    In any case, the mtu: 9000 setting is not honored, as you can see here in the relevant sections of ip a (notice mtu 15000):

    4: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond1 state UP group default qlen 1000
        link/ether b2:07:76:18:10:5b brd ff:ff:ff:ff:ff:ff
    5: eth3: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond1 state UP group default qlen 1000
        link/ether b2:07:76:18:10:5b brd ff:ff:ff:ff:ff:ff
    10: br-ceph-access: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
        link/ether 4e:b5:52:25:a4:c5 brd ff:ff:ff:ff:ff:ff
        inet x.x.x.x/24 brd 172.16.238.255 scope global br-ceph-access
           valid_lft forever preferred_lft forever
    11: bond1: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether b2:07:76:18:10:5b brd ff:ff:ff:ff:ff:ff
    

    So where am I going wrong here? What is the proper way to set mtu with Netplan? Have I discovered a bug that needs to be reported?

  • Andre Goree
    Andre Goree about 5 years
    Thanks for this. I'm so sorry I forgot to return to this question and explain how I resolved it (a few months ago now). I'll add my answer below -- fortunately I did not have have to use MAC address matching haha.