跳转到内容
本站为社区维护的非官方中文翻译,与 Cloudflare, Inc. 无关联。本站不提供账户登录,请勿在任何非官方站点输入您的 Cloudflare 账户信息。官方文档:developers.cloudflare.com

Unified Routing 行为变更

最后更新 查看 MarkdownAgent 设置

Cloudflare Network Firewall 规则的行为可能因账户使用 Legacy Routing 还是 Unified Routing 而有所不同。升级到 Unified Routing 前,请先查阅以下变更。

ip.geoip.country

Unified Routing 不再支持 ip.geoip.country 字段。升级前,您必须删除这些规则,或将任何使用 ip.geoip.country 的规则改写为 ip.src.country 和 ip.dst.country 字段。

匹配类型 使用 ip.geoip.country 的规则 等效规则
等于 ip.geoip.country eq "US" ip.src.country eq "US" or ip.dst.country eq "US"
不等于 ip.geoip.country ne "US" ip.src.country ne "US" and ip.dst.country ne "US"
在列表中 ip.geoip.country in {"UK" "FR"} ip.src.country in {"UK" "FR"} or ip.dst.country in {"UK" "FR"}
不在列表中 not ip.geoip.country in {"UK" "FR"} not ip.src.country in {"UK" "FR"} and not ip.dst.country in {"UK" "FR"}

第 3 层流量的规则评估

Legacy Routing 对第 3 层协议的支持有限。IPv6 支持仅限于 ip.src 和 ip.dst 字段。规则会根据规则中所用字面量的地址族,专门应用于 IPv4 数据包或专门应用于 IPv6 数据包。

在 Unified Routing 上,作为更广泛支持 IPv6 的第一步,Legacy Routing 中仅匹配 IPv6 流量的规则也可能针对 IPv4 流量进行评估。

规则 路由模式 对 IPv4 的行为 对 IPv6 的行为
ip.src ne fe80::/64 Legacy IPv4 数据包跳过此规则 匹配所有非来自 fe80::/64 的流量
ip.src ne fe80::/64 Unified 匹配所有流量 匹配所有非来自 fe80::/64 的流量

若要将规则限制为仅匹配 IPv6 流量,请将表达式更新为 ip.src in {::/0} and ip.src ne fe80::/64。

IPv6 行为与 Legacy Routing 相同,没有变化。

第 4 层流量的规则评估

在 Legacy Routing 上,第 4 层协议由表达式推断,并且规则仅应用于该协议的数据包。tcp.srcport eq 80 和 tcp.srcport ne 80 都只应用于 TCP 流量。其他协议的数据包(例如 UDP)不会匹配该表达式。

在 Unified Routing 上,Cloudflare Network Firewall 不会推断协议,规则必须在表达式中显式指定协议。tcp.srcport eq 80 仍然只应用于 TCP 流量,但 tcp.srcport ne 80 现在会同时匹配 TCP 和 UDP 流量。若要将规则限制为仅匹配 TCP 流量,请将表达式更新为 ip.proto eq "tcp" and tcp.srcport eq 80。

这篇文档对您有帮助吗?