From owner-freebsd-questions@FreeBSD.ORG Tue Aug 5 02:38:54 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2038137B404 for ; Tue, 5 Aug 2003 02:38:54 -0700 (PDT) Received: from gregale.emea.mci.com (gregale.wcom.co.uk [193.131.254.138]) by mx1.FreeBSD.org (Postfix) with ESMTP id 86D0643F75 for ; Tue, 5 Aug 2003 02:38:52 -0700 (PDT) (envelope-from philip.payne@uk.mci.com) Received: from breen ([166.59.191.248] helo=breen.emea.mci.com) by gregale.emea.mci.com with esmtp (Exim 4.12) id 19jyH8-0005NG-00; Tue, 05 Aug 2003 10:38:38 +0100 Received: from [62.191.1.65] (helo=ukcamgate1.cbg.uk.corp.eu.uu.net) by breen.emea.mci.com with esmtp (Exim 4.14) id 19jyH8-0004Aw-4F; Tue, 05 Aug 2003 09:38:38 +0000 Received: by ukcamgate1.cbg.uk.corp.eu.uu.net with Internet Mail Service (5.5.2653.19) id ; Tue, 5 Aug 2003 10:38:21 +0100 Message-ID: <36D04A8168B2D41182250008C7E6F8780374F9F8@ukcamexch2.cbg.uk.corp.eu.uu.net> From: Philip Payne To: 'Ezra Banoba' , freebsd-questions@freebsd.org Date: Tue, 5 Aug 2003 10:38:14 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Score: -3.2 (---) X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *19jyH8-0005NG-00*CA5vQyh4zXk* Subject: RE: backup static routes for freebsd (default) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2003 09:38:54 -0000 Hi, > I have a gatway box running freebsd 4.8 and several links to > the internet > via different ISP's. > This box is connected directly to one of the ISP's but also > has access to > the other gatways via the LAN. > I would like to setup static backup (default) routes such > that when and if > the main link goes down, the default route for this box is > automatically > changed to point to another router on the LAN.I am having trouble > implementing this on freebsd. > Any ideas? First, I'm more of a router person than familiar with how FreeBSD calculates it's routing table so the following is all guesswork from "man route". The issue with static routes is that they rarely have any idea of the status of their destination but this can be fudged if you're using point-to-point interfaces e.g. DSL, leased line. In general terms what you'd be doing on a router is: 1) Have a default route directed out a point-to-point interface connected to the ISP (not the IP address) so that when the interface is down, the static route is removed from the live routing table. 2) Have a weighted default route via an alternative IP address. The weight implies this route is only used when the former default route is not available. I've read "man route" and I get the impression you can add a route via an interface rather than a destination with the switch "-interface" so your first step is to add a default route along the lines > route add default -interface ... this is a guess as the man page isn't explicit. Also, I don't know whether this route remains live or is removed as required during a failure on the point-to-point interface you'd configure this to. It definitely won't work if your primary access method is a broadcast interface e.g. ethernet. Further, I can't find any details on adding a weight to a static route to create the secondary route so I'm not sure this is going to be possible via an automatic routing table kind of thing. So.....(getting to the point very slowly) The only other method I can think of would be a script to ping the far end addresses regularly in order. Depending on which one is up, you could inject a default route statement as required to the correct destination. I'd be interested in other suggestions as this doesn't sound entirely great as there are many other reasons than link failure why an address wouldn't be pingable. Thanks, Phil.