为什么我的绑定有两个 ipv6 地址?

为什么我的绑定有两个 ipv6 地址?

您可以在下面看到,该绑定有两个 ipv6 地址:2603:8080:4540:7cfb::13fc 和 2603:8080:4540:7cfb:4866:4bff:fe44:a988。这让我认为 systemd-networkd 在某种程度上未能将绑定视为单个接口。

root@gentooserver /etc/systemd/network # networkctl
IDX LINK  TYPE      OPERATIONAL SETUP     
  1 lo    loopback  carrier     unmanaged
  2 eno1  ether     enslaved    configured
  3 eno2  ether     enslaved    configured
  4 bond1 bond      routable    configured
  5 wg0   wireguard routable    unmanaged

5 links listed.

root@gentooserver /etc/systemd/network # networkctl status bond1
● 4: bond1                                                                               
                     Link File: /lib/systemd/network/99-default.link
                  Network File: /etc/systemd/network/master.network
                          Type: bond
                         State: routable (configured)
                  Online state: online                                                   
                        Driver: bonding
                    HW Address: 4a:66:4b:44:a9:88
                           MTU: 1500 (min: 68, max: 65535)
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
                          Mode: 802.3ad
                        Miimon: 10s
                       Updelay: 20s
                     Downdelay: 1min 20s
          Queue Length (Tx/Rx): 16/16
              Auto negotiation: no
                         Speed: 1Gbps
                        Duplex: full
                       Address: 10.0.0.46 (DHCP4 via 10.0.0.1)
                                2603:8080:4540:7cfb::13fc
                                2603:8080:4540:7cfb:4866:4bff:fe44:a988
                                fe80::4866:4bff:fe44:a988
                       Gateway: 10.0.0.1
                                fe80::96de:80ff:fea8:8096 (GIGA-BYTE TECHNOLOGY CO.,LTD.)
                                fe80::a263:91ff:fe7c:32a2 (NETGEAR)
                           DNS: 10.0.0.1
                                2603:8080:4540:7cfb:96de:80ff:fea8:8096
                Search Domains: dehnel.info
              Carrier Bound To: eno1
                                eno2
             Activation Policy: bound
           Required For Online: yes
               DHCP4 Client ID: IAID:0x8db4800/DUID
             DHCP6 Client IAID: 0x8db4800
             DHCP6 Client DUID: DUID-EN/Vendor:0000ab11abc83a896377c51f0000

Sep 29 17:35:35 gentooserver systemd-networkd[2235623]: bond1: Link UP
Sep 29 17:35:35 gentooserver systemd-networkd[2235623]: bond1: Gained carrier
Sep 29 17:35:35 gentooserver systemd-networkd[2235623]: bond1: Lost carrier
Sep 29 17:35:35 gentooserver systemd-networkd[2235623]: bond1: DHCPv6 lease lost
Sep 29 17:35:35 gentooserver systemd-networkd[2235623]: bond1: Link DOWN
Sep 29 17:35:38 gentooserver systemd-networkd[2235623]: bond1: Link UP
Sep 29 17:35:38 gentooserver systemd-networkd[2235623]: bond1: Gained carrier
Sep 29 17:35:40 gentooserver systemd-networkd[2235623]: bond1: Gained IPv6LL
Sep 29 17:35:42 gentooserver systemd-networkd[2235623]: bond1: DHCPv4 address 10.0.0.46/24 via 10.0.0.1
Sep 29 17:35:43 gentooserver systemd-networkd[2235623]: bond1: DHCPv6 address 2603:8080:4540:7cfb::13fc/128 (valid for 2h, preferred for 1h 15min)

root@gentooserver /etc/systemd/network # tail *
==> bond1.netdev <==
Name=bond1
Kind=bond

[Bond]
Mode=802.3ad
MIIMonitorSec=1s
LACPTransmitRate=fast
TransmitHashPolicy=layer2
UpDelaySec=2s
DownDelaySec=8s

