iptables 和多个端口

Zen*_*net 39 iptables linux-networking

这对我不起作用:

# 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.
Run Code Online (Sandbox Code Playgroud)

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

Mug*_*hil 67

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

#iptables -A INPUT -p tcp  --match multiport --dports 110,143,993,995 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)


kaj*_*aji 14

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