Re: routing to two interfaces

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i missed the nat rule though:

$IPTABLES -t nat -A POSTROUTING -s 192.168.0.0/24 -o $ETH1 -j SNAT \
	--to-source $ETH1_GATEWAY_IP
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.0/24 -o $ETH2 -j SNAT \
	--to-source $ETH2_GATEWAY_IP 

> try out following:
> it's just an idea and i didn't try it out
> 
> # delete tables 2 and 3 to avoid duplicates
> # add for each table the gateway to use
> $IP route del table 2
> $IP route add table 2 via $ETH1_GATEWAY_IP dev eth1
> $IP route del table 3
> $IP route add table 3 via $ETH2_GATEWAY_IP dev eth2 
> 
> # mark each packet regarding to its incomming device
> $IPTABLES -t mangle -A INPUT -i eth1 -j MARK --set-mark 2
> $IPTABLES -t mangle -A INPUT -i eth2 -j MARK --set-mark 3
> 
> # delete to avoid duplicates
> # lookup the right table regarding to packets fwmark setting
> # flush the routing cache
> $IP rule del fwmark 2 table 2
> $IP rule del fwmark 3 table 3
> $IP rule add fwmark 2 table 2
> $IP rule add fwmark 3 table 3
> $IP route flush cache
> 
> 
> --
> rob
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux