我正在尝试在 ubuntu 22.04 服务器上配置我的网络接口,但是遇到了有关分配的 IP 的问题。
服务器是 Dell R330,带有双板载 Broadcom BCM5720 NIC,我添加了 Dell 的 Intel I350-T4 卡(二手,但为正品 Dell/Intel 部件)。因此服务器总共有 6 个 NIC。
该服务器的目的是作为虚拟化主机。
我不得不说,我对现代 Linux 系统还很陌生,但我设法正确安装了所有内容,但面临有关 IP 配置的问题。
因此我使用 netplan 来配置如下接口(我试图让网络保持简单):
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: no
dhcp6: no
addresses:
- 192.168.10.55/24
routes:
- to: default
via: 192.168.10.254
nameservers:
addresses: [194.2.0.20, 8.8.8.8]
eno2:
dhcp4: no
dhcp6: no
addresses:
- 192.168.10.41/24
routes:
- to: default
via: 192.168.10.254
nameservers:
addresses: [194.2.0.20, 8.8.8.8]
enp2s0f0:
dhcp4: no
dhcp6: no
addresses:
- 192.168.10.56/24
routes:
- to: default
via: 192.168.10.254
nameservers:
addresses: [194.2.0.20, 8.8.8.8]
enp2s0f1:
dhcp4: no
dhcp6: no
addresses:
- 192.168.10.57/24
routes:
- to: default
via: 192.168.10.254
nameservers:
addresses: [194.2.0.20, 8.8.8.8]
enp2s0f2:
dhcp4: no
dhcp6: no
addresses:
- 192.168.10.58/24
routes:
- to: default
via: 192.168.10.254
nameservers:
addresses: [194.2.0.20, 8.8.8.8]
enp2s0f3:
dhcp4: no
dhcp6: no
addresses:
- 192.168.10.59/24
routes:
- to: default
via: 192.168.10.254
nameservers:
addresses: [194.2.0.20, 8.8.8.8]
但是当我这样做时,ip a
我得到了:
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: enp2s0f0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether b4:96:91:bd:94:44 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.56/24 brd 192.168.10.255 scope global enp2s0f0
valid_lft forever preferred_lft forever
inet 192.168.10.184/24 brd 192.168.10.255 scope global secondary enp2s0f0
valid_lft forever preferred_lft forever
inet6 fe80::b696:91ff:febd:9444/64 scope link
valid_lft forever preferred_lft forever
3: eno1: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 10:98:36:a9:e1:c5 brd ff:ff:ff:ff:ff:ff
altname enp4s0f0
inet 192.168.10.55/24 brd 192.168.10.255 scope global eno1
valid_lft forever preferred_lft forever
inet 192.168.10.181/24 brd 192.168.10.255 scope global secondary eno1
valid_lft forever preferred_lft forever
inet6 fe80::1298:36ff:fea9:e1c5/64 scope link
valid_lft forever preferred_lft forever
4: eno2: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 10:98:36:a9:e1:c6 brd ff:ff:ff:ff:ff:ff
altname enp4s0f1
inet 192.168.10.41/24 brd 192.168.10.255 scope global eno2
valid_lft forever preferred_lft forever
inet 192.168.10.182/24 brd 192.168.10.255 scope global secondary eno2
valid_lft forever preferred_lft forever
inet6 fe80::1298:36ff:fea9:e1c6/64 scope link
valid_lft forever preferred_lft forever
5: enp2s0f1: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether b4:96:91:bd:94:45 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.57/24 brd 192.168.10.255 scope global enp2s0f1
valid_lft forever preferred_lft forever
inet 169.254.226.157/16 brd 169.254.255.255 scope global enp2s0f1
valid_lft forever preferred_lft forever
inet6 fe80::b696:91ff:febd:9445/64 scope link
valid_lft forever preferred_lft forever
6: enp2s0f2: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether b4:96:91:bd:94:46 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.58/24 brd 192.168.10.255 scope global enp2s0f2
valid_lft forever preferred_lft forever
inet 169.254.181.188/16 brd 169.254.255.255 scope global enp2s0f2
valid_lft forever preferred_lft forever
inet6 fe80::b696:91ff:febd:9446/64 scope link
valid_lft forever preferred_lft forever
7: enp2s0f3: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether b4:96:91:bd:94:47 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.59/24 brd 192.168.10.255 scope global enp2s0f3
valid_lft forever preferred_lft forever
inet 169.254.18.189/16 brd 169.254.255.255 scope global enp2s0f3
valid_lft forever preferred_lft forever
inet6 fe80::b696:91ff:febd:9447/64 scope link
valid_lft forever preferred_lft forever
8: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:cf:6e:36 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
如您所见,已应用 netplan,但对于某些接口,我有一个由 DHCP(由 cisco asa)分配的辅助 ip,而对于其他接口,有一个 APIPA 辅助地址(但没有关键字 secondary)。
我不明白为什么 DHCP 服务器会分配辅助地址,而且我不明白为什么 I350-T4 主板的最后 3 个网卡会收到 APIPA 地址。
我确实做错了什么,但我说不出具体是什么。
您能给我建议并帮助我吗?
(抱歉我的英语水平一般)
编辑:我认为值得一提的是,在我使用 netplan 之前,辅助 IP 以相同的方式被分配为主 IP(前 3 个 NIC 使用 DHCP,后 3 个 NIC 使用 APIPA),这已经很奇怪了。这就是为什么我尝试使用 netplan 配置所有接口的原因。
编辑:我发现了问题,看看我的回答
感谢 mpboden 尽力提供帮助!
祝福大家。