CumulusNetworks / ifupdown2

GNU General Public License v2.0
161 stars 76 forks source link

vxlan multicast, default mtu must be 50bytes lower than physdev #110

Open aderumier opened 5 years ago

aderumier commented 5 years ago

configuration

auto eno4 iface eno4

auto vxlan7 iface vxlan7 vxlan-id 7 vxlan-svcnodeip 212.0.0.1 vxlan-physdev eno4

test

ifup vxlan7 error: vxlan7: cmd '/bin/ip -force -batch - [link set dev vxlan7 mtu 1500 ]' failed: returned 1 (RTNETLINK answers: Invalid argument Command failed -:1 )

Seem than kernel check that mtu of vxlan interface must be 50 bytes lower than mtu of physdev.

Note that, This don't throw error with unicast vxlan with auto vxlan7 iface vxlan7 inet manual vxlan-id 7 vxlan_remoteip 192.168.0.2

or bgp-evpn with

auto vxlan7 iface vxlan3 inet manual vxlan-id 7 vxlan-local-tunnelip 192.168.0.3

(But technically, the mtu should be lower too to handle vxlan overhead, but I don't think we can be able to auto detect easily the physical interface used for outgoing packets)

aderumier commented 5 years ago

This is coming from /usr/share/ifupdown2/addons/address.py

   if ifaceobj.link_kind:
        # bonds and vxlan devices need an explicit set of mtu.
        # bridges don't need mtu set
        if (ifaceobj.link_kind & ifaceLinkKind.BOND or
            ifaceobj.link_kind & ifaceLinkKind.VXLAN):
            running_mtu = self.ipcmd.link_get_mtu(ifaceobj.name)
            if (self.default_mtu and running_mtu != self.default_mtu):
                 self.ipcmd.link_set(ifaceobj.name, 'mtu', self.default_mtu)
            return

Not sure why we don't need to set an explicit default mtu for vxlan interfaces ?

for multicast vxlan interface, if we don't force mtu, kernel auto assign a mtu-50 from physdev for other vxlan interfaces, the kernel setup 1500 by default.