need help with route tables and policy routing please

Linux Advanced Routing and Traffic Control

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

 



Hello folks:  I am trying to set up a router machine to handle all my
network connections to the internet and my local network.  I have five
interfaces in total, three to ISPs (two adsl and one cable) and two
interfaces to my local network one to a switch and one wireless card.
I have some of the routing working acceptibly but another portion I
cannot get working not matter what I've tried.  The cable connection
comes in on eth1 and I'd like the output to go back out that interface
but it doesn't appear to work as advertised.  I would also like the
two adsl connections to return packets to the interface they came in
on and have packets originating from the local machine and networks
load balance out the two adsl connections.  Currently this doesn't
appear to be working either.  It seems straight forward in the
lartc.txt and ip-cref documents but it doesn't seem to work all the
same.  I would be very appreciative if someone can tell me what I am
doing wrong.

I will include my cobbled together policy routing script below.  It's
messy now because of all the silly things I've tried to get it working
the way I'd like.  The ip route outputs below show a third nexthop to
the 70.25.176.129 address but I only have that currently running as a
test of outputing to all three ISP connections.

  Kirk

#!/bin/bash

IF0=eth0
IP0=10.10.10.1
P0=70.25.176.129
P0_NET=10.10.10.0
IF1=eth1
IP1=70.25.176.154
P1=70.25.176.129
P1_NET=70.25.176.128
IF2=ppp0
IP2=209.213.232.127
P2=209.183.132.10
P2_NET=209.0.0.0
IF3=ppp1
IP3=69.63.33.227
P3=209.183.132.10
P3_NET=209.0.0.0

#ip route add $P0_NET dev $IF0 src $IP0 table 50
#ip route add default via $P0 table 50
#ip route add $P1_NET     dev $IF1 table 50
#ip route add $P2_NET     dev $IF2 table 50
#ip route add $P3_NET dev $IF3 table 50
#ip route add 127.0.0.0/8 dev lo   table 50

ip route replace $P1_NET dev $IF1 src $IP1 table 60
ip route replace default via $P1 table 60
ip route replace $P0_NET     dev $IF0 table 60
ip route replace $P2_NET     dev $IF2 table 60
ip route replace $P3_NET dev $IF3 table 60
ip route replace 127.0.0.0/8 dev lo   table 60

ip route replace $P2_NET dev $IF2 src $IP2 table 70
ip route replace default via $P2 dev $IF2 table 70
#ip route replace default scope global nexthop via $P2 dev $IF2 weight 1 \
#nexthop via $P3 dev $IF3 weight 1 table 70
ip route replace $P0_NET dev $IF0 table 70
ip route replace $P1_NET     dev $IF1 table 70
ip route replace $P3_NET dev $IF3 table 70
ip route replace 127.0.0.0/8 dev lo   table 70

ip route replace $P3_NET dev $IF3 src $IP3 table 80
ip route replace default via $P3 dev $IF3 table 80
#ip route replace default scope global nexthop via $P2 dev $IF2 weight 1 \
#nexthop via $P3 dev $IF3 weight 1 table 80
ip route replace $P0_NET dev $IF0 table 80
ip route replace $P1_NET     dev $IF1 table 80
ip route replace $P2_NET dev $IF2 table 80
ip route replace 127.0.0.0/8 dev lo   table 80

#ip rule del from $IP0 table 50
#ip rule add from $IP0 table 50
ip rule del from $IP1 table 60
ip rule add from $IP1 table 60
ip rule del from $IP2 table 70
ip rule add from $IP2 table 70
ip rule del from $IP3 table 80
ip rule add from $IP3 table 80

#ip route replace default via $P2 dev $IF2 
ip route replace default scope global nexthop via $P2 dev $IF2 weight 1 \
nexthop via $P3 dev $IF3 weight 1 
#nexthop via $P1 dev $IF1 weight 1


------------------------------------------------------------------------
Script started on Sun Mar 19 14:59:04 2006
kirk@router:~$ 
kirk@router:~$ iproute
bash: iproute: command not found
kirk@router:~$ ip route
209.183.132.10 dev ppp0  proto kernel  scope link  src 209.213.232.127 
209.183.132.10 dev ppp1  proto kernel  scope link  src 69.63.33.227 
70.25.176.128/25 dev eth1  proto kernel  scope link  src 70.25.176.154 
10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.1 
10.0.0.0/8 dev eth4  proto kernel  scope link  src 10.10.10.2 
default 
	nexthop via 209.183.132.10  dev ppp0 weight 1
	nexthop via 209.183.132.10  dev ppp1 weight 1
	nexthop via 70.25.176.129  dev eth1 weight 1
kirk@router:~$ 
kirk@router:~$ ip rule
0:	from all lookup local 
193:	from 69.63.33.227 lookup 80 
194:	from 209.213.232.127 lookup 70 
195:	from 70.25.176.154 lookup 60 
32766:	from all lookup main 
32767:	from all lookup default 
kirk@router:~$ 
kirk@router:~$ ip route ls tab 60
10.10.10.0 dev eth0  scope link 
70.25.176.128 dev eth1  scope link  src 70.25.176.154 
209.0.0.0 dev ppp1  scope link 
127.0.0.0/8 dev lo  scope link 
default via 70.25.176.129 dev eth1 
kirk@router:~$ 
Script done on Sun Mar 19 15:01:39 2006

-- 

Kirk Reiser				The Computer Braille Facility
e-mail: kirk@xxxxxxxxxxxxxx		University of Western Ontario
phone: (519) 661-3061
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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