链路抖动后缺少 ipv6 全局地址

链路抖动后缺少 ipv6 全局地址

在 linux/ubuntu 中,接口上的链路故障后,全局 ipv6 地址被清除,在 ifconfig 中看不到。是否有内核补丁/sysctl 可以保留链路故障后配置的 ipv6 地址?

另外,此行为与同一接口上的 ipv4 地址不同,在链路翻转时 ipv4 地址会保留,这是否是仅适用于 ipv6 地址的行为的特殊原因?

root@ubuntu:/home/sharb# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0c:29:99:03:c2  
          inet addr:192.168.136.160  Bcast:192.168.136.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe99:3c2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

root@ubuntu:/home/sharb# ip -6 addr add dead::1/120 dev eth0
root@ubuntu:/home/sharb# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state  UP group default qlen 1000
   link/ether 00:0c:29:99:03:c2 brd ff:ff:ff:ff:ff:ff
   inet 192.168.136.160/24 brd 192.168.136.255 scope global eth0
   valid_lft forever preferred_lft forever
   inet6 dead::1/120 scope global 
   valid_lft forever preferred_lft forever
   inet6 fe80::20c:29ff:fe99:3c2/64 scope link 
   valid_lft forever preferred_lft forever

root@ubuntu:/home/sharb# ifconfig eth0 down
root@ubuntu:/home/sharb# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 00:0c:29:99:03:c2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.136.160/24 brd 192.168.136.255 scope global eth0
    valid_lft forever preferred_lft forever

root@ubuntu:/home/sharb# ifconfig eth0 up
root@ubuntu:/home/sharb# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:99:03:c2 brd ff:ff:ff:ff:ff:ff
inet 192.168.136.160/24 brd 192.168.136.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe99:3c2/64 scope link 
   valid_lft forever preferred_lft forever
root@ubuntu:/home/sharb# ifconfig eth0 
eth0      Link encap:Ethernet  HWaddr 00:0c:29:99:03:c2  
  inet addr:192.168.136.160  Bcast:192.168.136.255  Mask:255.255.255.0
  inet6 addr: fe80::20c:29ff:fe99:3c2/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:48116 errors:0 dropped:0 overruns:0 frame:0
  TX packets:13355 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000 
  RX bytes:65293789 (65.2 MB)  TX bytes:1052427 (1.0 MB)"

答案1

这可能是由于属性keep_addr_on_down的默认设置造成的。请检查您可以通过将此属性设置为 1 并再次触发链接来测试它。

相关内容