Subject: Setting up policy routing
To: None <>
From: Sumit Pandya <>
List: tech-net
Date: 04/26/2002 14:40:41
Hi All,
	Below is my setup
Corporate Computer 1
+-----------------+		Linux router/Host
|	 |-------+	+----------------+ with gateway
+-----------------+	| 	|		|---------------------
		        HUB -----|	|
+-----------------+	| 	|		|---------------------
|	  |------+	+----------------+ with gateway
Corporate Computer 2

	My corporate network is setup with Lower-end of this
network; i.e. from IP to; is for higher
authorities of organization and remaining to IPs
are assigned to rest of the employee's computer. My Internet access server
has 2 connections to Internet; say with gateway, speed
128Kbps and with gateway speed 64Kbps.
	I want computers of higher authority will go from 128Kbps link. For that I
add following routing entries with "ip" command of iproute2.
	# ip rule add from table 128speed
	# ip route add via table 128speed
	# ip rule add from table 64speed
	# ip route add via table 64speed

	# iptables t nat A POSTROUTING -j MASQUERADE

	After this setup I cannot access either Linux router or Internet because
all reply goes to device of default route for my computers. I.e.
packets/responses for computer go to interface with IP This is because routes for my internal network is there in table
"main" and my rules are added before the rule to traverse "main". Now what I
want is entries of main table (or rule to traverse main table) is consulted
before my rules.
	While defining "rules" I can specify preference with "pref" option to "ip
rule add ...", so my rules will be traveled after main table. But here in
this case problem is entry of default route in table "main". Finally I
removed that default route from table main and everything worked for me.
	Now my questions are
1> Before all above described solution, I try to get it working by
specifying metric 2 in the route I added into my rules but that doesn't
worked. Is scope of metric is limited of one rule?

2> Does there exist any easier solution then what I did in my setup?

3> Do you think to get this configuration activated at system bootup I add a
nice script in rc.local or any other way?

Thanks for replies.