Netplan 不会从 yaml 文件分配给定的 IP

Netplan 不会从 yaml 文件分配给定的 IP

我有一个 Ubuntu 20.04.1 系统,我正在尝试设置具有静态地址的以太网适配器和具有静态地址的 vlan - 这是我的 yaml 文件:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0f0:
      match:
        macaddress: 00:14:5e:75:49:d2
      mtu: 1450
      dhcp4: no
      addresses: [10.0.8.5/21]
      gateway4: 10.0.8.1
      nameservers:
              addresses: [10.0.8.1]

  vlans:
    vlan.30:
      id: 30
      link: enp1s0f0
      mtu: 1450
      dhcp4: no
      addresses: [10.30.0.5/24]

这是我的调试输出:

DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:1460): DEBUG: 14:26:04.184: Processing input file /etc/netplan/10-enp1.yaml..
** (generate:1460): DEBUG: 14:26:04.184: starting new processing pass
** (generate:1460): DEBUG: 14:26:04.184: We have some netdefs, pass them through a final round of validation
** (generate:1460): DEBUG: 14:26:04.184: vlan.30: setting default backend to 1
** (generate:1460): DEBUG: 14:26:04.184: Configuration is valid
** (generate:1460): DEBUG: 14:26:04.184: enp1s0f0: setting default backend to 1
** (generate:1460): DEBUG: 14:26:04.184: Configuration is valid
** (generate:1460): DEBUG: 14:26:04.184: Generating output files..
** (generate:1460): DEBUG: 14:26:04.184: openvswitch: definition enp1s0f0 is not for us (backend 1)
** (generate:1460): DEBUG: 14:26:04.184: NetworkManager: definition enp1s0f0 is not for us (backend 1)
** (generate:1460): DEBUG: 14:26:04.184: openvswitch: definition vlan.30 is not for us (backend 1)
** (generate:1460): DEBUG: 14:26:04.184: NetworkManager: definition vlan.30 is not for us (backend 1)
(generate:1460): GLib-DEBUG: 14:26:04.184: posix_spawn avoided (fd close requested)
(generate:1460): GLib-DEBUG: 14:26:04.185: posix_spawn avoided (fd close requested)

这是我的 vlan.30 的 /run/systemd/network:

root@datacenter:/run/systemd/network# cat 10-netplan-vlan.30.network
[Match]
Name=vlan.30

[Link]
MTUBytes=1450

[Network]
LinkLocalAddressing=ipv6
Address=10.30.0.5/24
ConfigureWithoutCarrier=yes

重启后-这是我的 ifconfig:

enp1s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.0.8.5  netmask 255.255.248.0  broadcast 10.0.15.255
        inet6 fe80::214:5eff:fe75:49d2  prefixlen 64  scopeid 0x20<link>
        ether 00:14:5e:75:49:d2  txqueuelen 1000  (Ethernet)
        RX packets 17389  bytes 2543742 (2.5 MB)
        RX errors 0  dropped 467  overruns 0  frame 0
        TX packets 410  bytes 62055 (62.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xf7ca0000-f7cc0000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 85  bytes 6392 (6.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 85  bytes 6392 (6.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vlan.30: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.0.8.5  netmask 255.255.248.0  broadcast 10.0.15.255
        inet6 fe80::214:5eff:fe75:49d2  prefixlen 64  scopeid 0x20<link>
        ether 00:14:5e:75:49:d2  txqueuelen 1000  (Ethernet)
        RX packets 2544  bytes 582229 (582.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 26  bytes 2032 (2.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

我的问题是 - 为什么没有为 vlan.30 接口设置正确的静态 IP?

感谢您的帮助!

相关内容