wlan1 接口忽略 IPv6 SLAAC(ICMPv6 路由器通告)

wlan1 接口忽略 IPv6 SLAAC(ICMPv6 路由器通告)

我在 Thinkpad W520 上安装了 15.04。但是,我无法在 wlan1 接口上使 IPv6 工作:

ifconfig wlan1
wlan1     Link encap:Ethernet  HWaddr 8c:70:5a:d2:65:bc  
          inet addr:10.0.1.61  Bcast:10.0.1.255  Mask:255.255.255.0
          inet6 addr: fe80::8e70:5aff:fed2:65bc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1534790 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1281764 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:618961336 (618.9 MB)  TX bytes:249411071 (249.4 MB)

在 Wireshark 中我能够看到 ICMPv6 RA 消息:

No.     Time           Source                Destination           Protocol Length Info
      3 775.989536000  fe80::bac7:5dff:fec8:50e ff02::1               ICMPv6   150    Router Advertisement from b8:c7:5d:c8:05:0e

Frame 3: 150 bytes on wire (1200 bits), 150 bytes captured (1200 bits) on interface 0
Ethernet II, Src: Apple_c8:05:0e (b8:c7:5d:c8:05:0e), Dst: IPv6mcast_01 (33:33:00:00:00:01)
Internet Protocol Version 6, Src: fe80::bac7:5dff:fec8:50e (fe80::bac7:5dff:fec8:50e), Dst: ff02::1 (ff02::1)
Internet Control Message Protocol v6
    Type: Router Advertisement (134)
    Code: 0
    Checksum: 0x215a [correct]
    Cur hop limit: 64
    Flags: 0x48
    Router lifetime (s): 1800
    Reachable time (ms): 0
    Retrans timer (ms): 0
    ICMPv6 Option (Source link-layer address : b8:c7:5d:c8:05:0e)
    ICMPv6 Option (Prefix information : 2601:xxxx:xxxx:47fc::/64)
    ICMPv6 Option (Route Information : Medium 2601:xxxx:xxxx:47fc::/64)
    ICMPv6 Option (Recursive DNS Server 2601:xxxx:xxxx:47fc:bac7:5dff:fec8:50e)

Sysctl accept_ra 已启用:

net.ipv6.conf.wlan1.accept_dad = 1
net.ipv6.conf.wlan1.accept_ra = 1
net.ipv6.conf.wlan1.accept_ra_defrtr = 0
net.ipv6.conf.wlan1.accept_ra_from_local = 0
net.ipv6.conf.wlan1.accept_ra_pinfo = 0
net.ipv6.conf.wlan1.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.wlan1.accept_ra_rtr_pref = 0
net.ipv6.conf.wlan1.accept_redirects = 1
net.ipv6.conf.wlan1.accept_source_route = 0
net.ipv6.conf.wlan1.autoconf = 1
net.ipv6.conf.wlan1.dad_transmits = 1
net.ipv6.conf.wlan1.disable_ipv6 = 0
net.ipv6.conf.wlan1.force_mld_version = 0
net.ipv6.conf.wlan1.force_tllao = 0
net.ipv6.conf.wlan1.forwarding = 0
net.ipv6.conf.wlan1.hop_limit = 64
net.ipv6.conf.wlan1.max_addresses = 16
net.ipv6.conf.wlan1.max_desync_factor = 600
net.ipv6.conf.wlan1.mc_forwarding = 0
net.ipv6.conf.wlan1.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.wlan1.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.wlan1.mtu = 1500
net.ipv6.conf.wlan1.ndisc_notify = 0
net.ipv6.conf.wlan1.proxy_ndp = 0
net.ipv6.conf.wlan1.regen_max_retry = 3
net.ipv6.conf.wlan1.router_probe_interval = 60
net.ipv6.conf.wlan1.router_solicitation_delay = 1
net.ipv6.conf.wlan1.router_solicitation_interval = 4
net.ipv6.conf.wlan1.router_solicitations = 3
net.ipv6.conf.wlan1.suppress_frag_ndisc = 1
net.ipv6.conf.wlan1.temp_prefered_lft = 86400
net.ipv6.conf.wlan1.temp_valid_lft = 604800
net.ipv6.conf.wlan1.use_tempaddr = 2
net.ipv6.neigh.wlan1.anycast_delay = 100
net.ipv6.neigh.wlan1.app_solicit = 0
net.ipv6.neigh.wlan1.base_reachable_time_ms = 30000
net.ipv6.neigh.wlan1.delay_first_probe_time = 5
net.ipv6.neigh.wlan1.gc_stale_time = 60
net.ipv6.neigh.wlan1.locktime = 0
net.ipv6.neigh.wlan1.mcast_solicit = 3
net.ipv6.neigh.wlan1.proxy_delay = 80
net.ipv6.neigh.wlan1.proxy_qlen = 64
net.ipv6.neigh.wlan1.retrans_time_ms = 1000
net.ipv6.neigh.wlan1.ucast_solicit = 3
net.ipv6.neigh.wlan1.unres_qlen = 31
net.ipv6.neigh.wlan1.unres_qlen_bytes = 65536

