找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

 火.. [复制链接]
本帖最后由 嘉哥 于 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,其他命令正常是没有返回的。










本帖子中包含更多资源

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

×

评分

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

查看全部评分

教育网可以吗?
回复

使用道具 举报

 楼主| | 显示全部楼层

不清楚,我们学校ip是电信的,不知道属不属于教育网
回复

使用道具 举报

很有用,mark一下
回复

使用道具 举报

谢谢分享~~~~
回复

使用道具 举报

路过学习了
回复

使用道具 举报

很有用!!Mark了~
回复

使用道具 举报

来自手机 | 显示全部楼层
我们学校妈蛋,竟然没有ipv6
回复

使用道具 举报

回复

使用道具 举报

感谢分享!!!
回复

使用道具 举报

教育网亲测成功
回复

使用道具 举报

我得试试  谢谢楼主
回复

使用道具 举报

斐讯可以吗
回复

使用道具 举报

 楼主| | 显示全部楼层

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

使用道具 举报

没有ip6的撸过
回复

使用道具 举报

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

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

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

GMT+8, 2024-5-9 13:24

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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