I have these drop rules:

iptables -t mangle -P FORWARD DROP
iptables           -P FORWARD DROP

iptables -t mangle -P INPUT DROP
iptables           -P INPUT DROP

iptables -t mangle -P OUTPUT DROP
iptables -t nat    -P OUTPUT DROP
iptables           -P OUTPUT DROP

iptables -t nat    -P PREROUTING DROP
iptables -t mangle -P PREROUTING DROP

iptables -t nat    -P POSTROUTING DROP
iptables -t mangle -P POSTROUTING DROP

I have to put all the chains on all the tables with drop rule as default rule (I think they are all; if there are some missing or are not good please say). And then I must write a rule that accepts any kind of packet. Don't ask me why, that's the task.

What would this rule that accepts any kind of packet look like? I must use iptables.

link|improve this question
feedback

2 Answers

up vote 3 down vote accepted

Just a small point on terminology (just ignore this if I'm nitpicking here): if you use

iptables -P [chain] ACCEPT/DROP

that is called setting the "policy" of the chain. Doesn't change the effect of what has been stated above (since the policy of a chain is in fact the "default rule" all packets coming through the chain evaluate to if they haven't been picked up by another rule), but in a complex environment it's always a good thing not to have problems with communications due to vague terminology.

link|improve this answer
feedback

For each of the tables and chains you listed in your question,

iptables -t [table] -A [chain] -j ACCEPT

With no other parameters, this will match all packets and allow them through.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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