Skip to contentSkip to conversation

routing ... ip rule, ip route ... please correct me

LARTC Krepper Guillermo Billy [email protected] 1 participant 1 message Feb 27, 2001

lore
Share & tools
lore

Krepper Guillermo Billy [email protected]

author
#0 lore raw

<PRE>Hi, how are all of you

Well tecnicaly this is not a question its like a correction. So lets get going.

I have 2 conecctions to the internet:

	eth0: 	200.1.1.1	64Kbit 
	eth0:0	200.1.1.2
	eth0:1	200.1.1.3

	eth1: 	66.1.1.1		256Kbit
	eth1:0	66.1.1.2
	eth1:1	66.1.1.3	
	eth1:2	66.1.1.4

This are conected to a linux PC. I allso have 3 IP class &quot;private&quot; networks

	eth2: 	192.168.101.1
	eth2:0	192.168.201.1
	eth2:1	192.168.220.1

So what I want to do is:

for 192.168.101.0/24 go via eth0
for 192.168.201.0/24 go via eth0
for 192.168.220.0/24 go via eth1

I still haven't this 2 connections and don't have the necesary hardware to make a home test. So I made a script, here is a fragment of what I can not test and would like someone to tell me if it's wrong or OK.

iptables -t nat -A POSTROUTING -o eth0 -s 192.168.101.0/24 -j SNAT \
--to 200.1.1.1
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.201.0/24 -j SNAT \
--to 200.1.1.2
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.220.0/24 -j SNAT \
--to 66.1.1.1

echo 500 eth064K &gt;&gt; /etc/iproute2/rt_tables
ip rule add from 192.168.101.0/24 table eth064K
ip rule add from 192.168.201.0/24 table eth064K
ip route add default dev eth0 table eth064K

	**NOTE: can I use &quot;via&quot; here?, should I?, witch IP should I use, 200.1.1.1?

echo 600 eth1256K &gt;&gt; /etc/iproute2/rt_tables ip rule add from 192.168.220.0/24 table eth1256K ip route add default dev eth1 table eth1256K
**NOTE: same as above

ip route flush cache

-------------------------------------------------------------------------------
Thanks

Billy

</PRE>