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.

Is there a syntax to filter based on multiple interface criterion? E.g.

iptables -A INPUT ! -i eth0 (and ! -i lo) -m limit --limit 5/s -j LOG --log-level 4

Basically, I would like to include log entries for all interfaces except eth0 and lo. More broadly, is there a way to create compound criterion with and/or like operations.

share|improve this question
add comment

1 Answer

#just a small example
iptables -F
iptables -A INPUT -i eth0 -j ACCEPT (or REJECT)
iptables -A INPUT -i lo -j ACCEPT (or REJECT)
iptables -A INPUT -m limit --limit 5/s -j LOG --log-level 4

When lo and eth0 packets are matched by ACCEPT or REJECT (depends on your setup), all other packets are limited, which applies for other interfaces.

share|improve this answer
    
+1 Iptables works on a first match wins so deal with everything you want to white list early on. –  Iain Jun 21 '12 at 20:26
    
Thanks. However, I do not want to alter packet behavior but just log the relevant ones :-). In this case, I just want to log all packets that are not from eth0 and l0. –  user771359 Jun 21 '12 at 21:15
add comment

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.