OpenWrt 内网能获取到 IPv6 地址却无法连通外网

2016-01-16 12:08:35 +08:00
 imsuwj

路由器可以正确获取到 IPv6 地址也可以连通(ping6 ipv6.google.com)

#ifconfig
eth0.2    Link encap:Ethernet  HWaddr 20:76:93:25:AB:35  
          inet addr:172.16.12.87  Bcast:172.16.12.255  Mask:255.255.255.0
          inet6 addr: fe80::2276:93ff:fe25:ab35/64 Scope:Link
          inet6 addr: 2001:xx8:2000:2000:2276:93ff:fe25:ab35/64 Scope:Global
......
#ip -6 route
default from :: via fe80::21a:a9ff:fe0c:e1a7 dev eth0.2  proto static  metric 1024 
default from 2001:xx8:2000:2000::/64 via fe80::21a:a9ff:fe0c:e1a7 dev eth0.2  proto static  metric 1024 
2001:xx8:2000:2000::/64 dev eth0.2  proto static  metric 256 
fd9a:5e29:4d0c::/64 dev br-lan  proto static  metric 1024 
unreachable fd9a:5e29:4d0c::/48 dev lo  proto static  metric 2147483647  error -128
fe80::/64 dev eth0  proto kernel  metric 256 
fe80::/64 dev br-lan  proto kernel  metric 256 
fe80::/64 dev eth0.2  proto kernel  metric 256 
fe80::/64 dev ra0  proto kernel  metric 256 
fe80::/64 dev ifb0  proto kernel  metric 256

局域网上的电脑:

$ifconfig                                                                             
enp4s0f2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::290:f5ff:fef0:3919  prefixlen 64  scopeid 0x20<link>
        inet6 2001:xx8:2000:2000:290:f5ff:fef0:3919  prefixlen 64  scopeid 0x0<global>
        inet6 2001:xx8:2000:2000:e47c:df65:4349:718c  prefixlen 64  scopeid 0x0<global>
    ......

可以获取到 IPv6 地址, 2001****3919 的那个是 global addr (电脑直接接网线就是这个地址),但是路由器下连却不能连通 IPV6 网络(ping6 ipv6.google.com)。

该如何解决?

13576 次点击
所在节点    问与答
18 条回复
sdysj
2016-01-16 13:03:21 +08:00
openwrt 默认的 dnsmasq 不支持 ipv6
imsuwj
2016-01-16 13:19:51 +08:00
@sdysj 不是通过 dnsmasq + odhcpv6 来分配 ipv6 地址的吗?况且我不是已经获得了正确的 IPV6 地址了吗?而且直接 Ping6 ipv6 地址也不通
Return2legacy
2016-01-16 13:27:09 +08:00
用的是 odhcpd 和 odhcpv6 来吧。重点是 lan 还是 network 配置里 wan6 要填端口,其它默认都可以了。
liboyue
2016-01-16 13:29:55 +08:00
在 LuCI 先删除 Global ULA-Prefix ,然后修改 /etc/config/dhcp 如下(对照修改):

config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option ra 'hybrid'
option dhcpv6 'hybrid'
option ndp 'hybrid'
option ra_management '1'

config dhcp 'wan6'
option interface 'wan'
option dhcpv6 'hybrid'
option ra 'hybrid'
option ndp 'hybrid'
option master '1'

然后执行

/etc/init.d/odhcpd restart


这是当时折腾记的,你看看有没有用(⊙_⊙)
反正我是搞好了,但是 odhcpd 不稳定,时不时需要重启
kiritoalex
2016-01-16 14:08:38 +08:00
不要用 dhcpv6 之类的,没用。。只能用 Radvd
chunchu
2016-01-16 14:13:15 +08:00
这个问题也一直困扰了我好久,到现在还没有解决,楼主要是解决了说说过程
mxalbert1996
2016-01-16 14:29:01 +08:00
这个问题我研究过好长时间,结论就是新版 OpenWRT 自带的 dhcpv6 有问题。。。就算连上并且能上外网了过一会儿就又不行了。。。还是得用 radvd ,然而好像还得自己编译,麻烦的很。。。
heygu
2016-01-16 14:38:49 +08:00
按照 4 楼的配置,是可以成功的,关于掉线问题,去年 9 月份之后的版本已经改善了
ChangeTheWorld
2016-01-16 16:31:41 +08:00
楼主你需要 NPD6 这个神器,专业解决 CERNET2 IPv6 路由问题,至于分配地址用 RADVD 就可以了
Mikewu
2016-01-16 18:19:30 +08:00
这个问题我已经纠结了几年来, openwrt 实现太麻烦,最方便就是 LAN 口再接入一根教育网
zro
2016-01-16 19:00:30 +08:00
电脑上 [ping6 2001:4860:4860::8888] 是神马结果???
datocp
2016-01-16 19:15:27 +08:00
没玩过原生 ipv6 ,可以看看这几篇文档

http://blog.iopsl.com/ipv6-behind-openwrt-router/

参考文档
这篇文档以非常简洁的方式实现了 6to4 ipv6 网络,最好再检查 /etc/config/network ,该项配置默认应该就是开启的,这样 br-lan 可以获得 6to4-wan6 接口提供的 2002:XXXX:XXXX::1/64 地址。
config interface 'lan'
option ip6assign '64'

OpenWrt 配置 IPv6 之 6to4 隧道
http://demon.tw/hardware/openwrt-ipv6-6to4.html

OpenWRT 配置 IPv6 的 NAT (一般结合 isatap 使用)
https://blog.blahgeek.com/2014/02/22/openwrt-ipv6-nat/ ;

这篇文档提供了一句至关重要的路由命令
IPV6 NAT WITH OPENWRT ROUTER
http://blog.iopsl.com/ipv6-nat-with-openwrt-router/

下面的文档有段 ipv6 的防火墙设置,修改 6in4-henet 为 ifconfig 显示的 ipv6 接口 6to4-wan6 ,终于能在客户端 ping 了。
IPv6 配置指南( Backfire 及更高版本适用)
http://wiki.openwrt.org/zh-cn/doc/howto/ipv6

IPv6 Firewalling
https://www.sixxs.net/wiki/IPv6_Firewalling
imsuwj
2016-01-16 20:50:41 +08:00
@zro ping 不通
@datocp LAN 已经获得 IPV6 地址
yexm0
2016-01-16 20:54:35 +08:00
openwrt 实现太麻烦+1,还不如直接用华硕,网件之类的路由,用固件自带的 ipv6 透传功能就没这些烦心事了.
chotony
2016-01-16 21:01:49 +08:00
@imsuwj
电脑 IPv6 能否正常使用?
电脑 和 路由器 间 ping6 是否通?
imsuwj
2016-01-16 21:12:53 +08:00
@chotony 电脑直接接网线上教育网是通的。通过路由器就只获得 IPV6 地址却连不上 ipv6 网络。比如网关的 ipv6addr 是 2001:xx8:2000:2000:2276:93ff:fe25:ab35 ,电脑 ping6 它是通的
zro
2016-01-16 22:08:21 +08:00
你的 OpenWRT 内置有 ebtables 和 brctl 命令么?有的话可以直接 IPv6 穿透了
20150517
2016-01-16 22:10:19 +08:00
ipv6 有什么好处啊

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/251153

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX