Open bigeagle opened 8 years ago
老楼的话能分到原生ipv6地址,但是只有/64,可以用relay模式: http://ict.jingyan.info/openwrt-%e7%94%a8odpcpd%e9%85%8d%e7%bd%aerelay-%e6%96%b9%e5%bc%8f-ipv6/
据 @Blaok 说似乎不太稳定?
现在紫荆也有原生IPv6地址了,不过还是NAT66稳定。当年折腾relay的时候用的还是BB,一直有问题,后来就一直NAT了,不知道CC怎么样。
学校的ipv6还是很稳定的,路由器本身的地址没问题,就是relay服务(aka:odhcpd)时好时坏。
野路子解决办法法有两个:
ping -6 [路由器v6 IP]
或者
/etc/init.d/odhcpd restart 连打n次
2016年3月16日 16:28,"Blaok" notifications@github.com写道:
现在紫荆也有原生IPv6地址了,不过还是NAT66稳定。当年折腾relay的时候用的还是BB,一直有问题,后来就一直NAT了,不知道CC怎么样。
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/tuna/ipv6.tsinghua.edu.cn/issues/7#issuecomment-197209751
为啥不用 bridge 配 ebtables ?
本邮件具有数字签名,敬请核对。 王邈 清华大学计算机科学与技术系 电话:+86 130-5186-7712 通信地址:北京市海淀区清华大学紫荆公寓2号楼307A 100084
Please check the digital signature attached with the e-mail. Miao Wang Department of Computer Science and Technology, Tsinghua University Tel.: +86 130-5186-7712 Add.: Room 307A, No.2 Zijing Building, Tsinghua University, Peking. P.R.C. 100084
在 2016年3月17日,00:08,贺叶霜 notifications@github.com 写道:
学校的ipv6还是很稳定的,路由器本身的地址没问题,就是relay服务(aka:odhcpd)时好时坏。
野路子解决办法法有两个:
ping -6 [路由器v6 IP]
或者
/etc/init.d/odhcpd restart 连打n次
2016年3月16日 16:28,"Blaok" notifications@github.com写道:
现在紫荆也有原生IPv6地址了,不过还是NAT66稳定。当年折腾relay的时候用的还是BB,一直有问题,后来就一直NAT了,不知道CC怎么样。
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/tuna/ipv6.tsinghua.edu.cn/issues/7#issuecomment-197209751
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/tuna/ipv6.tsinghua.edu.cn/issues/7#issuecomment-197401318
教程可以提供多种方式嘛。 现在看起来还是这几种方式:
@aixlx 你昨晚的问题解决了么?
@bigeagle 并没有,感觉如 hexchain 所说, odhcp6c 和 odhcpd的锅。
最后PC和OpenWrt能互相ping通ipv6 addr,然而延时动辄达到几十上百ms,还时不时断掉。
以下为详细报道:(略)
我是在CC RC1和DD trunk下成功的,设备是newifi mini
DHCP配置
# /etc/config/dhcp:
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
# option dhcpv6 'server'
option ra 'relay'
option ndp 'relay'
#config dhcp 'wan'
#option interface 'wan'
#option ignore '1'
config dhcp 'wan6'
option ra 'relay'
option ndp 'relay'
option master '1'
然后还要把/etc/config/network
里面的IPv6 ULA-Prefix
删掉
ebtables-ipv6
#!/bin/sh
#### This is a script for ipv6 bridge and ipv4 routing
EXTIF=eth0
INTIFS=eth1 wifi
BRIDGE=br0
ip link add name $BRIDGE type bridge
ip link set $BRIDGE up
ip link set $EXTIF master $BRIDGE up
for $interface in $INTIF; do
ip link set interface master $BRIDGE;
done
ebtables -A FORWARD -o $EXTIF -p ! ipv6 -j DROP
ebtables -t broute -A BROUTING -i $EXTIF -p ! ipv6 -j DROP
####
Now, you can apply a inter IP address such as 192.168.0.1 to $BRIDGE, which
is served as gateway address for wifi users
# ip a add 192.168.0.1 dev $BRIDGE
And set up your WAN interface
# dhclient $EXTIF
And enable forward and nat
# echo 1 > /proc/net/ipv4/conf/forward
# iptables .....
最后那段能不能改成luci命令什么的 带点参数 搞成一个一键式配置脚本?不然我觉得还是有很多人不会用。。
这是我还在2012年的时候写的,可能有点过期了
https://wiki.tuna.tsinghua.edu.cn/OpenWrt/Tplink%20WR-703N#ipv6
On Sat, Mar 19, 2016, at 22:50, huiyiqun wrote:
最后那段能不能改成luci命令什么的 带点参数 搞成一个一键式配置脚本?不然我觉得还是有很多人不会用。。 — You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub[1]
Links:
等我今晚试试
我没用过openwrt呀,我只用过正常的linux
发自我的 iPhone
在 2016年3月19日,22:50,huiyiqun notifications@github.com 写道:
最后那段能不能改成luci命令什么的 带点参数 搞成一个一键式配置脚本?不然我觉得还是有很多人不会用。。
— You are receiving this because you commented. Reply to this email directly or view it on GitHub
@Blaok 你负责下这个 issue 吧,我帮你配 jekyll :)
现在IPV6 NAT已经不再需要NAT66了,这里有一个HOWTO
世界如此多姿多彩……我只配成功过NAT66并且可预见未来不打算换配置……我的测试环境是CC。假设路由器已经能够连接IPv6,原生或隧道都可以。
0: 确保内核模块和有用的软件包都被包含在固件里,包括但不限于:ip kmod-ipt-nat6 kmod-ip6tables luci-ipv6 iputils-traceroute6
1: OpenWRT默认会分配IPv6私网地址,在Network->Interfaces
页面底下有个Global network options
,IPv6 ULA-Prefix
这里应该有一个随机的fd
开头的/64
地址,LAN客户端应该能自动获得这个地址范围内的IPv6地址,DHCPv6和SLAAC默认都开了
2: 客户端有了正确的地址以后,需要在路由器上打开NAT66。OpenWRT默认的防火墙配置不会管IPv6的nat表,我一般是在/etc/firewall.user
里面加上
WAN6=eth0
LAN=br-lan
ip6tables -t nat -A POSTROUTING -o $WAN6 -j MASQUERADE
ip6tables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
ip6tables -A FORWARD -i $LAN -j ACCEPT
WAN6和LAN分别改成外网IPv6和内网网卡(interface)的名字,注意不是防火墙区域(zone)的名字,也不是LuCI里面Network->Interfaces
里面看到的名字,而是ifconfig
看到的名字。
3: 在路由器上ip -6 route
看一下自己的默认网关。如果获得的是
default from 2402:f000:x:xxxx::/64 via fe80::xxxx:xxxx:xxxx:xxxx dev eth0 proto static metric 512
这样坑爹的网关,在转发NAT66包的时候会有问题,需要把去掉from 2402:f000:x:xxxx::/64
这一部分的以后的默认路由添加到路由表中,我一般是新建一个/etc/hotplug.d/iface/99-ipv6
,它的内容是
#!/bin/sh
[ "$ACTION" = ifup ] || exit 0
iface=wan6
[ -z "$iface" -o "$INTERFACE" = "$iface" ] || exit 0
ip -6 route add `ip -6 route show default|sed -e 's/from [^ ]* //'`
logger -t IPv6 "Add IPv6 default route."
这里iface
是LuCI里面Network->Interfaces
里面看到的名字,一般叫wan6。这个脚本的意思是在wan6起来以后读取默认网关,把带from的内容去掉,再加到系统路由表里。记得
chmod +x /etc/hotplug.d/iface/99-ipv6
以上
@heyeshuang 我说的NAT66是相对于NAT44,NAT64和NAT46来说的,和那个我完全没有听说过的NAT66没有任何关系
@Blaok 哦(手动滑稽)
@Blaok openwrt 安装软件包的命令是什么?
opkg install
内容已发布在 http://ipv6.tsinghua.edu.cn/openwrt/ 请大家指正。 由于还不够完整,所以首页没加连接。
@Blaok
3: ip -6 route看一下自己的默认网关。我获得的是
这里是指在 openwrt 上看对吧?
@bigeagle 对,文中已经说明了
经测试@heyeshuang 的方法可以使用,而且可以在luci下操作,但是最新的trunk依然没有搞定odhcpd的锅,必须在启动后手动重启下odhcpd。
@Blaok 的教程里漏了一点,第一步里,要记得在 Interfaces - LAN
下方的 DHCP Server
的 IPv6 Settings
部分选上 Always announce default router
。
@bigeagle @terro PR已发
对 @Blaok @bigeagle 的脚本修正:
ip -6 route add `ip -6 route show default|sed -e 's/from [^ ]* //'`
应该替换为: route -A inet6 add default gw $(ifconfig | grep $(uci -q get network.wan6.ifname) -A5 | grep "inet6 addr" | grep "Global" | awk '{print $3}' | awk -F: '{printf $1":"$2":"$3":"$4"::1"}')
建议:
ip route
代替(过时的)route 命令On Tue, Oct 11, 2016 at 6:54 AM, wang20150419 notifications@github.com wrote:
对 @Blaok https://github.com/Blaok @bigeagle https://github.com/bigeagle 的脚本修正:
ip -6 route add `ip -6 route show default|sed -e 's/from [^ ]* //'`
应该替换为: route -A inet6 add default gw $(ifconfig | grep $(uci -q get network.wan6.ifname) -A5 | grep "inet6 addr" | grep "Global" | awk '{print $3}' | awk -F: '{printf $1":"$2":"$3":"$4"::1"}')
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tuna/ipv6.tsinghua.edu.cn/issues/7#issuecomment-252896668, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5AL-LQnjhl_oDQl3zFLtXh5Q7dyYOkks5qy3kGgaJpZM4HxCMU .
Regards, Alick
请问各位巨巨,学校支持DHCPv6-PD吗?如果支持按道理CC15.05.1默认配置就能在学校宿舍用ipv6,而实际上ifstatus br-lan是显示分配不到前缀的。log也会报错
odhcpd: A default route is present but there is no public prefix on br-lan thus we don't announce a default route!
但是在实验室的电脑上貌似又可以?…
Ubuntu:~$ rdisc6 eth0
Soliciting ff02::2 (ff02::2) on eth0...
Hop limit : 64 ( 0x40)
Stateful address conf. : No
Stateful other conf. : No
Router preference : medium
Router lifetime : 1800 (0x00000708) seconds
Reachable time : unspecified (0x00000000)
Retransmit time : unspecified (0x00000000)
Source link-layer address: 3C:8A:B0:86:EB:45
Prefix : 2402:f000:1:5a01::/64
Valid time : 2592000 (0x00278d00) seconds
Pref. time : 604800 (0x00093a80) seconds
from fe80::3e8a:b0ff:fe86:eb45
之前一直在用relay的配置方法,无奈不是太稳定,看到nat6很心动,但是我路由器已经装不下任何软件了。如果确认紫荆不支持DHCPv6-PD。那么自己配置前缀代理是不是得从'ip6prefix' (wan口) ->'ip6assign' (lan口)->路由这样的顺序来折腾?
学校的网络没有 dhcpv6
在 2016年12月18日,16:13,IMconnor notifications@github.com 写道:
请问各位巨巨,学校支持DHCPv6-PD吗?如果支持按道理CC15.05.1默认配置就能在学校宿舍用ipv6,而实际上ifstatus br-lan是显示分配不到前缀的。log也会报错 odhcpd: A default route is present but there is no public prefix on br-lan thus we don't announce a default route! 但是在实验室的电脑上貌似又可以?…
Ubuntu:~$ rdisc6 eth0 Soliciting ff02::2 (ff02::2) on eth0...
Hop limit : 64 ( 0x40) Stateful address conf. : No Stateful other conf. : No Router preference : medium Router lifetime : 1800 (0x00000708) seconds Reachable time : unspecified (0x00000000) Retransmit time : unspecified (0x00000000) Source link-layer address: 3C:8A:B0:86:EB:45 Prefix : 2402:f000:1:5a01::/64 Valid time : 2592000 (0x00278d00) seconds Pref. time : 604800 (0x00093a80) seconds from fe80::3e8a:b0ff:fe86:eb45 之前一直在用relay的配置方法,无奈不是太稳定,看到nat6很心动,但是我路由器已经装不下任何软件了。如果确认紫荆不支持DHCPv6-PD。那么自己配置前缀代理是不是得从'ip6prefix' (wan口) ->'ip6assign' (lan口)->路由这样的顺序来折腾?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tuna/ipv6.tsinghua.edu.cn/issues/7#issuecomment-267809049, or mute the thread https://github.com/notifications/unsubscribe-auth/AGgns2h8VJ2w5G777bbFk3FXgUKg4z2Fks5rJOs_gaJpZM4HxCMU.
@runapp 不是我配置的问题吧。 如@shankerwangmiao 如说,学校确实不支持DHCPv6-PD,所以CC的默认配置下,br-lan当然没有前缀。既然这样要么NDP proxy,要么nat6,要么bridge。我现在还是用的第一种,最近倒是没出啥问题。
LEDE 17.01.1 更新后用上面的配置就连不上了
@2q1w2007 我的 LEDE 17.01.0 能用啊,NAT66
@2q1w2007 可以关注一下LEDE 17.01.1 changelog #396,这一版本修复了odhcpd在没有dhcpv6-pd情况下用relay模式时不稳定的问题。亲测有效,非常稳定(紫荆和主楼,老楼网络环境据说比较诡异没机会尝试)。毕竟还是比nat66方便很多的,性能也好一些。 https://lede-project.org/releases/17.01/changelog-17.01.1
@IMconnor 更新了之后里面的机器能取到地址但是ping不通外面,但是路由本身是能ping通外面的
@Blaok
ip6tables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
ip6tables -A FORWARD -i $LAN -j ACCEPT
窃以为这两步没有必要。实际上配置
ip6tables -t nat -A POSTROUTING -o $WAN6 -j MASQUERADE
就可以访问了。 (版本:OpenWrt 18.06.0-rc1)
这取决于 ip6tables 的默认规则,如果默认是 ACCEPT 就没必要,否则就需要这两条规则。
mrhso notifications@github.com 于2018年6月29日周五 上午8:45写道:
@Blaok https://github.com/Blaok
ip6tables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT ip6tables -A FORWARD -i $LAN -j ACCEPT
窃以为这两步没有必要。实际上配置
ip6tables -t nat -A POSTROUTING -o $WAN6 -j MASQUERADE
就可以访问了。
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tuna/ipv6.tsinghua.edu.cn/issues/7#issuecomment-401214704, or mute the thread https://github.com/notifications/unsubscribe-auth/ADTrgCUbKXRQR1y3rcVD5sgUbceq-VuIks5uBXi9gaJpZM4HxCMU .
OpenWrt2015年及之后的版本内核已经带了IPv6的支持,不需要(也没有)安装kmod-ipv6了。
@ideal 发个PR?
@ideal 发个PR?
好的。
路由器获取了 2402:f000
开头的地址,按照 NAT 的配置,电脑获取了 IPv6 ULA-Prefix
设定的地址。但还是无法访问 IPv6。在电脑上可以 ping 通路由器的 2402:f000
地址。
ip -6 route
似乎没啥变化?LEDE "Reboot" 17.01.5 TP-LINK TL-WR720N v4
/128 的 IPv6 地址的确无法作 relay,如果你是需要 ipv6 的认证,那么学校是通过 dhcpv6 给你分配的 /128 的地址,你需要用 ipv6 的NAT。
能给华硕那个pdcn提供一个套路么,isatap
参考https://www.jianshu.com/p/eb07eaac6167里的OpenWrt 18.06.1 可用的简单配置方法,根据我的网络进行了一些修改
- 首先,ssh登入,安装kmod-ipt-nat6
opkg update opkg install kmod-ipt-nat6
- 关闭sourcefilter,其中
wan6
是openwrt里ipv6所在接口(传输协议选择DHCPv6客户端)uci set network.wan6.sourcefilter=0 uci commit network ifup wan6
- 设置IPv6 ULA前缀,这里的地址前缀会分配给内网主机,可设置为
dc00:101:101::/48
,这样大多数浏览器会优先使用IPv6,如果设置为fc00:101:101::/48
,则大多数浏览器会优先使用IPv4- 设置LAN的DHCPv6服务器,勾选"总是通告默认路由",路由通告服务:服务器模式,DHCPv6服务:服务器模式,NDP代理:已禁用,DHCPv6模式:无状态+有状态
- 如果你的网络没有分配IPv6 DNS,那就给wan6手动指定一个(可能不需要,但是我设置了
2001:da8::666
)- 最后在"网络-防火墙-自定义规则"中加入NAT规则,
eth1
要改成你自己的wan网卡名ip6tables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
- 保存配置,重启路由
22.03里面NAT规则变成一堆选项卡了,也找不到填代码的位置……
@guoh064
22.03里面NAT规则变成一堆选项卡了,也找不到填代码的位置……
firewall / zone / wan 裏面的 masq6 便替代了 ip6tables -t nat。
uci set firewall.@zone[1].masq6="1"
uci commit firewall
不過,網關仍需用脚本添加。
感谢,现在openwrt下游设备可以获取ipv6地址了
如题