Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multiple routes
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Dreadfull2
n00b
n00b


Joined: 28 Jun 2006
Posts: 60

PostPosted: Tue Jul 18, 2006 8:33 am    Post subject: Multiple routes Reply with quote

Hi, i did read all the topics found around here about multiple routing etc but didn't help me much, at least i learned exactly what i need :)
Thought there is something wich i didn't understand

from lartc.org:
Code:

4.2.1. Split access

The first is how to route answers to packets coming in over a particular provider, say Provider 1, back out again over that same provider.

Let us first set some symbolical names. Let $IF1 be the name of the first interface (if1 in the picture above) and $IF2 the name of the second interface. Then let $IP1 be the IP address associated with $IF1 and $IP2 the IP address associated with $IF2. Next, let $P1 be the IP address of the gateway at Provider 1, and $P2 the IP address of the gateway at provider 2. Finally, let $P1_NET be the IP network $P1 is in, and $P2_NET the IP network $P2 is in.

One creates two additional routing tables, say T1 and T2. These are added in /etc/iproute2/rt_tables. Then you set up routing in these tables as follows:

     ip route add $P1_NET dev $IF1 src $IP1 table T1
     ip route add default via $P1 table T1
     ip route add $P2_NET dev $IF2 src $IP2 table T2
     ip route add default via $P2 table T2

what's all about $P1_NET and $P2_NET, what does it mean by "the IP network $P1/P2 is in" ?
Does it mean to specify something like 192.168.168.0/24 ?

Till now adding two default routes didn't work, adding with ip route add worked for ISP1 but not for ISP2 as long as i didn't remove the default route for ISP1 and add the route for ISP2

my setup is as follows:
eth0 -> fiber optics (ISP1)
eth1 -> lan #1 (192.168.65.0/24, my ip: 192.168.65.254) where i can find a router with ip 192.168.65.200 (ISP2)
eth2 -> lan #2 (192.168.168.0/24, my ip: 192.168.168.1) where i'm routing internet from eth0

i want to be able to use both connections at the same time with default GW to ISP1 and be able to use ISP2 when using eth1 (as ping host -I eth1) without sticking to routes/configs anymore
Any help would be kindly appreciated.
P.S. i patched my kernel with the routes patch (do i need to reboot?)
_________________
AMD Athlon 64 3200+
2x1 GB DDR
2x200 GB WDC SATA
----
curently owning 5 routers all on gentoo
----
Back to top
View user's profile Send private message
fleed
l33t
l33t


Joined: 28 Aug 2002
Posts: 756
Location: London

PostPosted: Tue Jul 18, 2006 11:36 am    Post subject: Re: Multiple routes Reply with quote

Dreadfull2 wrote:
what's all about $P1_NET and $P2_NET, what does it mean by "the IP network $P1/P2 is in" ?
Does it mean to specify something like 192.168.168.0/24 ?

Yep, that's exactly it!
Dreadfull2 wrote:
P.S. i patched my kernel with the routes patch (do i need to reboot?)

Yes, you do!!! Put it in /boot and do all the stuff you need to do when changing kernels.

You should be able to use both connections without a problem. Your setup is not that complicated, just make sure you point each network you're part of to the right device, as you ask about in your first question.
Back to top
View user's profile Send private message
Dreadfull2
n00b
n00b


Joined: 28 Jun 2006
Posts: 60

PostPosted: Tue Jul 18, 2006 3:29 pm    Post subject: Reply with quote

so for isp2 i suppose i need something like

Code:

ip route add 192.168.65.0/24 dev eth2 src 192.168.65.254 table isp2
ip route add default via 192.168.65.200 table isp2


erm .. is it 192.168.65.0/24 or is it 192.168.65.254/32 ?
_________________
AMD Athlon 64 3200+
2x1 GB DDR
2x200 GB WDC SATA
----
curently owning 5 routers all on gentoo
----
Back to top
View user's profile Send private message
Dreadfull2
n00b
n00b


Joined: 28 Jun 2006
Posts: 60

PostPosted: Tue Jul 18, 2006 3:52 pm    Post subject: Reply with quote

this is exactly what i did:

ip route add 192.168.168.0/24 dev eth0 src 192.168.168.253 table isp1
ip route add default via 192.168.168.1 table isp1
ip route add 192.168.65.0/24 dev eth1 src 192.168.65.253 table isp2
ip route add default via 192.168.65.200 table isp2
ip rule add from 192.168.168.253 table isp1
ip rule add from 192.168.65.253 table isp2
192.168.168.253 is ip from eth0
192.168.65.253 is ip from eth1
and
192.168.168.1 is gw within eth0 (isp1)
192.168.65.200 is gw within eth1 (isp2)

P.S: eth1 and eth2 are on the same LAN (both going into a switch)

anything missed ?

also i didn't try anything from here (also from lartc.org)
Code:

Warning   

Reader Rod Roark notes: 'If $P0_NET is the local network and $IF0 is its interface, the following additional entries are desirable:

ip route add $P0_NET     dev $IF0 table T1
ip route add $P2_NET     dev $IF2 table T1
ip route add 127.0.0.0/8 dev lo   table T1
ip route add $P0_NET     dev $IF0 table T2
ip route add $P1_NET     dev $IF1 table T2
ip route add 127.0.0.0/8 dev lo   table T2                                     

as i don't know what's all about $P0_NET, curently i'm testing this on another server so that's why both isp's are on same lan, after i'll see it's working then i'll work on the main router (in that case, isp1 will be separate from isp2 .. 1st on FO 2nd on LAN)
_________________
AMD Athlon 64 3200+
2x1 GB DDR
2x200 GB WDC SATA
----
curently owning 5 routers all on gentoo
----
Back to top
View user's profile Send private message
Dreadfull2
n00b
n00b


Joined: 28 Jun 2006
Posts: 60

PostPosted: Tue Jul 18, 2006 3:54 pm    Post subject: Reply with quote

sorry for tripple posting, it WORKS ! i added default route to isp2 near the other default route to isp1 and it worked for the 1st time (last time i did this none of them worked while having two default routes, i admit, that was before patching the kernel)

traceroute seems to have problems (tracepath always uses the default gw, in my case, isp1) and traceroute won't work on isp2 even if i'm setting all the options it could have (gw, iface, src_addr) ..

this is what i get from tcptrace:
Code:

tcptraceroute -i eth1 yahoo.com -s 192.168.65.254

Selected device eth1, address 192.168.65.254, port 50027 for outgoing packets
Tracing the path to yahoo.com (216.109.112.135) on TCP port 80 (http), 30 hops max
libnet_write failed?  Attempted to write 40 bytes, only wrote -1

(worked with eth0 but not with eth1)
traceroute:
Code:

traceroute: Warning: yahoo.com has multiple addresses; using 66.94.234.13
traceroute to fifaworldcup.yahoo.net (66.94.234.13), 30 hops max, 46 byte packets
traceroute: sendto: Operation not permitted
 1 traceroute: wrote yahoo.com 46 chars, ret=-1

and when adding options sendto: gives "invalid argument"
_________________
AMD Athlon 64 3200+
2x1 GB DDR
2x200 GB WDC SATA
----
curently owning 5 routers all on gentoo
----
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum