iptables - how to prevent forwarding between interfaces?
Hi,
I have a scenario where I have 3 IP interfaces - eth0, eth1 and eth2. My default route always points to either eth0 or eth1. I want IP traffic from eth2 never to use the default route. In other words, whenever i dont have a specific match on packets from eth2, i want them to be dropped instead of using the default route. Can someone suggest how i can use iptables to do this?
As an alternative I can even live with a policy that prevents any forwarding between eth0 and eth2 and between eth1 and eth2 completely.
would something like this work??
iptables -A FORWARD -i eth2 -o eth0 -d ! 192.168.1.0/24 -j DROP
iptables -A FORWARD -i eth2 -o eth1 -d ! 192.168.2.0/24 -j DROP
where 192.168.1.0/24 is eth0's subnet and 192.168.2.0/24 is eth1's subnet.
TIA
Last edited by driftwoodash; 10-09-2009 at 01:23 PM.
|