找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 42493|回复: 104

【转载】 通过openwrt的NAT6转发,使后端设备获得ipv6网络

 火.. [复制链接]
发表于 2016-11-1 19:15 | 显示全部楼层 |阅读模式
本帖最后由 嘉哥 于 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
  1. opkg update && opkg install kmod-ipt-nat6
复制代码

2.Change the first letter of the "IPv6 ULA Prefix" from
f to d
  1. uci set network.globals.ula_prefix="$(uci get network.globals.ula_prefix | sed 's/^./d/')"
  2. uci commit network
复制代码

3.Set the DHCP server to "Always announce default router"
  1. uci set dhcp.lan.ra_default='1'
  2. 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脚本,脚本内容在附件里,别忘了粘贴
  1. touch /etc/init.d/nat6
  2. vi /etc/init.d/nat6
复制代码

5.Make the script executable and enable it    #修改权限,并生效
  1. chmod +x /etc/init.d/nat6
  2. /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
  1. uci set firewall.@rule["$(uci show firewall | grep 'Allow-ICMPv6-Forward' | cut -d'[' -f2 | cut -d']' -f1)"].enabled='0'
  2. uci commit firewall
复制代码

7.修改/etc/sysctl.conf,把文件中相关内容改为以下内容,没有的话就添加,大概说接收广播并开启ipv6转发
  1. net.ipv6.conf.default.forwarding=2
  2. net.ipv6.conf.all.forwarding=2
  3. net.ipv6.conf.default.accept_ra=2
  4. net.ipv6.conf.all.accept_ra=2
复制代码

8.加入转发规则,编辑/etc/firewall.user,或路由器界面防火墙规则里加上
  1. ip6tables -t nat -I POSTROUTING -s $(uci get network.globals.ula_prefix) -j MASQUERADE
复制代码


9.重启路由器,配置正确的话就可以用了。


除了vi和opkg,其他命令正常是没有返回的。










本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

点评

提醒一条,在特别新的OpenWRT里route命令有了改动,如果你失败了,检查route -A inet6 | grep -c '::/0'命令的返回值如果等于0的话说明就不行了,这时候需要手动添加2000::/3的路由表或者改一下脚本  发表于 2020-2-9 02:39

评分

参与人数 4恩山币 +4 收起 理由
geekman + 1 我来恩山就是为了撩你!
伤心的笔 + 1 支付宝已转500w给你!
企鹅啊啊啊 + 1 我来恩山就是为了看你!
dsanke + 1 我来恩山就是为了看你!

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
发表于 2016-11-2 10:16 | 显示全部楼层
教育网可以吗?

点评

不清楚,我们学校ip是电信的,不知道属不属于教育网  详情 回复 发表于 2016-11-2 10:48
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2016-11-2 10:48 | 显示全部楼层

不清楚,我们学校ip是电信的,不知道属不属于教育网
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-11-2 15:46 | 显示全部楼层
很有用,mark一下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-11-20 12:14 | 显示全部楼层
谢谢分享~~~~
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-11-30 19:50 | 显示全部楼层
路过学习了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-12-25 12:29 | 显示全部楼层
很有用!!Mark了~
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-12-25 13:08 来自手机 | 显示全部楼层
我们学校妈蛋,竟然没有ipv6

点评

我的光猫居然没有IPV6,升级也升不了,郁闷,电信自己的光猫反而有IPV6的!!  详情 回复 发表于 2017-4-20 14:07
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-2-26 00:46 | 显示全部楼层
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-2-26 20:06 | 显示全部楼层
感谢分享!!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-3-1 19:37 | 显示全部楼层
教育网亲测成功
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-3-1 19:53 | 显示全部楼层
我得试试  谢谢楼主
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-3-29 21:37 | 显示全部楼层
斐讯可以吗

点评

可以,我用斐讯k2刷的潘多拉官方  详情 回复 发表于 2017-3-30 08:36
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2017-3-30 08:36 | 显示全部楼层

可以,我用斐讯k2刷的潘多拉官方

点评

你好,k2的潘多拉还需要别的配置吗? 我刷的也是k2的潘多拉,固件地址http://www.right.com.cn/forum/thread-197786-1-1.html 然后学校是拨号,按照本贴1楼的步骤操作了。  详情 回复 发表于 2017-5-28 21:05
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-3-30 09:42 | 显示全部楼层
没有ip6的撸过
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-3-29 04:25

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表