我有 2 个以太网设备,我设置了一个可以正常工作的设备,其中还包括默认网关。现在我想添加第二个网段,我根据文档在 netplan 中进行了设置。netplann 既不生成 netplan,也不在调试模式下应用 croaks 以查找任何故障,但第二个 ip 地址未出现在接口上。(实际上未连接)
yaml 文件:
network:
ethernets:
enp1s0:
addresses:
- 192.168.1.2/24
enp2s0:
addresses:
- 192.168.63.251/24
nameservers:
search: [domain.tld]
addresses: [192.168.63.1, 192.168.63.254]
routes:
- to: default
via: 192.168.63.254
version: 2
但 enp1s0 的 ip 地址尚未设置
enp1s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:d0:b4:02:40:24 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x80e00000-80efffff
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.63.251 netmask 255.255.255.0 broadcast 192.168.63.255
inet6 fe80::2d0:b4ff:fe02:4025 prefixlen 64 scopeid 0x20<link>
ether 00:d0:b4:02:40:25 txqueuelen 1000 (Ethernet)
RX packets 1888295 bytes 1372768091 (1.3 GB)
RX errors 0 dropped 224009 overruns 0 frame 0
TX packets 498157 bytes 136051635 (136.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x80b00000-80bfffff
我是否遗漏了某个条目?
齐索·格尔德
答案1
您提到 enp1s0 实际上并未连接,这可能是它无法通过 Netplan+systemd-networkd 配置的原因。
尝试添加一个ethernets.enp1s0.ignore-carrier: true
设置,例如:
network:
ethernets:
enp1s0:
addresses:
- 192.168.1.2/24
ignore-carrier: true
enp2s0:
[...]