Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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