如何使用目标IP的[!]选项?
我正在尝试将出站WAN DNSstream量redirect到我的sinkhole,但我无法使-destination [!]选项正常工作。
例如:
iptables -A OUTPUT -d ! 134.134.134.134 -j ACCEPT
收益:
Bad argument `134.134.134.134'
我没有丝毫的线索,我的语法有什么问题。
你有! 在错误的地方。 它属于-d 之前 。
从iptables手册页:
[!] -d, --destination address[/mask][,...]
举个例子:
iptables -A OUTPUT ! -d 134.134.134.134 -j ACCEPT
尽量放在之前 – select
[root@pineapple ~]# iptables -A OUTPUT -d! 134.134.134.134 -j ACCEPT Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`). [root@pineapple ~]# iptables -A OUTPUT ! -d 134.134.134.134 -j ACCEPT [root@pineapple ~]# iptables -nvL | grep 134 78 92618 ACCEPT all -- * * 0.0.0.0/0 !134.134.134.134