routing help


Subject: routing help
From: Scott Johnson (scott@akghetto.com)
Date: Wed Feb 11 2004 - 20:00:38 AKST


My main network router is multi-homed, behind two different NAT
devices. I have a script that runs good with no errors, and routes my
outgoing requests fine, however I'm still running into the problem of
not routing response requests from external hosts out the correct
gateway that the request originated from. If anyone can see anything
wrong with my script, or has experience multi-homing a linux router,
any help would be appreciated.

Scott

---------------------------
[root@defiant root]# cat routes
#!/bin/sh

## DEFINE THE MULTI-HOMED INTERFACES ##

IF4=eth4 ##Interface
IP4=172.26.2.1 ##Interface IP
P4=172.26.2.2 ##Gateway IP
P4_NET=172.26.2.0/24 ##Subet
T4=table4 ##Kernel routing table name

IF5=eth5
IP5=172.26.6.1
P5=172.26.6.2
P5_NET=172.26.6.0/24
T5=table5

## DEFINE ALL OTHER INTERFACES ##

IF0=eth0
P0_NET=172.26.1.0/24

IF1=eth1
P1_NET=172.26.5.0/24

IF2=eth2
P2_NET=172.26.4.0/24

IF3=eth3
P3_NET=172.26.3.0/24

IP=/sbin/ip

## MAKES MULTI-HOMED ROUTING TABLES ##

$IP route add $P4_NET dev $P4 src $IP4 table $T4
$IP route add default via $P4 table $T4
$IP route add $P5_NET dev $IF5 src $IP5 table $T5
$IP route add default via $P5 table $T5

$IP route add $P4_NET dev $IF4 src $IP4
$IP route add $P5_NET dev $IF5 src $IP5

$IP rule add from $IP4 table $T4
$IP rule add from $IP5 table $T5

## ADD IN OTHER INTERFACE ROUTES TO TABLES ##

$IP route add $P0_NET dev $IF0 table $T4
$IP route add $P1_NET dev $IF1 table $T4
$IP route add $P2_NET dev $IF2 table $T4
$IP route add $P3_NET dev $IF3 table $T4
$IP route add $P4_NET dev $IF4 table $T4

$IP route add $P0_NET dev $IF0 table $T5
$IP route add $P1_NET dev $IF1 table $T5
$IP route add $P2_NET dev $IF2 table $T5
$IP route add $P3_NET dev $IF3 table $T5
$IP route add $P5_NET dev $IF5 table $T5

## MAKE DEFAULT ROUTE MULTI-HOMED ##

$IP route del default

$IP route add default scope global nexthop via $P4 dev $IF4 weight 1
nexthop via $P5 dev $IF5 weight 1

$IP route flush cache

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Wed Feb 11 2004 - 20:00:32 AKST