绑定设置:
root@gentooserver /etc/systemd/network # tail -n +1 *
==> bond1.netdev <==
[NetDev]
Name=bond1
Kind=bond
[Bond]
Mode=802.3ad
MIIMonitorSec=1s
LACPTransmitRate=fast
TransmitHashPolicy=layer2
UpDelaySec=2s
DownDelaySec=8s
==> bond1.network <==
[Match]
Name=bond1
[Network]
BindCarrier=eno1 eno2
==> eno1.network <==
[Match]
Name=eno1
[Network]
Bond=bond1
DHCP=no
==> eno2.network <==
[Match]
Name=eno2
[Network]
Bond=bond1
DHCP=no
==> master.network <==
[Match]
Name=bond1
[Network]
DHCP=yes
UseDNS=true
绑定和两个从属被列为具有相同的 IP4 地址:
root@gentooserver /etc/systemd/network # ifconfig
bond0: flags=5123<UP,BROADCAST,MASTER,MULTICAST> mtu 1500
ether a6:9c:13:85:9a:c1 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
bond1: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 10.0.0.45 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::1974:cfdd:ab17:6686 prefixlen 64 scopeid 0x20<link>
inet6 2605:6000:1020:395:93b1:9356:17cb:7937 prefixlen 64 scopeid 0x0<global>
inet6 2605:6000:1020:395::13fc prefixlen 128 scopeid 0x0<global>
inet6 2605:6000:1020:395:4866:4bff:fe44:a988 prefixlen 64 scopeid 0x0<global>
ether 4a:66:4b:44:a9:88 txqueuelen 1000 (Ethernet)
RX packets 22160 bytes 2917664 (2.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7431 bytes 778961 (760.7 KiB)
TX errors 0 dropped 1 overruns 0 carrier 0 collisions 0
eno1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
inet 10.0.0.45 netmask 255.255.255.0 broadcast 10.0.0.255
ether 4a:66:4b:44:a9:88 txqueuelen 1000 (Ethernet)
RX packets 9361 bytes 1339502 (1.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2928 bytes 147234 (143.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfb200000-fb27ffff
eno2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
inet 10.0.0.45 netmask 255.255.255.0 broadcast 10.0.0.255
ether 4a:66:4b:44:a9:88 txqueuelen 1000 (Ethernet)
RX packets 12799 bytes 1578162 (1.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4503 bytes 631727 (616.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfb100000-fb17ffff
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 3198 bytes 391535 (382.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3198 bytes 391535 (382.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ping4 不起作用,ping6 起作用:
root@gentooserver /etc/systemd/network # ping4 google.com
PING google.com (74.125.136.139) 56(84) bytes of data.
From gentooserver.dehnel.info (10.0.0.45) icmp_seq=1 Destination Host Unreachable
From gentooserver.dehnel.info (10.0.0.45) icmp_seq=2 Destination Host Unreachable
From gentooserver.dehnel.info (10.0.0.45) icmp_seq=3 Destination Host Unreachable
^C
--- google.com ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 67ms
pipe 4
root@gentooserver /etc/systemd/network # ping6 google.com
PING google.com(atl26s15-in-x0e.1e100.net (2607:f8b0:4002:812::200e)) 56 data bytes
64 bytes from atl26s15-in-x0e.1e100.net (2607:f8b0:4002:812::200e): icmp_seq=1 ttl=51 time=52.6 ms
64 bytes from atl26s15-in-x0e.1e100.net (2607:f8b0:4002:812::200e): icmp_seq=2 ttl=51 time=52.4 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 2ms
rtt min/avg/max/mdev = 52.415/52.518/52.622/0.251 ms
从站被列为“可路由的”:
root@gentooserver /etc/systemd/network # networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 eno1 ether routable configured
3 eno2 ether routable configured
4 bond0 bond no-carrier unmanaged
5 bond1 bond routable configured
5 links listed.
根据文档,它们应该被列为“被奴役”:https ://www.freedesktop.org/software/systemd/man/networkctl.html
最简单的解决方案似乎是添加
denyinterfaces eno*
到 /etc/dhcpcd.conf。