我们的路由器机器在其 WAN 接口上有多个公共 IP (/27)。现在,我想添加匹配特定dport
/ saddr
/daddr
组合的 dnat 规则。我的梦想是这样的:
map one2one_dnat {
# dst_addr . src_addr . proto . dst_port : dnat_to . dnat_to_port
type ipv4_addr . ipv4_addr . inet_proto . inet_service : ipv4_addr . inet_service
flags interval
counter
comment "1-1 dnat"
elements = {
42.42.42.5 . 0.0.0.0/0 . tcp . 8888 : 10.42.42.5 . 8888
}
}
# And then later in a chain
ip daddr . ip saddr . ip protocol . th dport dnat to @one2one_dnat
但是,这会导致:
root@XXX# nft -c -f assembled.nft
assembled.nft:252:59-60: Error: syntax error, unexpected to, expecting newline or semicolon
ip daddr . ip saddr . ip protocol . th dport dnat to @one2one_dnat
^^
以下语法示例确实有效(但不适用于预期的精美多合一地图):
dnat ip addr . port to ip saddr . tcp dport map { 42.42.42.5 . 8888 : 10.42.42.5 . 8888}
# And even with saddr restrictions
ip saddr 0.0.0.0/0 dnat ip addr . port to ip saddr . tcp dport map { 42.42.42.5 . 8888 : 10.42.42.5 . 8888}
非常感谢任何想法/建议