2

If I have two or more network interfaces, ranging from virtual and real, as it could to set iptables rules to affect all of these interfaces?

Example: I have four interfaces, eth0, eth0:0, eth1 and loopback, I want to set the following rule:

iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT

how would this rule to apply it interfaces eth0, eth0:0, eth1 and not apply it in loopback?

If the rule applies to eth0 applies in eth0:0 as well?

SoabTI
  • 133
  • 7

1 Answers1

0

Regarding the iptables syntax, replace the -i eth0 with \! -i loopback to apply the rule to incoming traffic on all interfaces except loopback.

I'm 99% sure that eth0 and eth0:0 are treated as different interfaces by iptables, so any rule you wish to create needs to be applied separately to each interface.

Jeremy Dover
  • 318
  • 1
  • 6