Netplan 未将正确的 MTU 应用到 VLAN

Netplan 未将正确的 MTU 应用到 VLAN

操作系统:Ubuntu 18.04.1 LTS(服务器)

Netplan 版本:0.98-0ubuntu1~18.04.1

我正在尝试在单个物理接口上配置具有不同 MTU 的 2 个 VLAN。我能够将物理接口上的 MTU 设置为 9000,但是似乎所有从属于此设备的 VLAN 也继承了 9000。我将其添加mtu: 1500到受影响的 VLAN,但没有生效。我注意到关键字mtu不适用于Netplan 参考. 如何让 netplan 更改 VLAN 的 MTU?

我可以手动更改它:sudo ip link set mtu 1500 dev vl_lan

看起来 netplan 可以很好地解析 YAML:

user@host:~$ cat /run/systemd/network/10-netplan-vl_lan.netdev 
[NetDev]
Name=vl_lan
MTUBytes=1500
Kind=vlan

[VLAN]
Id=10

下面是我的 /etc/netplan 中的 netplan 文件

network:
    version: 2
    ethernets:
        eno1:
            match:
                macaddress: 38:ea:a7:91:5d:d8
            dhcp4: false
            accept-ra: no
            set-name: eno1
            mtu: 9000
        eno2:
            match:
                macaddress: 38:ea:a7:91:5d:d9
            dhcp4: false
            accept-ra: no
            optional: true
            set-name: eno2
    vlans:
        vl_lan:
            accept-ra: no
            id: 10
            link: eno1
            mtu: 1500
            addresses: [ 10.102.0.14/23 ]
            gateway4: 10.102.0.1
            nameservers:
                addresses: [ 10.102.0.1 ]
                search: [ "removed", "removed" ]
        vl_san:
            accept-ra: no
            id: 14
            link: eno1
            mtu: 9000
            addresses: [ 10.102.4.14/24 ]

这是全新启动后的结果配置。除 vl_lan VLAN 的 MTU 外,其他一切都正确:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc mq state UP group default qlen 1000
    link/ether 38:ea:a7:91:5d:d8 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::3aea:a7ff:fe91:5dd8/64 scope link 
       valid_lft forever preferred_lft forever
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 38:ea:a7:91:5d:d9 brd ff:ff:ff:ff:ff:ff
4: vl_lan@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP group default qlen 1000
    link/ether 38:ea:a7:91:5d:d8 brd ff:ff:ff:ff:ff:ff
    inet 10.102.0.14/23 brd 10.102.1.255 scope global vl_lan
       valid_lft forever preferred_lft forever
    inet6 fe80::3aea:a7ff:fe91:5dd8/64 scope link 
       valid_lft forever preferred_lft forever
5: vl_san@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP group default qlen 1000
    link/ether 38:ea:a7:91:5d:d8 brd ff:ff:ff:ff:ff:ff
    inet 10.102.4.14/24 brd 10.102.4.255 scope global vl_san
       valid_lft forever preferred_lft forever
    inet6 fe80::3aea:a7ff:fe91:5dd8/64 scope link 
       valid_lft forever preferred_lft forever

相关内容