iptables和多个端口


26

这对我不起作用:

# iptables -A INPUT -p tcp --dports 110,143,993,995 -j ACCEPT

iptables v1.4.7: unknown option `--dports'
Try `iptables -h' or 'iptables --help' for more information.

但是,在手册页中有一个选项--dports...有什么想法吗?


6
快速猜测是您需要使用多端口模块:-m multiport --dports 110,143,993,995 ...
cyberx86

Answers:


47

您必须使用--match multiport规则定义更多端口

#iptables -A INPUT -p tcp  --match multiport --dports 110,143,993,995 -j ACCEPT

11

您需要在使用dports选项之前指定-m多端口模块

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.