LAPTOP - connected to the internet via ethernet and *wavelan* - problems with the source address

Linux Advanced Routing and Traffic Control

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

 



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 <ipaddress here>

!! 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@xxxxxxxxxxxxxxx
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