Skip to contentSkip to conversation

Iptables Rules

DISCUSSION Minh Cao 2 participants 2 messages Apr 8, 2008 – Apr 9, 2008

lore
Share & tools
lore

Minh Cao

author
#0 lore raw

Hi,
Is that matter if I placed the options/extensions ( -m and -p ) in different orders ?

Please tell me these 4 configurations make any difference ... in term allows ssh to my workstation.

-A INPUT -s 1.2.3.0/24 -p tcp -m tcp --dport 22 -j ACCEPT

-A INPUT -s 1.2.3.0/24 -m tcp -p tcp --dport 22 -j ACCEPT

-A INPUT -s 1.2.3.0/24 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

-A INPUT -s 1.2.3.0/24 -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

Thanks !

#1 lore raw
Quoted 3 lines · Minh Cao

Hi,
Is that matter if I placed the options/extensions ( -m and -p ) in different orders ?

No, but it matters between multiple -m.

Quoted 4 lines

-A INPUT -s 1.2.3.0/24 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -s 1.2.3.0/24 -m tcp -p tcp --dport 22 -j ACCEPT

no

Quoted 6 lines

-A INPUT -s 1.2.3.0/24 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

-A INPUT -s 1.2.3.0/24 -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

no.

(But "-m conntrack --ctstate NEW -m tcp" and

     "-m tcp -m conntrack --ctstate NEW" would)