From owner-freebsd-questions Wed Dec 12 0:22: 9 2001 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 0D43537B417 for ; Wed, 12 Dec 2001 00:21:54 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id fBC8KOM16495; Wed, 12 Dec 2001 10:20:24 +0200 (EET) (envelope-from ru) Date: Wed, 12 Dec 2001 10:20:24 +0200 From: Ruslan Ermilov To: freebsd-questions@jrv.org Cc: questions@FreeBSD.org Subject: Re: IP aliases & routes Message-ID: <20011212102024.G11552@sunbay.com> References: <200112110318.fBB3IdOu010791@bigtex.jrv.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200112110318.fBB3IdOu010791@bigtex.jrv.org> User-Agent: Mutt/1.3.23i 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, Dec 10, 2001 at 09:18:39PM -0600, freebsd-questions@jrv.org wrote: > I have a FreeBSD server on an Ethernet with two gateways to the > outside world. I would like to use gateway A for upstream HTTP > traffic from squid and gateway B for everything else. In other words, > the default route should point to B, except for the squid's upstream > socket, which should use A. > > What I did was create a new private subnet (10.1.1/24) that both the > server and gateway A can access via an IP alias. Squid is told to use > 10.1.1.3 as its upstream address. Other applications use the normal > IP address. The idea is that one subnet uses gateway A as the default > gateway and the other subnet uses gateway B and that choosing the > address of outbound socket via bind(2) chooses how that application > reaches the Internet. > > The question is how to tell the FreeBSD (4.4-stable) server that > gateway A can be used as a default route for 10.1.1/24. There is > already a default route for the normal IP address and I can't seem to > get the route command to let me create a default route for the alias > to use: > > $ route add default 10.1.1.2 > route: writing to routing socket: File exists > add net default: gateway 10.1.1.2: File exists. > > How do I add this second default route? There is no conflict between > the two defaults: every possible local IP address belongs to only of > the two subnets (and can match only one default). > You can do this with IPFIREWALL_FORWARD feature. Cheers, -- Ruslan Ermilov Oracle Developer/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