Netplan 无法启动 VLAN

Netplan 无法启动 VLAN

我正在尝试在启动时拥有正确配置的 Ubuntu 20.04 服务器网络。我有一个连接到中继的物理接口,因此我想在其上定义一些 vlan 标记接口。我正在使用 netplan。内容/etc/netplan/50-cloud-init.yaml如下:

network:
    ethernets:
        eno1:
            match:
                macaddress: b8:83:03:XX:XX:XX
            mtu: 1500
        eno2:
        ...
    version: 2
    vlans:
        vlan3110:
            id: 3110
            link: eno1
            dhcp4: no
            addresses: [X.X.X.X/24]
            gateway4: X.X.X.X
        vlan3112:
            id: 3112
            link: eno1
            dhcp4: no
        vlan3111:
            id: 3111
            link: eno1
            dhcp4: no

现在,如果我重新启动系统,则不会为 vlan3110 分配任何 IP:

#ip a
...
9: vlan3110@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether b8:83:03:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    inet6 fe80::ba83:3ff:XXXX:XXXX/64 scope link 
       valid_lft forever preferred_lft forever
...

我不知道为什么。我-vvnetworkd-dispatcher启动选项中添加了/etc/default/networkd-dispatcher

networkd_dispatcher_args="--run-startup-triggers -vv"

但我看不到任何明确的问题:

# journalctl -b |  grep vlan3110
Dec 01 17:45:17 hce02 networkd-dispatcher[1565]: DEBUG:Running immediate triggers for NetworkctlListState(idx=9, name='vlan3110', type='vlan', operational='degraded', administrative='pending')
Dec 01 17:45:17 hce02 networkd-dispatcher[1565]: DEBUG:Ignoring notification for interface NetworkctlListState(idx=9, name='vlan3110', type='vlan', operational='degraded', administrative='pending') entering state 'pending': no triggers
Dec 01 17:45:17 hce02 networkd-dispatcher[1565]: DEBUG:Ignoring notification for interface NetworkctlListState(idx=9, name='vlan3110', type='vlan', operational='degraded', administrative='pending') entering state 'degraded': no triggers

networkctl输出如下:

# networkctl status vlan3110
● 9: vlan3110                                                                
             Link File: /run/systemd/network/10-netplan-eno1.link            
          Network File: /run/systemd/network/10-netplan-eno1.network         
                  Type: vlan                                                 
                 State: degraded (configured)
                Driver: 802.1Q VLAN Support                                  
            HW Address: b8:83:03:4d:ca:48 (Hewlett Packard Enterprise)       
                   MTU: 1500 (max: 65535)                                    
  Queue Length (Tx/Rx): 1/1                                                  
      Auto negotiation: yes                                                  
                 Speed: 1Gbps                                                
                Duplex: full                                                 
                  Port: tp                                                   
               Address: fe80::ba83:3ff:fe4d:ca48                             

Dec 01 18:18:08 hce02 systemd-networkd[1444]: vlan3110: netdev ready
Dec 01 18:18:08 hce02 systemd-networkd[1444]: vlan3110: IPv6 successfully enabled
Dec 01 18:18:08 hce02 systemd-networkd[1444]: vlan3110: Link UP
Dec 01 18:18:12 hce02 systemd-networkd[1444]: vlan3110: Gained carrier
Dec 01 18:18:14 hce02 systemd-networkd[1444]: vlan3110: Gained IPv6LL

如果我删除链接并netplan apply在服务器完成其启动过程后调用,则 IP 将按预期分配:

# ip link delete dev vlan3110
# netplan apply

有人知道发生了什么事吗?

相关内容