iptables的似乎并不承认--dport
有-p all
。
iptables -A INPUT -p all --dport www -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
产量:
iptables v1.4.4: unknown option `--dport'
Try `iptables -h' or 'iptables --help' for more information.
--destination-port doesn't work either: iptables v1.4.4: unknown option `--destination-port'
Run Code Online (Sandbox Code Playgroud)
为-p tcp
和添加两个单独的规则-p udp
工作正常,那么为什么它不适用于-p all
?
以防万一,这是在带有 iptables 包版本 1.4.4-2ubuntu2 的 Ubuntu 10.04 LTS 服务器上
Phi*_*lds 20
--dport 不是一般 iptables 规则的标志。它是其中一个扩展包匹配模块的标志。这些在您使用-p protocol
或时加载-m
。除非您指定-m <protocol>
或-p <protocol>
使用特定的协议,否则您不能使用--dport
您将在iptables(8)或iptables-extensions(8)手册页中看到这一点:
tcp
These extensions can be used if `--protocol tcp' is specified. It provides the
following options:
...
[!] --destination-port,--dport port[:port]
Destination port or port range specification. The flag --dport is a
convenient alias for this option.
...
Run Code Online (Sandbox Code Playgroud)
并非所有协议都有 --dport 标志,因为并非所有协议都支持端口的概念
归档时间: |
|
查看次数: |
29014 次 |
最近记录: |