├── README.md └── Use ip6tables ├── README.md ├── execute.cmd ├── execute.sh └── operation.sh /README.md: -------------------------------------------------------------------------------- 1 | # OpenWrt-IPv6-Scripts 2 | 3 | 根据网络教程,为OpenWrt设计的IPv6脚本 4 | 5 | ## 概述 6 | 7 | 一般情况下,IPv6 并不支持 NAT,所以默认地,路由器并不能像 IPv4 那样,给客户端共享 IPv6 互联网连接。因此我们有一些替代方案,其中经我实测可用的,是 kmod 配合 ip6tables 的方案。 8 | 9 | 点击“Use ip6tables”文件夹,以查看教程、阅读源码。 10 | 11 | ## Abstract 12 | 13 | This is a set of IPv6 configuration scripts for OpenWrt referred to existing guides. 14 | 15 | By default, IPv6 doesn't support NAT, so you cannot share IPv6 connections with your router. So there's some substitudes available. What works well is that using kmod with ip6tables. 16 | 17 | Please click "Use ip6table" to view the guide and read source code. 18 | -------------------------------------------------------------------------------- /Use ip6tables/README.md: -------------------------------------------------------------------------------- 1 | # ipv6tables 共享 IPv6 教程 2 | 3 | **How To Share IPv6 with `ipv6tables`** 4 | 5 | **[=== Click Here to Read in English ===](#english)** 6 | 7 | ## 原理 8 | 9 | 通过给路由器安装上 `kmod-ipt-nat6` 模块,配合 `ip6tables` 的使用,为路由器开启 IPv6 网络的 NAT 功能。 10 | 11 | 期间,为保证功能的开启,需要给路由器设置一系列的参数。具体设置参数可在脚本 `operation.sh` 中阅读。 12 | 13 | ## 需求 14 | 15 | * SCP工具(scp)。 16 | * SSH工具(scp)。 17 | 18 | 以上工具在Linux发行版中均有自带。 19 | 20 | 如果您使用Windows,建议您安装 Git Bash (Git-scp)或者是 Cygwin,它们都自带了该工具。 21 | 22 | 本工具中的批处理脚本 execute.cmd 要求您事先把Git Bash 和 Cygwin 的 /bin 目录加入PATH环境变量中,它们通常在这些工具的安装目录下。当然,您也可以直接在这两款工具的命令解释器中运行 execute.sh。 23 | 24 | 当然,您也可以使用 WinSCP 配合 PuTTY 来完成上述两款工具的工作。 25 | 26 | ## 自动操作方法 27 | 28 | 1. 在Windows中,确保scp和ssh这两款工具在您的PATH中,随后运行execute.cmd。如果是Linux或Git Bash、Cygwin,请运行execute.sh。在当前目录下运行脚本的方法是 ```./<脚本文件名>```。 29 | 2. 这时您可能需要输入两次路由器密码,按提示操作即可。 30 | 3. 脚本执行完毕后,重启路由器。 31 | 32 | > **注意:**如果你的路由器默认网关地址不是`192.168.1.1`,请对`execute.cmd`或`execute.sh`做出修改。 33 | 34 | ## 手动操作方法 35 | 36 | ### Windows 下 37 | 38 | 1. 使用 WinSCP,将 operation.sh 上传到路由器的 /tmp 目录中。 39 | 2. 使用 PuTTY 登录路由器,cd到tmp目录,随后运行: 40 | 41 | ```shell 42 | chmod +x operation.sh 43 | ./operation.sh 44 | ``` 45 | 46 | 3. 操作完成后,重启路由器。 47 | 48 | ## 注意 49 | 50 | 内核模块需要从OpenWrt的软件仓库中获取,因此安装模块时需要路由器已经连接网络。 51 | 52 | ## 参考资料 53 | 54 | * [TS - 在OpenWrt上配置原生IPv6 NAT](https://tang.su/2017/03/openwrt-ipv6-nat/) 55 | * [【转发】 通过openwrt的NAT6转发,使后端设备获得ipv6网络](https://blog.csdn.net/guituo9698/article/details/70285755) 56 | * zqp19950813 整理的教程 57 | 58 | ## 致谢 59 | 60 | * 教程整理:zqp19950813 61 | 62 | --- 63 | 64 | 65 | 66 | 67 | ## Principle 68 | 69 | This script will make your router support IPv6's NAT by installing `kmod-ipt-nat6` kernel module and configurating `ip6tables`. 70 | 71 | During this, to ensure these features take effect, you need to set a series of parameters. Read `operation.sh` to learn what have done. 72 | 73 | ## Requirements 74 | 75 | * SCP utility (`scp`) 76 | * SSH client (`ssh`)。 77 | 78 | They are all contained in any Linux distributions, as they are core components. 79 | 80 | If you're using Windows, it's highly recommended that you install Git Bash (Git-SCP) or Cygwin, as the two kits also contained them. 81 | 82 | The batch file `execute.cmd` requires you to add Git Bash or Cygwin's `/bin` directory to `%PATH%` - usually their `/bin` directories are in where you installed them. Of cource, you can directory run `execute.sh` with their shells (usually bash). 83 | 84 | By the way, you can also try WinSCP with PuTTY. WinSCP serves as `scp`, and `PuTTY` serves as `ssh`. 85 | 86 | ## How to apply automatically 87 | 88 | 1. On Windows, ensure that the commands above are in your `%PATH%`, then run `execute.cmd`. If you're using Linux or Git Bash or Cygwin, run `execute.sh`. To run scripts in the current directory, please use ```./