为什么以下简单的IPtable规则不起作用?
iptables -A INPUT -s 192.168.1.88 -m mac --mac-source 00-27-0E-33-4B-B2 -j DROP
其实我想要反转这个比赛。 像这样的东西:
iptables -A INPUT -s 192.168.1.88 -m mac ! --mac-source 00-27-0E-33-4B-B2 -j DROP
由于我在那里得到一个错误,我试图删除! 只是为了看看我是否在语法错误的位置! 我看到这个问题是不相关的! 因为删除它并没有帮助。
我得到的错误是:
iptables v1.4.21: ether Try `iptables -h' or 'iptables --help' for more information.
您需要以xx:xx:xx:xx:xx:xx格式提供MAC地址,而不是使用中间的破折号。 即:
iptables -A INPUT -s 192.168.1.88 -m mac ! --mac-source 00:27:0E:33:4B:B2 -j DROP
我通常也使用小写,但我认为这并不重要。
请注意,mac地址应该使用:而不是- :
00:27:0E:33:4B:B2