Re: source based routing help needed
- From: Pascal Hambourg <boite-a-spam@xxxxxxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 20:31:41 +0100
Hello,
Ashish Shukla wrote :
I'm little confused here. if you don't make tunnel 'tun1' default
route, and make 'eth0' instead what happens. I assume following
happens, but I'm not sure, so correct me if I'm wrong:
tun1 - 192.168.1.1/24, eth0 - 10.0.2.1/24 (default route)
so if webserver listening on 192.168.1.1 receives a packet from
10.3.4.5 on tun1, when replies back, reply goes out via eth0 (the
gateway), since 10.3.4.5 belongs to none of the local networks. So
there is absolutely no relation between routing of packet from
10.3.4.5 and packet to 10.3.4.5, right ?
I guess that there is some NAT involved, so routing has to be symmetrical.
Jack> How can I get source based routing to work on just the eth0 / tun1 Jack> interfaces?
You need to setup some routing rules.
$tun1_gateway - tun1 gateway IPv4 address
$eth0_gateway - eth0 gateway IPv4 address
$tun1_ip - tun1 IPv4 address
$eth0_ip - eth0 IPv4 address
----8<----8<----
root@host # ip route add default via $tun1_gateway table 100
root@host # ip route add default via $eth0_gateway table 101
root@host # ip rule add from $tun1_ip table 100
root@host # ip rule add from $eth0_ip table 101
---->8---->8----
Above commands will create 2 source based rules, which basically
inteneds to route outgoing packet via the interface corresponding to
the packet's source address.
To do things properly you need to add routes overriding the source-based default routes in each table when the destination is in a directly attached network :
$eth0_subnet - IP subnet on eth0
$tun1_subnet - IP subnet or peer address on tun1
ip route add $eth0_subnet dev eth0 table 100
ip route add $tun1_subnet dev tun1 table 101
.
- References:
- source based routing help needed
- From: Jack Snodgrass
- Re: source based routing help needed
- From: Ashish Shukla आशीष शुक्ल
- source based routing help needed
- Prev by Date: Re: Stop ifconfig from adding an ipv6 address?
- Next by Date: Re: ipv6 routing and neighbour discovery
- Previous by thread: Re: source based routing help needed
- Next by thread: Re: source based routing help needed
- Index(es):
Relevant Pages
|