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.

If I have two NICs; eth0 and eth1.

Does this rule then allow all outgoing traffic on all NICs?

iptables -P OUTPUT ACCEPT

Or do I have to

iptables -A OUTPUT -o eth0 -j ACCEPT
iptables -A OUTPUT -o eth1 -j ACCEPT

?

share|improve this question
1  
iptable rules work as a list and are evaluated in order on a per packet basis, not per interface. the -P rule is the default rule if no others match so affects any packets that get to the end of the list unmatched. –  Sirex Oct 28 '11 at 9:15

1 Answer 1

up vote 1 down vote accepted

The -P flag to iptables sets policies on the built-in chains. That is, they set the default disposition for packets which make it all the way through a built-in chain without matching a single dispositive rule.

If you only have two NICs (eth0, eth1), and no other rules in your OUTPUT chain, there is no difference between the two setups you posted above.

share|improve this answer
    
Would that also make iptables -A INPUT -o lo -j ACCEPT obsolete? –  Sandra Oct 28 '11 at 12:00
1  
Setting the policy to ACCEPT means that any packet that matches no dispositive rule will be ACCEPTed, so yes, it does make that rule obsolete. –  MadHatter Oct 28 '11 at 12:03

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.