我花了一下午的时间尝试在 Ubuntu 20.04 服务器上绑定一些网卡。根据 ip a 和 /proc/net/bonding,绑定似乎正常,但我只能 ping 绑定本身的 ip,其他一切都返回无法访问网络。
Netplan 配置是
network:
ethernets:
enp1s0:
dhcp4: false
dhcp6: false
optional: true
enp2s0:
dhcp4: false
dhcp6: false
optional: true
bonds:
bond0:
interfaces: [enp1s0, enp2s0]
addresses: [192.168.44.173/24]
gateway4: 192.168.44.1
nameservers:
addresses: [8.8.8.8]
parameters:
mode: active-backup
#mode: balance-alb
mii-monitor-interval: 1
primary: enp1s0
version: 2
当我应用这个配置时我得到
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: enp1s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
link/ether 3a:16:23:70:af:55 brd ff:ff:ff:ff:ff:ff
3: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc mq master bond0 state DOWN group default qlen 1000
link/ether 3a:16:23:70:af:55 brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 3a:16:23:70:af:55 brd ff:ff:ff:ff:ff:ff
inet 192.168.44.173/24 brd 192.168.44.255 scope global bond0
valid_lft forever preferred_lft forever
inet6 fe80::3816:23ff:fe70:af55/64 scope link
valid_lft forever preferred_lft forever
5: tailscale0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1280 qdisc fq_codel state UNKNOWN group default qlen 500
link/none
inet6 fe80::20df:bfda:fa00:48e9/64 scope link stable-privacy
valid_lft forever preferred_lft forever
看起来没问题,路由如下
default via 192.168.44.1 dev bond0 proto static
192.168.44.0/24 dev bond0 proto kernel scope link src 192.168.44.173
和 /proc/net/bonding/bond0 为
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: enp1s0 (primary_reselect always)
Currently Active Slave: enp1s0
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0
Slave Interface: enp2s0
MII Status: down
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:18:7d:d7:e9:aa
Slave queue ID: 0
Slave Interface: enp1s0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:18:7d:d7:e9:a9
Slave queue ID: 0
我放弃了这个并试图恢复到带有 dhcp 的单一接口,但是现在 nic 出现了,但却拒绝获取任何类型的地址(即使重新启动,它现在要等待一分钟多的地址,然后才能在没有地址的情况下继续)。
有人能告诉我我哪里出了问题吗?肯定不会这么难。
哒。
答案1
我认为问题肯定是其中一个交换机中的 arp 表损坏了或者类似的东西。
机器关闭 24 小时后我又回来查看它,它就可以正常工作了(动态地址和绑定网卡)。
感谢那些观看的人。
对于任何人来说,上述配置确实有效。