首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >当IPv6前缀是动态的时,允许传入IPv6流量到主机和端口吗?

当IPv6前缀是动态的时,允许传入IPv6流量到主机和端口吗?
EN

Server Fault用户
提问于 2022-12-05 20:30:40
回答 1查看 555关注 0票数 2

使用IPv4,您过去可以在局域网上为主机提供一个静态本地IP地址,并在防火墙/路由器上使用防火墙规则将网络使用的(可能是动态的)面向Internet的IP上的端口转发到特定主机上的端口,使用主机的静态LAN IPv4地址作为在防火墙规则中标识主机的稳定方式。

但是有了IPv6,每个主机都在使用真正的可路由互联网is,因此主机的传入流量已经被发送给它了,所以不需要NAT。但是,您仍然需要能够编写防火墙规则,说明应该允许进入某个特定主机和端口的通信量,同时阻塞其他主机或端口的通信量。

但是,如果网络分配IPv6地址的前缀是动态的,那么如何引用防火墙规则中的特定主机来允许通信呢?您不能只允许流量到其IPv6地址,因为下周它将有一个具有不同前缀的IPv6地址,因为ISP将为网络分配一个不同的前缀。

然后,您如何实际配置防火墙以允许某个端口上的主机入站通信?在ip6tables中,似乎有一个按目的地匹配的--dest选项,但这似乎只允许您输入一个完整的地址,而不是例如可以确保主机保持静态的地址的后缀。从手册页:

代码语言:javascript
运行
复制
       [!] -s, --source address[/mask][,...]
              Source  specification.  Address can be either a network name, a
              hostname, a network IP address (with /mask), or a plain IP  ad‐
              dress. Hostnames will be resolved once only, before the rule is
              submitted to the kernel.  Please note that specifying any  name
              to  be resolved with a remote query such as DNS is a really bad
              idea.  The mask can be either an ipv4 network mask  (for  ipta‐
              bles)  or  a  plain number, specifying the number of 1's at the
              left side of the network mask.  Thus, an iptables mask of 24 is
              equivalent to 255.255.255.0.  A "!" argument before the address
              specification inverts the sense of the address. The flag  --src
              is  an alias for this option.  Multiple addresses can be speci‐
              fied, but this will expand to multiple rules (when adding  with
              -A), or will cause multiple rules to be deleted (with -D).

       [!] -d, --destination address[/mask][,...]
              Destination  specification.   See  the  description  of  the -s
              (source) flag for a detailed description of  the  syntax.   The
              flag --dst is an alias for this option.

有办法用ip6tables来处理这个问题吗?在ip6tables上是否还有其他层应该生成规则,这些规则随着网络重新编号而发生变化,每个人都在使用这些规则?是否有某种ip6tables插件可以让我匹配到特定主机的流量,即使网络号码改变了?其他OS防火墙是否以不同的方式处理此问题?

EN

回答 1

Server Fault用户

回答已采纳

发布于 2022-12-23 22:08:56

ip6tables接受地址的位掩码。与iptables和IPv4不同的是,这些位元不一定都位于地址的开头,所以这样的东西应该工作得很好:

ip6tables -A INPUT -d ::1234:56ff:fe78:90ab/::ffff:ffff:ffff:ffff -j ACCEPT

这将使ip6tables接受指向以::1234:56ff:fe78:90ab结尾的IPv6地址的所有数据包,而不管前缀如何。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1117332

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档