Re: What is a 'default route'??

From: P Gentry (rdgentry1_at_cablelynx.com)
Date: 03/15/04


Date: 15 Mar 2004 14:27:56 -0800

jack <not@all.org> wrote in message news:<c33qfn$59u$07$1@news.t-online.com>...
> Arthur wrote:
> > Jack,
> >
> > So, if I would code 2 default routes, one for each router/gateway, and
> > the first one goes down, would it eventually use the second one? Or
> > would it just timeout?
>
> It would just time-out, until You remove the first entry.
>
> Again, the kernel will only use the first matching entry in the routing
> table. Since the dafault route is like a "catch-all", any routes that
> are defined below the first default route will never be used - no matter
> whether the first one is functonal or not.
>
> Cheers, Jack.

Reviewing the previous posts, yous guys need to take some time and
review _closely_ the several advanced routing how-tos available,
especially:
http://linux-ip.net/
http://lartc.org/#download

OP wants to use _both_ public facing NICs simultaneously -- a form of
load balancing. Perhaps load sharing would be a better term but we're
stuck with what we've got.

It's technically _possible_ to do so, but is not practicable since the
lines run to two different ISPs. If both lines went to same ISP then
both forms of load balancing would be possible, even if difficult.

The default behavior in such a "friendly" setup (one ISP, one net IP)
is to alternate the NICs used, ie., packetA out NIC1, packetB out
NIC2, packet3 out NIC1, packet4 out NIC2, etc. Getting packets back
can be difficult -- nearly impossible when NAT is involved.

By "bonding" the NICs the OP could have automatic failover (another
form of load balancing), but one line would go unused till the other
went down. Ie., useful as a backup, but half the available bandwidth
is wasted.

Complicating the OP's setup is the fact of two ISPs, thus two nets and
two route paths. What is needed here is a way to tell the kernel to
route related packets out one interface and other related packets out
the other interface. This can be done, but I'm not sure what you
would gain, unless you do a lot of "background" downloading of large
files (using one NIC) or trying to download many files from many sites
during a pretty lengthy session (using both NICs at once).

In any case this can get _very_ tricky/difficult very quickly in the
best of circumstances. You'ld have to dig into the finer details of
using iputils policy routing (and probably traffic shaping too).

A couple of days ago someone pointed out to me a new module (ie.,
target) available for use with iptables that may provide the simplist
answer in this case. I've not had time to look at it but here it is:
[quote]
The new iptable modules SAME can be used to fix this. It sends reply
packets back out the same public IP address it came in on.

-- 
Cameron Kerr
cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/
[end quote]
You might want to look at the thread:
http://groups.google.com/groups?selm=c27i2501gei%40drn.newsguy.com
Info on the module here:
http://www.netfilter.org/documentation/HOWTO/netfilter-extensions-HOWTO-4.html#ss4.6
BTW, there is nothing wrong with having two default routes (or a
hundred for that matter) but you do need to be mindful of how the
table is processed (the first that matches theory is nice and is
usually correct enough, but the actual algorithm is "longest CIDR is
selected, equal lengths use first encountered").
Anyway, before getting your setup hopelessly confused do some
background reading, document all changes to routing tables
_as_you_make_them, etc., and have a "base" setup you can revert to
easily if you do get in a tangle.  Also be prepared to do a lot of
manual flushing of route and arp tables and your FW rules.  Don't get
in a hurry!
hth,
prg
email above disabled


Relevant Pages

  • Re: q Imcoming packets for multiple uplinks/providers
    ... > Packets with a dest. ... > Outbound packets will be routed according to your routing tables ... > an AS number with peering agreements to your ISPs. ... > of the 'net to route packets to any of your IP address blocks through ...
    (comp.os.linux.security)
  • Re: q Imcoming packets for multiple uplinks/providers
    ... Outbound packets will be routed according to your routing tables ... an AS number with peering agreements to your ISPs. ... of the 'net to route packets to any of your IP address blocks through ...
    (comp.os.linux.security)
  • Re: using two NICs
    ... >> You can only have one default route, and that route points to one ... Aliases are on the same NIC, not across multiple NICs unless you are ... Without getting in to the guts of packets and how they work, ... go back out the interface it came in. ...
    (RedHat)
  • Re: Ethernet card receiving influenced by CPU speed?
    ... it usually shows up in nics and video cards. ... Frames are the "packets" used to send ethernet signals/data on the ...
    (comp.os.linux.networking)
  • RE: Quickie... Hopefully!
    ... the interface two Ips with ifconfig and set the default route to our newest ... > via the 1.1.1.1 gateway. ... > addresses on the same NIC that are different networks. ... We are in the process of changing ISPs, ...
    (freebsd-questions)