我有一个带有两个物理网络接口的设备,enp2s0 和 enp3s0!
所有通信都应分配给 VLAN。
该设备运行ubuntu,是KVM系统的主机,因此也定义了一个桥接器。
network:
version: 2
renderer: networkd
ethernets:
enp2s0:
# MAC: 00:01:2e:93:a9:88
dhcp4: false
dhcp6: false
wakeonlan: true
enp3s0:
# MAC: 00:01:2e:93:a9:89
dhcp4: false
dhcp6: false
wakeonlan: true
bridges:
br0:
# MAC: ca:b7:f8:5e:99:a4
dhcp4: false
dhcp6: false
interfaces: [enp3s0.108]
vlans:
enp2s0.110:
# MAC: 00:01:2e:93:a9:88
id: 110
link: enp2s0
dhcp4: true
dhcp4-overrides:
send-hostname: true
route-metric: 100
use-routes: false
dhcp6: true
dhcp6-overrides:
send-hostname: true
route-metric: 100
use-routes: false
accept-ra: true
routes:
- to: default
via: 192.168.110.1
metric: 100
- to: default
via: "fe80::2a0:57ff:fe54:ec96"
metric: 100
table: 100
routing-policy:
- from: 192.168.110.8/24
enp3s0.108:
# MAC: 00:01:2e:93:a9:89
id: 108
link: enp3s0
dhcp4: true
dhcp4-overrides:
hostname: f42252v8
use-routes: false
dhcp6: true
dhcp6-overrides:
hostname: f42252v8
use-routes: false
accept-ra: true
routes:
- to: default
via: 192.168.108.1
metric: 200
table: 200
- to: default
via: "fe80::2a0:57ff:fe54:ec96"
metric: 200
table: 200
routing-policy:
- from: 192.168.108.8/24
由于某种原因,enp3s0.108 没有分配 IP 地址。
netplan status --all
WARNING:root:Unknown device type: vlan
WARNING:root:Unknown device type: vlan
WARNING:root:Unknown device type: vlan
WARNING:root:Unknown device type: vlan
WARNING:root:Unknown device type: vlan
WARNING:root:Unknown device type: vlan
Online state: online
DNS Addresses: 127.0.0.1
● 1: lo ethernet UNKNOWN/UP (unmanaged)
MAC Address: 00:00:00:00:00:00
Addresses: 127.0.0.1/8
::1/128
Routes: ::1 metric 256
● 2: enp2s0 ethernet UP (networkd: enp2s0)
MAC Address: 00:01:2e:93:a9:88 (Realtek Semiconductor Co., Ltd.)
Addresses: fe80::201:2eff:fe93:a988/64 (link)
Routes: fe80::/64 metric 256
● 3: enp3s0 ethernet UP (networkd: enp3s0)
MAC Address: 00:01:2e:93:a9:89 (Realtek Semiconductor Co., Ltd.)
● 4: wlp1s0 wifi/"(null)" DOWN (unmanaged)
MAC Address: 48:89:e7:db:ec:d2 (Intel Corporation)
● 5: br0 bridge UP (networkd: br0)
MAC Address: ca:b7:f8:5e:99:a4
Addresses: fe80::c8b7:f8ff:fe5e:99a4/64 (link)
Routes: ...:1302::/64 metric 1024 (ra)
...:1300::/56 via fe80::2a0:57ff:fe54:ec96 metric 1024 (ra)
fe80::/64 metric 256
default via fe80::2a0:57ff:fe54:ec96 metric 1024 (ra)
● 6: enp2s0.110 other UP (networkd: enp2s0.110)
MAC Address: 00:01:2e:93:a9:88
Addresses: 192.168.110.8/24 (dhcp)
...:1301::8/128
fe80::201:2eff:fe93:a988/64 (link)
DNS Addresses: 192.168.110.1
192.168.110.8
fe80::2a0:57ff:fe54:ec96
DNS Search: averlon.loc
Routes: default via 192.168.110.1 metric 100 (static)
192.168.110.0/24 from 192.168.110.8 metric 100 (link)
192.168.110.1 from 192.168.110.8 metric 100 (dhcp, link)
192.168.110.8 from 192.168.110.8 metric 100 (dhcp, host)
...:1301::/64 metric 100 (ra)
...:1300::/56 via fe80::2a0:57ff:fe54:ec96 metric 100 (ra)
fe80::/64 metric 256
default via fe80::2a0:57ff:fe54:ec96 metric 100 (ra)
● 7: enp3s0.108 other UP (networkd: enp3s0.108)
MAC Address: 00:01:2e:93:a9:89
● 10: vnet2 ethernet UNKNOWN/UP (unmanaged)
MAC Address: fe:54:00:a4:86:c4
Addresses: fe80::fc54:ff:fea4:86c4/64 (link)
Routes: fe80::/64 metric 256
我很感激任何可能设置错误的提示。
更新:当我查看我的 DHCP 服务器时,IP 地址被分配给 MAC 地址:00:01:2e:93:a9:89(意味着 enp3s0.108)
顺便说一句,我不知道netplan的错误消息来自哪里。
将接口添加到网桥时,通常需要在网桥接口上进行 IP 配置,而不是底层物理接口(或在本例中为 vlan)。网桥的本质是网桥中的所有接口只有一个 IP 层(第 3 层)配置。
出于调试目的,您可能需要检查在未将 VLAN 接口添加到网桥时是否获得了 DHCP 地址。