lxc / incus

Powerful system container and virtual machine manager
https://linuxcontainers.org/incus
Apache License 2.0
2.74k stars 223 forks source link

Setting MTU on a network creates a second bridge #491

Closed ineu closed 9 months ago

ineu commented 9 months ago

Required information

Issue description

Setting bridge.mtu to an existing bridge creates a new interface named $NETWORK-mtu, enslaving it to the existing bridge.

Steps to reproduce

  1. Check the default MTU on incusbr0, should be 1500: ip l l incusbr0.
  2. Set MTU for the network: incus network set incusbr0 bridge.mtu=1420
  3. Restart incus to ensure it picks the configuration on start: systemctl restart incus
  4. Check the list of networks: ip l l | grep -A 1 incusbr0

    Actual result: it shows an additional interface incusbr0-mtu:

    18: incusbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1420 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:16:3e:58:10:bf brd ff:ff:ff:ff:ff:ff
    23: incusbr0-mtu: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue master incusbr0 state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether e6:b2:33:96:74:91 brd ff:ff:ff:ff:ff:ff

    Expect result: it should just set MTU to incusbr0, not create new interfaces.

stgraber commented 9 months ago

That's expected behavior. It doesn't create a second bridge at all, it creates an empty (dummy) ethernet device which is joined into the bridge to pin the MTU.

The MTU value when directly applied to the bridge isn't actually fixed, interfaces joining can cause it to go higher or lower. To avoid that effect, we purposefully create a network interface that we set the expected MTU to and then bridge into the bridge.

ineu commented 9 months ago

I see, thanks for the explanation. Should it be documented to avoid such questions in the future? For now the official documentation has been very helpful to me.

stgraber commented 9 months ago

If we had an entry in the https://linuxcontainers.org/incus/docs/main/faq/ is that something you'd have noticed?

I think eventually when we port our network config table to the new way to handle configuration key descriptions, we could add a note directly to the bridge.mtu key, but doing that today isn't easy due to how packed the table is.

ineu commented 9 months ago

is that something you'd have noticed?

I was thinking about something like an asterisk/footnote on the bridge.mtu item here, that would be obvious to a reader (to me at least): https://linuxcontainers.org/incus/docs/main/reference/network_bridge/

But FAQ is also a good option.

stgraber commented 9 months ago

https://github.com/lxc/incus/pull/496

ineu commented 9 months ago

Awesome, thank you!