What is a 'default route'??

What is a 'default route'??

Post by Arth » Thu, 11 Mar 2004 14:17:48



Hi All,

Since I'm such a dingbat, amybe someone can explain this in dingbat
terms to me so I understand it.

I have a Linux box (Mandrake 9.2).  It has 2 NIC's.  I have 2
different DSL providers.  Thus I have 2 routers, 1 switch and 2 DSL
modems.

Below is my routing table.  What is a default route?  Basically, does
this mean that ALL traffic on your network goes out to the internet
via this route?  If that is true, then why have multiple NIC's?

Is the following correct?

eth0 (192.168.1.110)
------\
       \
        ===> default route  (192.168.1.1)   OR   (192.168.0.1)
       /
------/
eth1 (192.168.0.110)

Thus is the default route goes down, there is no internet traffic.
Maybe that is wrong?  Perhaps it is this?

eth0 (192.168.1.110)
------\
       \
        ===> default route  (192.168.1.1)   AND   (192.168.0.1)
       /
------/
eth1 (192.168.0.110)

If the second diagram is true, then I should have automatic failover.
I should be able to use both routes regardless.

Should the same not be true for incoming connections?   Why can't I
SSH or TELNET into both like this:

            / <-- 206.126.232.53
eth0       /
  =========
eth1       \
            \ <-- 64.36.28.114

That does not work.   I can only come in one 1 connection, not both.
So, it seems to me that regardless on how many NIC's or routers or
whatever I have, if the default route does down, I'm out of luck.
Thus, there is really only one way out to the internet?   And, only
one way into my box??

eth0 / eth1 <======> 206.126.232.53   OR   64.36.28.114

Can someone please, please explain this in dingbat terms for me?

Basically I have 2 DSL lines and 2 NIC's.  I should be able to go out
over either one and come in over either one.  And, if one goes down,
the other should take over and I can stil get in and out over that
one.....that is what I really want.

Oh yeah, my routing table:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref  
Use Iface
192.168.1.0     192.168.1.1     255.255.255.0   UG    0      0      
0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0      
0 eth0
192.168.0.0     192.168.0.1     255.255.255.0   UG    0      0      
0 eth1
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0      
0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0      
0 lo
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0      
0 eth1
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0      
0 eth0
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0      
0 eth0

Thanks in advance,

-A

 
 
 

What is a 'default route'??

Post by Wayne Thro » Thu, 11 Mar 2004 14:29:00



: What is a default route?  Basically, does this mean that ALL traffic
: on your network goes out to the internet via this route?  If that is
: true, then why have multiple NIC's?

A default route is the route used when none of the other entries in the
table match the target address.  Therefore, not *all* traffic; just
traffic which isn't routed elsewhere by a more restrictive rule than
"default".  You have multiple NICs when you want to route some traffic
through one, and some through the other; the typical case being that one
of the NICs is on some private net, so that addresses for that private
net are sent thre, and the other is on a net connected to your ISP via
DSL or cable or whatnot.

A typical setup might be to have eth0 be the local net, and route (say)
192.168.1.0 there, so that all traffic on that subnet goes there, and
eth1 be the connection to the ISP, which might be set up for 192.168.0.0,
and you'd set the default route to your ISPs gateway on that device.
For cable, this might looke something like

Destination  Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.1.0  *               255.255.255.0   U        40 0          0 eth0
192.168.0.0  *               255.255.255.0   U        40 0          0 eth1
default      192.168.0.1     0.0.0.0         UG       40 0          0 eth1

or something like that.  So, you have a packet for yahoo; it'll use
the default route, realize it needs to go out eth1, and that it needs
to be sent to a gateway rather than directly, and it'll hand the packet
off to your ISP via eth1.

For cable, you'd normally just set up eth1 to use DHCP, and let DHCP set up
the default route during boot time, so you don't have to worry about
which actual addresses to fill in for the gateway and such.  For DSL,
it's typically a bit more complicated.

