IPv6 NAT6 和端口转发?

发布于 2025-01-11 11:48:51 字数 703 浏览 5 评论 0原文

我的本地网络 IPv6 NAT 就像:

------------------------       ---------------------------------------  
| Web Server:           |     | Router OpenWrt:                      |
| dda1:aaaa:bbbb::221/64| <=> | IPv6 ULA prefix: dda1:aaaa:bbbb::/48 |
|                       |     | br-lan: dda1:aaaa:bbbb::1/60         |
------------------------      | wan6: 2400:xxxx:yyyy::15/64          |
                               ---------------------------------------

如果我有一个 Web 服务器 http://[dda1:aaaa:bbbb::221]:8080,我如何配置 ip6table (或其他东西)放在路由器上,以便其他人可以通过 http://[2400:xxxx:yyyy::15]:48080 访问它?

有什么方法可以在 LuCI WebUI 中配置它吗?

多谢。

My local network IPv6 NAT is like:

------------------------       ---------------------------------------  
| Web Server:           |     | Router OpenWrt:                      |
| dda1:aaaa:bbbb::221/64| <=> | IPv6 ULA prefix: dda1:aaaa:bbbb::/48 |
|                       |     | br-lan: dda1:aaaa:bbbb::1/60         |
------------------------      | wan6: 2400:xxxx:yyyy::15/64          |
                               ---------------------------------------

If I have a web server http://[dda1:aaaa:bbbb::221]:8080, how do I configure the ip6table
(or something else) on the router so that other people can access it by http://[2400:xxxx:yyyy::15]:48080?

And is there any way to configure it in the LuCI WebUI?

Thanks a lot.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只涨不跌 2025-01-18 11:48:51

我相信您想要实现的目标已经在本页的 OpenWrt 文档中提到: NAT6 和 IPv6 伪装

注意:我不确定此 Wiki 页面是否已针对新版本的 OpenWrt 进行了更新。我自己没有尝试过,不确定它是否按预期工作。

我将简要概述上一页中的步骤,这里也一样:

  1. 为 IPv6 配置 WAN 接口(请参阅 这个
  2. 安装kmod-ipt-nat6
  3. 使用 include 包含 firewall.d 脚本(简化在 OpenWrt 中实现 NAT6) 防火墙配置中的部分。
  4. 对于防火墙配置中的 WAN 区域,添加新的 masq6 选项并将其设置为 1
  5. (可选)删除/禁用内置 Allow-ICMPv6-Forward 防火墙规则,因为它不再有任何意义。

现在,成功实施 NAT6 后,继续设置端口转发,这与 IPv4 NAT 的设置方式非常相似:

  1. 使用静态 DHCP 租用预留为您的 Web 服务器设备设置固定 ULA (使用 CLI 或执行此操作 在 LuCI
  2. 添加一条端口转发规则,指定上述固定 ULA 地址在 <端口重定向规则的 code>dest_ip 选项。我相信您必须使用 CLI 为此,因为LuCI(至少在撰写本文时的 21.02 中)不会让您在那里指定 IPv6 地址。
    如果这不起作用,您可以创建一个简单的脚本< /a>,使用 iptables 命令创建 DNAT 规则,并将其包含在防火墙的配置中。

I believe what you are trying to achieve is already mentioned in the OpenWrt docs on this page: NAT6 and IPv6 masquerading.

Note: I am not sure if this Wiki page has been updated for the newer releases of OpenWrt. I haven't tried it myself, and not sure if it works as expected.

I will briefly outline the steps from the above page, here as well:

  1. Configure your WAN interface for IPv6 (refer to this)
  2. Install the kmod-ipt-nat6 package.
  3. Include the firewall.d script (that simplifies implementing NAT6 in OpenWrt) using an include section in your firewall's configuration.
  4. For your WAN zone(s) in the firewall configuration, add a new masq6 option and set it to 1.
  5. Optionally delete/disable the built-in Allow-ICMPv6-Forward firewall rule as it no longer makes any sense.

Now, once NAT6 is successfully implemented, go on to setup port forwarding very similar to how it's done for IPv4 NAT:

  1. Set a fixed ULA for your web server device using a static DHCP lease reservation (use the CLI or do it in LuCI)
  2. Add a port forwarding rule specifying the above mentioned fixed ULA address in the dest_ip option for the port redirect rule. I believe you'll have to use the CLI for this, since LuCI (at least in 21.02 at the time of writing) will not let you specify an IPv6 address there.
    If that doesn't work, you can create a simple script, that creates the DNAT rule using the iptables command, and include it in your firewall's configuration.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文