routing to specific network

David Miller fquestions at d.sparks.net
Sun Jan 11 11:38:51 PST 2004


On Mon, 12 Jan 2004, Dinesh Nair wrote:

> 
> hey,
> 
> i'm on a multihomed FreeBSD 4.9-RELEASE, cvsupped and built to -STABLE as
> of two weeks ago. the two NICs on the box each go to different ADSL
> providers. right now, i can switch which provider i use by just manually
> changing the default route. however, what i'd like to do is to have the
> default route set to one provider, but manually add static routes to
> networks closer to the second provider going out that way.
> 
> EXAMPLE OUTPUT OF NETSTAT -RN:
> 
> default            192.168.0.1        UGSc       13     2878   fxp0
> 10.1/16            link#9             UC          2        0   aue0
> 10.1.105.5         00:e0:7d:03:a2:08  UHLW        0      363   aue0    815
> 10.1.105.26        00:08:54:d0:5d:2e  UHLW        1        0    lo0
> 60.6/16            10.1.1.1           UGSc        0        0   aue0
> 127.0.0.1          127.0.0.1          UH          0    12407    lo0
> 192.168.0          link#2             UC          1        0   fxp0
> 192.168.0.1        00:30:ab:10:6c:0d  UHLW       13      215   fxp0    913
> 
> (192.168.0.1 is ISP1's router and 10.1.1.1 is ISP2's router)

So you want packets for 60.6.* to go out through ISP2?

> 
> i've successfully managed to add routes for /16 networks, and 'netstat
> -rn' as well as 'route -n get' both give the expected results. however,
> tracerouting to an ip address in one of these static routes still shows
> that it is going out thru the default route instead of the second
> provider. running a packet sniffer and attempting a http connection
> confirmed this. in this case, any packet going to 60.6.1.1
> 
> what exactly should i be doing to get the behaviour i desire ?

By the sounds of it, exactly what you are doing.  Can you show us a
traceroute that isn't working normally?  Are you running any routing
protocols, like routed?



> a secondary question is, with the /usr/ports/net/zebra package, can i
> configure this box to load balance flows over both ADSL connections,
> assuming i do not have an AS number (for BGP) handy ? i.e. the question
> is, assuming i make a tcp connection out using a browser (for argument's
> sake, mozilla), can mozilla send the packet out dynamically on the first
> NIC (with its IP address as source) and then round robin the next TCP
> connection off the second NIC (with the second IP address as source) ?
> would i need the recent multipath patches (though its for 4.8-STABLE) to
> do this ?

Zebra implemets a number of routing protocols, including bgp.  With BGP
you can pick the best route *out* for your packet, but everyone else's BGP
sessions will decide the best route *in* for you.  In other words, you
can't really shape the incoming traffic very much.  In order to setup BGP
you'll need to get both your upstreams to setup BGP sessions with you,
which is very unlikely to happen.  It's also unlikely to really buy you
any performance advantage after you subtract the bandwidth that the
routing protocol takes.

Lastly, you don't have any routes to advertise that will help.  I assume,
at least, that you just have a /32 for each connection, in which case
you'd be trying to advertise a /32 to the entire Internet.  That's not
going to happen:)

Hope this helps,

--- David



More information about the freebsd-questions mailing list