That's the typical case.  If you have two ISPs, your like if much
more complicated; you may want to do some form of dynamic load-ballancing,
and the details for accomplishing this are more obscure.



 
 
 

What is a 'default route'??

Post by Carsten Kelle » Thu, 11 Mar 2004 17:35:23



Quote:> Is the following correct?

> eth0 (192.168.1.110)
> ------\
>        \
>         ===> default route  (192.168.1.1)   OR   (192.168.0.1)
>        /
> ------/
> eth1 (192.168.0.110)

> Thus is the default route goes down, there is no internet traffic.
> Maybe that is wrong?  Perhaps it is this?

It is correct. If your primary concern is to allways be able to reach your
machine from the outside you can write a script that ping some hosts on the
internet, and if it fails change the default route. You can schedule this
with cron.
Combine this with some dynamic DNS-service, and you will allways be able to
reach your host with some domainname, apart from the time between the shifts
and the time it takes the DNS-zone to update.

Quote:> eth0 (192.168.1.110)
> ------\
>        \
>         ===> default route  (192.168.1.1)   AND   (192.168.0.1)
>        /
> ------/
> eth1 (192.168.0.110)

> If the second diagram is true, then I should have automatic failover.
> I should be able to use both routes regardless.

This will require some loadbalancing like wayne mentions.

Quote:> Should the same not be true for incoming connections?   Why can't I
> SSH or TELNET into both like this:

>             / <-- 206.126.232.53
> eth0       /
>   =========
> eth1       \
>             \ <-- 64.36.28.114

> That does not work.   I can only come in one 1 connection, not both.
> So, it seems to me that regardless on how many NIC's or routers or
> whatever I have, if the default route does down, I'm out of luck.
> Thus, there is really only one way out to the internet?   And, only
> one way into my box??

> eth0 / eth1 <======> 206.126.232.53   OR   64.36.28.114

> Can someone please, please explain this in dingbat terms for me?

Yes, at any given time there is only one way into your box from any one IP
on the outside, if you don't have loadbalancing...

Quote:> Basically I have 2 DSL lines and 2 NIC's.  I should be able to go out
> over either one and come in over either one.  And, if one goes down,
> the other should take over and I can stil get in and out over that
> one.....that is what I really want.

That is possible, see at the top.

Keller

 
 
 

What is a 'default route'??

Post by Arth » Fri, 12 Mar 2004 04:44:43


Well, this raises several questions.

If I have load balancing in place, and I believe I do, then if one DSL
line goes down, the other will take over.  But, what if it the DSL
line that has the default route defined?  In order to send data in or
out, would I need to change my default route, ie:  the cron job you
are referring to?  Or, because of load balancing, would this happen
automagically?

When someone types my domain name, or one of my domains, how does it
choose which route it will come in under?  I'm a bit curious about
this......

-A




> > Is the following correct?

> > eth0 (192.168.1.110)
> > ------\
> >        \
> >         ===> default route  (192.168.1.1)   OR   (192.168.0.1)
> >        /
> > ------/
> > eth1 (192.168.0.110)

> > Thus is the default route goes down, there is no internet traffic.
> > Maybe that is wrong?  Perhaps it is this?

> It is correct. If your primary concern is to allways be able to reach your
> machine from the outside you can write a script that ping some hosts on the
> internet, and if it fails change the default route. You can schedule this
> with cron.
> Combine this with some dynamic DNS-service, and you will allways be able to
> reach your host with some domainname, apart from the time between the shifts
> and the time it takes the DNS-zone to update.

> > eth0 (192.168.1.110)
> > ------\
> >        \
> >         ===> default route  (192.168.1.1)   AND   (192.168.0.1)
> >        /
> > ------/
> > eth1 (192.168.0.110)

> > If the second diagram is true, then I should have automatic failover.
> > I should be able to use both routes regardless.

> This will require some loadbalancing like wayne mentions.

> > Should the same not be true for incoming connections?   Why can't I
> > SSH or TELNET into both like this:

