From owner-freebsd-questions Wed Feb 27 5:21:23 2002 Delivered-To: freebsd-questions@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 5CA7637B402 for ; Wed, 27 Feb 2002 05:20:51 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g1RDJdt49546; Wed, 27 Feb 2002 15:19:39 +0200 (EET) (envelope-from ru) Date: Wed, 27 Feb 2002 15:19:39 +0200 From: Ruslan Ermilov To: Bill Moran Cc: questions@FreeBSD.ORG Subject: Re: default route disappears Message-ID: <20020227131939.GJ30220@sunbay.com> References: <02022510085801.00731@proxy.pt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02022510085801.00731@proxy.pt.com> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 > > > 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