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

Yur*_*uri 3 ipv6 wireless networking autoconf 15.04

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

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)
Run Code Online (Sandbox Code Playgroud)

在 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)
Run Code Online (Sandbox Code Playgroud)

启用 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
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

IPv6 邻居:

$ ip -6 neigh
fe80::bac7:5dff:fec8:50e dev wlan1 lladdr b8:c7:5d:c8:05:0e router STALE
Run Code Online (Sandbox Code Playgroud)

...而且我可以 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
Run Code Online (Sandbox Code Playgroud)

关于它可能是什么以及如何解决这个问题的任何想法?

谢谢。

San*_*ann 6

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

net.ipv6.conf.wlan1.accept_ra = 1
Run Code Online (Sandbox Code Playgroud)

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

net.ipv6.conf.wlan1.accept_ra_defrtr = 0
Run Code Online (Sandbox Code Playgroud)

但是这个告诉你的系统不要接受来自 RA 的默认路由。RA 确实将路由器通告为默认网关。如果您希望您的系统学习这一点,那么您必须将其设置为1.

net.ipv6.conf.wlan1.accept_ra_pinfo = 0
Run Code Online (Sandbox Code Playgroud)

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

net.ipv6.conf.wlan1.accept_ra_rt_info_max_plen = 0
Run Code Online (Sandbox Code Playgroud)

您的 RA 还包含更具体的路由2601:xxxx:xxxx:47fc::/64。这个设置告诉内核不要接受任何超过 a 的路由/0。如果您想接受这一点,/64那么您需要将此值设置为至少64.

net.ipv6.conf.wlan1.autoconf = 1
Run Code Online (Sandbox Code Playgroud)

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