Routing for multiple uplinks/Providers

Discussion regarding the installation and configuration of Linux distributions.
Post Reply
sarthor
Battalion Quarter Master Havaldaar
Posts: 241
Joined: Wed Dec 24, 2003 2:36 am
Location: Pukhtoonistan
Contact:

Routing for multiple uplinks/Providers

Post by sarthor »

Salam O Alykum,

according to the under mentioned url i did all but still problem in routing 2 isps on same linux router,
http://lartc.org/howto/lartc.rpdb.multiple-links.html


Using Ubunut hardy 8.04 server i386
My /etc/network/interfaces
---------------------
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
# gateway 192.168.1.1
auto eth2
iface eth2 inet static
address 192.168.2.2
netmask 255.255.255.0
network 192.168.2.0
# gateway 192.168.2.1

auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
-------------------------
According to http://lartc.org/howto/lartc.rpdb.multiple-links.html
#!/bin/sh

## Creating Routing Tables
ip route add 192.168.1.0 dev eth1 src 192.168.1.2 table 1
ip route add default via 192.168.1.1 table 1
ip route add 192.168.2.0 dev eth2 src 192.168.2.2 table 2
ip route add default via 192.168.2.1 table 2
#=====
ip route add 192.168.1.1 dev eth1 src 192.168.1.2
ip route add 192.168.2.1 dev eth2 src 192.168.2.2
# default route
ip route add default via 192.168.1.1
# Adding Rules
ip rule add from 192.168.1.2 table 1
ip rule add from 192.168.2.2 table 2
# Adding according to Rod roard Note
ip route add 192.168.0.0 dev eth0 table 1
ip route add 192.168.2.0 dev eth2 table 1
ip route add 127.0.0.0/8 dev lo table 1

ip route add 192.168.0.0 dev eth0 table 2
ip route add 192.168.1.0 dev eth1 table 2
ip route add 127.0.0.0/8 dev lo table 2

ip route add default scope global nexthop via 192.168.1.1 dev eth1 weight 1 nexthop via 192.168.2.1 dev eth2 weight 1
-------------------------------
My routes
route -n

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
192.168.2.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth2
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth1
root@playzone:~#
---------------------------------------
on my linux Router i can browse (using elinks)and surf internet with gateway 192.168.1.1 but when i unpluge the 192.168.1.1 then 192.168.2.1 is not working,
in elinks browser i open ubuntu.com its says "Unable to retrive http://ubuntu.com/: No route to host"
[/quote]

also i disable the line "
ip route add default via 192.168.1.1" but still some pages are opening and some not,
my linux routuer can ping each gateway,
any help??
there was old thread about multiple routing on linuxpakistan.net forum and i searched that but i was not lucky
.
Salam O Alykum
Tefl E Maktab
-----------------------------
----- ----- ----- ------ ------ -------
osama
Havaldaar
Posts: 117
Joined: Fri Aug 22, 2008 9:08 am

Post by osama »

Well I recommend simplicity is the best solution. If u work in this way u will have to do many many work arounds to deal. For a small setup destination routining is the best and very easily managed and no work arounds.

If u still want source routing then see below code. I tried it some days back and it was working then. It can help u.

#___________
ip route flush table 4
ip rule del fwmark 4 table 4


ip route show table main | grep -Ev ^default \
| while read ROUTE ; do
ip route add table 4 $ROUTE
done

ip route add table 4 default via 10.10.10.1
echo 1
iptables -t mangle -A PREROUTING -s 192.168.2.2/32 -j MARK --set-mark 4
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 10.10.10.3

ip rule add fwmark 4 table 4

ip route flush cache
#________________

But still give a chance to destination routing.

I tried LARTC setup on FC2 2.6 kernel but it didnt work. Someone asked me to update the distro but i didnt :P.
nasacis
Battalion Havaldaar Major
Posts: 269
Joined: Sat Dec 13, 2003 3:58 pm
Location: Faisalabad
Contact:

Post by nasacis »

use metrics
Nafees Ahmed
Cell: +92.300.8653568
UAN: 041-111432432
Nexlinx Faisalabad
www.nexlinx.net.pk
nafees29@gmail.com
Post Reply