Would it be OK/reliable, to use just one rule?:

iptables -t nat -I POSTROUTING ! -o eth2 -s -j SNAT --to PUBLIC_IP_ADDRESS

The BGP linux router has 25 ethernet interfaces. This iptables rule with "! -o XY" should allow the traffic to be SNATed and leave the router through all interfaces other than eth2. Behind eth2 interface, there is a local network - those machines in local network should communicate to outer world through eth0, eth1, eth3, eth4.

So I guess it is more common variant to use "! -o eth2" because it is not necessary to write 4 SNAT rules, one for each iface eth0, eth1, eth3, eth4.

I'm just not sure if it is good idea to set it up this way... In the LAB where I have testing version of the network, including 2 BGP upstream peers, it seems to work well...

If your answer is no/yes, please, tell me why, as well.

thank you a lot. Pep.

1 Answer 1


I`ll answer myself... Yes, it works perfectly...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .