[LARTC] routing ... ip rule, ip route ... please correct me

Linux Advanced Routing and Traffic Control

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

 



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 "private" 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 >> /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 "via" here?, should I?, witch IP should I use, 200.1.1.1?

echo 600 eth1256K >> /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






[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux