multiple uplinks example script

Linux Advanced Routing and Traffic Control

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

 



Hi!

I had two uplinks till today. We stopped one of them today, so i thought i could share my experience. (it is maybe useful for somebody)

I hadn't managed to configure it using a LARTC howto, but the Nano-howto (http://www.ssi.bg/~ja/nano.txt) and julian's kernel patches.

I had some problems with icq connections, because it is a two step connection (It is just theory).
1. Client --> Main server
2. Main Server --> Client ; Main server -> small server
3. Client -> small server


The problem is, when connection 1. use different uplink then connection 2.

Those icq related rules below corrected the problem.

My script:
IF0=eth2
IF1=eth1
IF2=eth3
IF3=eth0
P0_NET=192.168.1.0/24
P1_NET=public1
P2_NET=public2

IP0=192.168.1.254
IP1=publicip1
IP2=publicip1

#gateway
P1=publicgw1
P2=publicgw2

#table
T1=211
T2=212
T3=222

IP=/sbin/ip

# Delete everything
#$IP route flush cache
$IP route flush all
$IP route flush all table $T1
$IP route flush all table $T2
$IP route flush all table $T3

#icq rules
$IP rule delete prio 48 to 205.188.0.0/16 table $T1
$IP rule delete prio 49 to 64.12.161.153 table $T1
$IP rule delete prio 49 to 64.12.0.0/16 table $T1

$IP rule delete prio 50 table main
$IP rule delete prio $T3 table $T3
$IP rule delete prio $T1 from $P1_NET table $T1
$IP rule delete prio $T2 from $P2_NET table $T2


# The default table $IP route add $P0_NET dev $IF0 src $IP0 $IP route add $P1_NET dev $IF1 src $IP1 $IP route add $P2_NET dev $IF2 src $IP2

# For stable icq connections
$IP rule add prio 48 to 205.188.0.0/16 table $T1
#$IP rule add prio 49 to 64.12.161.153 table $T1
$IP rule add prio 49 to 64.12.0.0/16 table $T1
$IP rule add prio 50 table main
$IP route del default table main

$IP rule add prio $T3 table $T3
$IP route add default table $T3 proto static \
    nexthop via $P1 dev $IF1 weight 1 \
    nexthop via $P2 dev $IF2 weight 3

$IP rule add prio $T1 from $P1_NET table $T1
$IP route add default via $P1 dev $IF1 src $IP1 proto static table $T1
$IP route append prohibit default table $T1 metric 1 proto static

$IP rule add prio $T2 from $P2_NET table $T2
$IP route add default via $P2 dev $IF2 src $IP2 proto static table $T2
$IP route append prohibit default table $T2 metric 1 proto static

$IP route flush cache

--
Udv,
  Nandor
_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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