IPv6 路由表:

$ route -6
Kernel IPv6 routing table
Destination                    Next Hop                   Flag Met Ref Use If
fe80::/64                      ::                         U    256 0     0 wlan1
::/0                           ::                         !n   -1  1 11529 lo
::1/128                        ::                         Un   0   7    32 lo
fe80::8e70:5aff:fed2:65bc/128  ::                         Un   0   1     0 lo
ff00::/8                       ::                         U    256 1     0 wlan1
::/0                           ::                         !n   -1  1 11529 lo

IPv6 邻居:

$ ip -6 neigh
fe80::bac7:5dff:fec8:50e dev wlan1 lladdr b8:c7:5d:c8:05:0e router STALE

...并且我能够 ping 通我的住宅网关的本地链路地址:

$ ping6 -I wlan1 fe80::bac7:5dff:fec8:50e
PING fe80::bac7:5dff:fec8:50e(fe80::bac7:5dff:fec8:50e) from fe80::8e70:5aff:fed2:65bc wlan1: 56 data bytes
64 bytes from fe80::bac7:5dff:fec8:50e: icmp_seq=2 ttl=64 time=277 ms
64 bytes from fe80::bac7:5dff:fec8:50e: icmp_seq=3 ttl=64 time=0.848 ms
64 bytes from fe80::bac7:5dff:fec8:50e: icmp_seq=4 ttl=64 time=13.4 ms
64 bytes from fe80::bac7:5dff:fec8:50e: icmp_seq=5 ttl=64 time=1.32 ms
64 bytes from fe80::bac7:5dff:fec8:50e: icmp_seq=6 ttl=64 time=0.934 ms
64 bytes from fe80::bac7:5dff:fec8:50e: icmp_seq=7 ttl=64 time=1.66 ms
^C

关于这可能是什么原因以及如何解决该问题,您有什么想法吗?

谢谢。

答案1

问题出在您的某些 sysctl 设置中:

net.ipv6.conf.wlan1.accept_ra = 1

这个很好:接受路由器广告

net.ipv6.conf.wlan1.accept_ra_defrtr = 0

但是这个选项告诉您的系统不要接受来自 RA 的默认路由。RA 会将路由器宣传为默认网关。如果您希望系统了解这一点,则必须将其设置为1

net.ipv6.conf.wlan1.accept_ra_pinfo = 0

这条命令告诉您的系统不要接受来自 RA 的任何前缀信息。它将无法获知链接上有哪些前缀,因此无法自动配置其地址。

net.ipv6.conf.wlan1.accept_ra_rt_info_max_plen = 0

您的 RA 还包含一条更具体的路由2601:xxxx:xxxx:47fc::/64。此设置告知内核不要接受任何长度超过 的路由/0。如果您要接受,/64则需要将此值至少设置为64

net.ipv6.conf.wlan1.autoconf = 1

这很好。但是,您没有包含有关 RA 消息的所有详细信息。这仅在 RA 中的前缀信息选项设置了 Autoconf (A) 标志时才有效,而该标志在您的问题中不可见。

相关内容