From: Thomas Glanzmann Date: Wed, 08 Sep 2004 18:21:58 +0000 Subject: [LARTC] LAPTOP - connected to the internet via ethernet and *wavelan* - problems with the source add Message-Id: <20040908182158.GJ1893@cip.informatik.uni-erlangen.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lartc@vger.kernel.org Hello, I have a laptop with two network interfaces: eth0 (LAN) and eth1 (WAVELAN). Now I am looking for a way to route ssh and icpm packages via the wavelan interface and the rest over the LAN interface. My problem is now that every applications binds eth0 interface as default (which results in source addr 192.168.0.2). What I did is using SNAT to change source-address to 192.168.1.2 for packages leaving from eth1. when telling the application to bind the interface explicit it is working without the SNAT: ping -I eth1 !! I want to know if there is an other (maybe better) way to obtain the !! !! same. !! My current setup is: My Interfaces: eth0: 192.168.0.2/24 gw: 192.168.0.1 eth1: 192.168.1.2/24 gw: 192.168.1.1 My setup so far: iptables -t mangle -F iptables -t nat -F ip route add 192.168.1.0/24 dev eth1 src 192.168.1.2 table wavelan ip route add default via 192.168.1.1 table wavelan ip rule add fwmark 1 table wavelan iptables -t mangle -A OUTPUT -p icmp -j MARK --set-mark 1 iptables -t mangle -A OUTPUT -p tcp --destination-port 22 -j MARK --set-mark 1 # FIXME tg iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.2/32 -j MASQUERADE ip route add default scope local nexthop via 192.168.0.1 nexthop via 192.168.1.1 Honestly, Thomas _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/