> >             / <-- 206.126.232.53
> > eth0       /
> >   =========
> > eth1       \
> >             \ <-- 64.36.28.114

> > That does not work.   I can only come in one 1 connection, not both.
> > So, it seems to me that regardless on how many NIC's or routers or
> > whatever I have, if the default route does down, I'm out of luck.
> > Thus, there is really only one way out to the internet?   And, only
> > one way into my box??

> > eth0 / eth1 <======> 206.126.232.53   OR   64.36.28.114

> > Can someone please, please explain this in dingbat terms for me?

> Yes, at any given time there is only one way into your box from any one IP
> on the outside, if you don't have loadbalancing...

> > Basically I have 2 DSL lines and 2 NIC's.  I should be able to go out
> > over either one and come in over either one.  And, if one goes down,
> > the other should take over and I can stil get in and out over that
> > one.....that is what I really want.

> That is possible, see at the top.

> Keller

 
 
 

What is a 'default route'??

Post by jack » Fri, 12 Mar 2004 08:56:29



> Well, this raises several questions.

> If I have load balancing in place, and I believe I do, then if one DSL

If You "believe" that You do, You most certainly don't.

Load balancing requires thoroughful configuration, so if You had it,
You'd know for sure. But,...

Quote:> line goes down, the other will take over.  But, what if it the DSL
> line that has the default route defined?  In order to send data in or
> out, would I need to change my default route, ie:  the cron job you
> are referring to?  Or, because of load balancing, would this happen
> automagically?

This _is_ the basic idea of all load balancing, traffic shaping con-
cepts.

Try to look at things this way: If You use "load balancing", You want
to use all routes that are available to one given destination at their
best performance in parallel. That means that You have more than one
physical connection to the internet. Now most of the time, even if You
have two of those, they are not equal among each other: Either one is
slower (at a given time, not necessarily permanently) than the other,
or, (same in other words), one of them is more "expensive" (in time or
money or ressources). What load balancing means is that all traffic
will be sent over the connections available, but in a fashion that
adapts the agility of the respective connection, thus choosing the
least expensive (fastest or cheapest) before those more expensive.

In that context, there's more than one default route. But You don't
get that with the "route" command by itself. In a "typical" work-
station or small router environment, You'll only have one default
route, and that's it. Even if You have more than one such route in
Your local routing table, only the first of them wll be used, even
if the connection is dead.

As for default and routes in general:

Quote:> When someone types my domain name, or one of my domains, how does it
> choose which route it will come in under?  I'm a bit curious about
> this......

This is, indeed, unpredictable (in most cases). [man routed may come
handy...]

The thing is that between "someone" (i. e. client) and Your domain
(i. e. server), there are a number of routers. Most of these have
multiple routes to send that traffic over. Which of those routes
each router involved will choose depends not only on the availability
of that route in general ("link up" as opposed to cut down by thunder-
storms or the like), but also on the capacity of that link.

If You try to transfer a file of major size from A to B, You will
rarely find a situation where _all_ packets of that transfer will come
the exactly same route.

Quote:>>>Basically I have 2 DSL lines and 2 NIC's.  I should be able to go out
>>>over either one and come in over either one.  And, if one goes down,
>>>the other should take over and I can stil get in and out over that
>>>one.....that is what I really want.

www.lartc.org

Before You go there, You should get a basic understanding of what's
going on with the Networking- and Advanced-Routing-HowTos.

Cheers, Jack.

--
----------------------------------------------------------------------
My personal reading of the string "MicroSoft" expands to "NanoWeak"...

 
 
 

What is a 'default route'??

Post by Arth » Sat, 13 Mar 2004 05:04:00


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?

Thanks,

-A



> > Well, this raises several questions.

> > If I have load balancing in place, and I believe I do, then if one DSL

> If You "believe" that You do, You most certainly don't.

> Load balancing requires thoroughful configuration, so if You had it,
> You'd know for sure. But,...

