iptables: unknown option "–dport"

Shum asked:

When I try to run iptables -A control_in -p tcp --dport 22 -j ACCEPT I get the error message iptables v1.4.20: unknown option "--dport". Everything I’ve found on the internet and serverfault relating to this message was due to people not specifying a protocol. However I am doing that (-p tcp). I’ve also tried running it with multiple --verbose options but I don’t get any more info.


I answered:

It’s failing because you haven’t specified a --match.

iptables -A control_in -m tcp -p tcp --dport 22 -j ACCEPT

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.