1

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.

3

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.

| improve this answer | |
6

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.

| 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.