==> eno1.network <==
[Match]
Name=eno1

[Network]
Bond=bond1

==> eno2.network <==
[Match]
Name=eno2

[Network]
Bond=bond1

==> master.network <==
IPv6AcceptRA=yes

[Link]
Multicast=yes

[DHCPv4]
UseDomains=true

[IPv6AcceptRA]
UseDomains=yes

root@gentooserver /etc/systemd/network # ifconfig
bond1: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        inet 10.0.0.46  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::4866:4bff:fe44:a988  prefixlen 64  scopeid 0x20<link>
        inet6 2603:8080:4540:7cfb::13fc  prefixlen 128  scopeid 0x0<global>
        inet6 2603:8080:4540:7cfb:4866:4bff:fe44:a988  prefixlen 64  scopeid 0x0<global>
        ether 4a:66:4b:44:a9:88  txqueuelen 1000  (Ethernet)
        RX packets 179330571  bytes 26132404875 (24.3 GiB)
        RX errors 0  dropped 914092  overruns 0  frame 0
        TX packets 1543646148  bytes 2313271455798 (2.1 TiB)
        TX errors 0  dropped 5 overruns 0  carrier 0  collisions 0

eno1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether 4a:66:4b:44:a9:88  txqueuelen 1000  (Ethernet)
        RX packets 2371371  bytes 200785874 (191.4 MiB)
        RX errors 0  dropped 911837  overruns 0  frame 0
        TX packets 60668  bytes 7644831 (7.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfae00000-fae7ffff  

eno2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether 4a:66:4b:44:a9:88  txqueuelen 1000  (Ethernet)
        RX packets 176959198  bytes 25931618869 (24.1 GiB)
        RX errors 0  dropped 869  overruns 0  frame 0
        TX packets 1543585480  bytes 2313263810967 (2.1 TiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfad00000-fad7ffff  

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 3334928  bytes 580238437 (553.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3334928  bytes 580238437 (553.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1420
        inet 192.168.2.1  netmask 255.255.255.0  destination 192.168.2.1
        inet6 fd86:ea04:1111::1  prefixlen 64  scopeid 0x0<global>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        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 18363  dropped 0 overruns 0  carrier 0  collisions 0

IP 具有相同的 MAC 地址,这让我认为绑定正在工作:

ip -6 neigh show | grep 2603:8080:4540:7cfb::13fc
2603:8080:4540:7cfb::13fc dev wlp170s0 lladdr 4a:66:4b:44:a9:88 router REACHABLE
ip -6 neigh show | grep 2603:8080:4540:7cfb:4866:4bff:fe44:a988
2603:8080:4540:7cfb:4866:4bff:fe44:a988 dev wlp170s0 lladdr 4a:66:4b:44:a9:88 router REACHABLE

答案1

您的 IPv6 前缀长度为 64,因此可以使用 SLAAC 进行自主地址配置。显然,您的 IPv6 路由器通告允许自主配置和 DHCPv6 的使用。

您可能需要运行rdisc6 -1 bond1来查看系统收到的路由器通告的内容。输出可能包括诸如Autonomous address conf.: Yes(即启用 SLAAC 地址配置)和Stateful address conf. : Yes(启用 DHCPv6 地址配置)之类的行。

这将导致为每个接口自动配置两个 IPv6 地址 - 包括本例中的绑定。这是 IPv6 的有效配置,尽管可能不是您所期望的。

2603:8080:4540:7cfb:4866:4bff:fe44:a988似乎是根据 MA​​C 地址和路由器通告的前缀生成的 EUI64 样式地址。它可以通过...:xSxx:xxff:fexx:xxxx格式来识别。这些x数字来自 MAC 地址的相应数字,其中 S 数字的第二个最低有效位反转。

2603:8080:4540:7cfb::13fc那么必须是 DHCPv6 分配的地址。

相关内容