Re: source based routing help needed



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jack Snodgrass writes:
Jack> I've been doing linux for a long time, but never have gotten the hang of
Jack> source based routing. I need to set this up now so I am seeing if someone
Jack> can help me out... I've seen lots of examples using ppp0/ppp1 and ip
Jack> addresses... but I just can't get a handle on this for my setup.

Jack> I have
Jack> eth0 ( local network )
Jack> tun1 ( web server traffic that comes in via a tunnel )

Jack> any traffic that comes in via the tun1 interface needs to go
Jack> back out the tun1 interface.

Jack> any traffic that comes in on the eth0 interface needs to go back
Jack> out on the eth0 interface.

Jack> I have this sort of working using standard routing where the 'default'
Jack> route goes over my tunnel so any web traffic that comes in, goes back
Jack> out that way correctly and I have my private network stuff set up to
Jack> route via eth0. The issue I have with this is that if the web server
Jack> does something like a yum update... the default route uses the tunnel
Jack> and I want it to use the eth0 interface.

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 ?

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.

----8<----8<----
root@host # ip route add default via $eth0_gateway
---->8---->8----

And above command will choose eth0 as default route.

For more information, check out LARTC[1].

References:
[1] - http://www.lartc.org/

HTH
- --
Ashish Shukla आशीष शुक्ल http://wahjava.wordpress.com/
·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHxwJOHy+EEHYuXnQRAtU4AKDhJ4tKsodayD+vhe92sWD45H4IoACgoI/o
1263r5dvDsQkfu2pjjZTggw=
=tcde
-----END PGP SIGNATURE-----
.



Relevant Pages

  • Re: Help with iway 500c
    ... Jack Erbes wrote: ... >> intermediate points when the unit is creating a route. ... > because I can't live with their new interface in a moving vehicle. ... > mp3/music interface to make it a coherent and flexible navigation package. ...
    (sci.geo.satellite-nav)
  • Re: Home Network trouble
    ... VPC need Routing too just like any other computer. ... You can use a stand alone Router or use Windows native ICS to Route. ... Jack. ...
    (microsoft.public.windowsxp.network_web)
  • Re: New page......... a work in progress!
    ... What's this from the '70s with that grounded shielding in the jack ... Time Electronics. ...
    (alt.guitar.amps)
  • Re: Connecting a TV monitor...no sound
    ... Thanks Robin and Curious but I guess my real question is why does the jack ... > route the audio to ... >> your TV and your speakers at the same time. ...
    (microsoft.public.windows.mediacenter)
  • Re: Garmin GPSmap 76C Review
    ... > at least the testing by Magne and myself revealed some other ... > much stronger tendency to route over freeways. ... > * If you set your vehicle type to Bicycle, ...
    (sci.geo.satellite-nav)