I'm using IPtables and I have a doubt thatfor which I can't find an answer. I want to apply a rule in the PREROUTING part of the nat table. The rule is supposed to execute a chain but I want it to be executed for every interfacesinterface except for two of them. I can't use wildcards because I need all of the other interfaces regardless of their name (say I can't have it).
I have applied this rule:
iptables -t nat -A PREROUTING -j my_chain ! -i eth0
That results into this:
Chain PREROUTING (policy ACCEPT 19 packets, 3008 bytes)
pkts bytes target     prot opt in     out     source       destination
10   1538  my_chain   all  -- !eth0   *       0.0.0.0/0    0.0.0.0/0
But I need something like this:
Chain PREROUTING (policy ACCEPT 19 packets, 3008 bytes)
pkts bytes target     prot opt in               out     source      destination
10   1538  my_chain   all  -- !(eth0 or tun0)   *       0.0.0.0/0   0.0.0.0/0
The thing is it can notcannot be in two different rules because one of thisthese two interfaces will enter into the other's interfaceother interface's rule. I also tried something like:
iptables -t nat -A PREROUTING -j my_chain ! -i eth0 ! -i tun0
 But it returns: multiple -i flags not allowed
 BassicallyBasically, I need a way to implement that or in the interface condition or !eth0 and !tun0 (logical equivalent).
I'm using debian with iptables v1.4.21.
Thanks for your help!