|
本帖最后由 嘉哥 于 2017-4-26 22:35 编辑
设备:TL-WR703N
固件:OpenWrt Chaos Calmer 15.05.1 附openwrt官网:https://openwrt.org
之前折腾过好久ipv6,试过好多方法,无线设备都不能获取ipv6地址,只能通过无线AP模式才行,不过手机连接的话就比较麻烦了。
本教程是通过openwrt的NAT6转发,使后端设备获得ipv6网络。
教程来自openwrt官方nat6配置教程和网友交流得来的智慧,不敢原创。
需要会使用putty。
原谅我艰难的英语水平,不能给正常翻译了。
下面内容全部进行过测试,全新安装后仍成功,按顺序执行就应该没问题,不必配置出wan6接口。
潘多拉,openwrt,lede原版按照此方法都可以
===============================================================================================================
1.Install the package kmod-ipt-nat6 #安装kmod-ipt-nat6
- opkg update && opkg install kmod-ipt-nat6
复制代码
2.Change the first letter of the "IPv6 ULA Prefix" from f to d
- uci set network.globals.ula_prefix="$(uci get network.globals.ula_prefix | sed 's/^./d/')"
- uci commit network
复制代码
3.Set the DHCP server to "Always announce default router" - uci set dhcp.lan.ra_default='1'
- uci commit dhcp
复制代码
4.Add an init script for NAT6 by creating a new file /etc/init.d/nat6 and paste the code from the section Init Script into it #生成nat6脚本,脚本内容在附件里,别忘了粘贴
- touch /etc/init.d/nat6
- vi /etc/init.d/nat6
复制代码
5.Make the script executable and enable it #修改权限,并生效
- chmod +x /etc/init.d/nat6
- /etc/init.d/nat6 enable
复制代码
6.In addition, you may now disable the default firewall rule "Allow-ICMPv6-Forward" since it's not needed when masquerading is enabled
- uci set firewall.@rule["$(uci show firewall | grep 'Allow-ICMPv6-Forward' | cut -d'[' -f2 | cut -d']' -f1)"].enabled='0'
- uci commit firewall
复制代码
7.修改/etc/sysctl.conf,把文件中相关内容改为以下内容,没有的话就添加,大概说接收广播并开启ipv6转发
- net.ipv6.conf.default.forwarding=2
- net.ipv6.conf.all.forwarding=2
- net.ipv6.conf.default.accept_ra=2
- net.ipv6.conf.all.accept_ra=2
复制代码
8.加入转发规则,编辑/etc/firewall.user,或路由器界面防火墙规则里加上
- ip6tables -t nat -I POSTROUTING -s $(uci get network.globals.ula_prefix) -j MASQUERADE
复制代码
9.重启路由器,配置正确的话就可以用了。
除了vi和opkg,其他命令正常是没有返回的。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
评分
-
查看全部评分
|