> > line goes down, the other will take over.  But, what if it the DSL
> > line that has the default route defined?  In order to send data in or
> > out, would I need to change my default route, ie:  the cron job you
> > are referring to?  Or, because of load balancing, would this happen
> > automagically?

> This _is_ the basic idea of all load balancing, traffic shaping con-
> cepts.

> Try to look at things this way: If You use "load balancing", You want
> to use all routes that are available to one given destination at their
> best performance in parallel. That means that You have more than one
> physical connection to the internet. Now most of the time, even if You
> have two of those, they are not equal among each other: Either one is
> slower (at a given time, not necessarily permanently) than the other,
> or, (same in other words), one of them is more "expensive" (in time or
> money or ressources). What load balancing means is that all traffic
> will be sent over the connections available, but in a fashion that
> adapts the agility of the respective connection, thus choosing the
> least expensive (fastest or cheapest) before those more expensive.

> In that context, there's more than one default route. But You don't
> get that with the "route" command by itself. In a "typical" work-
> station or small router environment, You'll only have one default
> route, and that's it. Even if You have more than one such route in
> Your local routing table, only the first of them wll be used, even
> if the connection is dead.

> As for default and routes in general:

> > When someone types my domain name, or one of my domains, how does it
> > choose which route it will come in under?  I'm a bit curious about
> > this......

> This is, indeed, unpredictable (in most cases). [man routed may come
> handy...]

> The thing is that between "someone" (i. e. client) and Your domain
> (i. e. server), there are a number of routers. Most of these have
> multiple routes to send that traffic over. Which of those routes
> each router involved will choose depends not only on the availability
> of that route in general ("link up" as opposed to cut down by thunder-
> storms or the like), but also on the capacity of that link.

> If You try to transfer a file of major size from A to B, You will
> rarely find a situation where _all_ packets of that transfer will come
> the exactly same route.

> >>>Basically I have 2 DSL lines and 2 NIC's.  I should be able to go out
> >>>over either one and come in over either one.  And, if one goes down,
> >>>the other should take over and I can stil get in and out over that
> >>>one.....that is what I really want.

> www.lartc.org

> Before You go there, You should get a basic understanding of what's
> going on with the Networking- and Advanced-Routing-HowTos.

> Cheers, Jack.

 
 
 

What is a 'default route'??

Post by jack » Tue, 16 Mar 2004 17:44:39



> 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.

--
----------------------------------------------------------------------
My personal reading of the string "MicroSoft" expands to "NanoWeak"...

 
 
 

What is a 'default route'??

Post by P Gent » Wed, 17 Mar 2004 07:27:56




> > 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

[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-HOW...

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

 
 
 

1. routed is trashing my 'default' route

Hi folks,

Hopefully this simple problem has a simple solution :) ..

Like many of us I connect to the internet through a
dialup ppp link. The link works great provided 'routed'
is *not* running. If routed is running, invariably it
deletes my default route :o(

So, my questions are:

1. How do I tell routed to leave my default route alone? Is
   it with a command option, or perhaps something in a
   conf file?

2. Why do I need routed? ( Currently I'm running without it. )

3. If I *do* need some kind of routing daemon, is gated a
   better choice?

Thanks in advance,

Please reply via email if possible

Cheers,

Andrew

( Opinions are my own... not those any employer past or present. )

2. Script to limit access to a program

3. DIP patch (dynamic IP address trapping, route 'default' option)

4. caching only dns & forwarders

5. Routing to two ISP's instead of one: what replaces default route?

6. how to limit memory usage of IO system

7. FTP'ed files default to '-rw-r--r--' i need '-rw-------'

8. need help with ODBC

9. 'ping' sees route but 'telnet' doesn't??

10. X won't start: can't open default font 'fixed'

11. SLS 1.02: does 'mount' now default to 'xiafs'?

12. Making 'nobanner' Default in V.3.2 'lp'

13. TERM-compiled 'routed' or 'gated'