我想远程配置防火墙的nat规则,但是我不知道python-iptables应该如何远程操作,您能告诉我吗?请。 还是有其他方法可以满足我的需求? 这是实现防火墙端口映射的本地代码
import iptc
chain = iptc.Chain(iptc.Table('nat'),'PREROUTING')
rule = iptc.Rule()
rule.protocol = 'tcp'
rule.in_interface = 'eth0'
match = rule.create_match('tcp')
match.dport= '2211'
Target = rule.create_target('DNAT')
Target.to_destination = '10.0.1.1:4422'
chain.insert_rule(rule)