Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2002 15:19:39 +0200
From:      Ruslan Ermilov <ru@FreeBSD.ORG>
To:        Bill Moran <wmoran@potentialtech.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: default route disappears
Message-ID:  <20020227131939.GJ30220@sunbay.com>
In-Reply-To: <02022510085801.00731@proxy.pt.com>
References:  <02022510085801.00731@proxy.pt.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 25, 2002 at 10:08:58AM -0500, Bill Moran wrote:
> I have a FreeBSD 4.4 machine acting as a gateway and
> occasionally the default route will disappear.
> 
> The machine has two network cards and is running vtund
> to create a vpn across the external interface.  This vpn
> is where the default route goes (to an upstream gateway)
> Thus:
> xl0 = 10.1.1.1 (external)
> fxp0 = 192.168.43.254 (internal)
> tun0 = 172.16.0.2 -> 172.16.0.1 (vtund created interface)
> 
> netstat -r shows:
> Routing tables
>  
> Internet:
> Destination        Gateway            Flags    Refs      Use  Netif Expire
> default            172.16.0.1         UGSc        6     1162   tun0
> 10.1.1/24          link#2             UC          1        0    xl0
> 10.1.1.200         0:60:8:bd:1d:3e    UHLW        2   321886    xl0   1121
> 172.16.0.1         172.16.0.2         UH          9      225   tun0
> 192.168.43         link#1             UC         12        0   fxp0
> 192.168.43.2       0:2:b3:62:6f:7d    UHLW        1       67   fxp0   1137
> <SNIPPED additional unrelated routes>
> 
> Occasionally, the default route will simply disappear.  I have
> yet to see anything in /var/log/messages indicating why this
> happens and my best guess is this:  The external interface
> connects across a long-distance wireless connection and
> I'm assuming that occasionally the connection is lost for
> short periods of time (due to any number of factors) and
> the vtun goes down, thus the route to 172.16.0.1 disappears
> (when tun0 goes down).  Since vtund is set to automatically
> reconnect, as soon as the wireless becomes available again,
> the interface comes back up, and the route to 172.16.0.1
> reappears.  However, at some point the default route was lost.
> 
Here's the part of the relevant commit log:

: netinet/in.c, netinet/in_rmx.c:
: 
:   When address is removed from an interface, also delete all routes that
:   point to this interface and address.  Previously, for example, if you
:   changed the address on an interface, outgoing IP datagrams might still
:   use the old address.  The only solution was to delete and re-add some
:   routes.  (The problem is easily observed with the route(8) command.)
:   Note, that if the socket was already bound to the local address before
:   this address is removed, new datagrams generated from this socket will
:   still be sent from the old address.
: 
: PR:             kern/20785, kern/21914

> I tried adding a statement to add the default route when the
> vtund reconnects but it doesn't seem to work.  Why does
> the default route disappear?  How can I add it in such a way
> that it will not disappear?
> 
There's no way to make "sticky" routes.  You can, however, emulate
the "sticky default route" with the ipfw(8)'s "fwd" option.
Otherwise, you will have to run a daemon that gets notified (through
a route(4) interface) about interface configuration changes, and
reinstalls the default route, similar to how it's already done by
ppp(8).


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020227131939.GJ30220>