Audit my rules I'm ask if I really need of two INPUT policy:

iptables -P INPUT ACCEPT
iptables -F
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP

so, last INPUT policy: do I really need "close" INPUT policy with a DROP or can I omits that?

  • I'm not an expert of... maybe you firstly should be set to DROP INPUT policy, next append new rules allowing what you prefer (like loopback interface and ssh port) with the state of. – Pol Hallen Apr 8 '15 at 17:55

-P sets what happens by default, when no rule decides. That is, if a packet "falls" off the bottom of the table.

That first line changes the default to accept the traffic. I'm not sure why that's there. The last line changes the default to drop traffic, which is clearly what you want since you only have ACCEPT rules.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.