From owner-freebsd-questions Tue Dec 11 11: 1:19 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mailgw3a.lmco.com (mailgw3a.lmco.com [192.35.35.24]) by hub.freebsd.org (Postfix) with ESMTP id B81A337B405 for ; Tue, 11 Dec 2001 11:01:04 -0800 (PST) Received: from emss01g01.ems.lmco.com ([129.197.181.54]) by mailgw3a.lmco.com (8.8.8/8.8.8) with ESMTP id OAA15102 for ; Tue, 11 Dec 2001 14:00:59 -0500 (EST) Received: from CONVERSION-DAEMON by lmco.com (PMDF V5.2-33 #38886) id <0GO7003010TI54@lmco.com> for freebsd-questions@freebsd.org; Tue, 11 Dec 2001 11:00:54 -0800 (PST) Received: from cui1.lmms.lmco.com ([129.197.1.64]) by lmco.com (PMDF V5.2-33 #38886) with ESMTP id <0GO70055W0TD85@lmco.com> for freebsd-questions@freebsd.org; Tue, 11 Dec 2001 11:00:49 -0800 (PST) Received: from lmco.com (CONNECTICUT1.lmms.lmco.com [129.197.23.84]) by cui1.lmms.lmco.com (8.11.0/8.9.2) with ESMTP id fBBJ0n615564 for ; Tue, 11 Dec 2001 11:00:49 -0800 (PST) Date: Tue, 11 Dec 2001 11:01:00 -0800 From: rick norman Subject: Re: IP aliases & routes To: freebsd-questions@freebsd.org Message-id: <3C1657EC.B61347ED@lmco.com> MIME-version: 1.0 X-Mailer: Mozilla 4.77 [en] (WinNT; U) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Accept-Language: en 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 A default route is just that, a default, there can't be two. There can be different gateways for different subnets though. Your description sounds like a single subnet with two ip addrs on it. 10.1.1/24 is the subnet and .2 and .3 are the addrs. Why not use 10.1.1/24 and 10.1.2/24 ? Rick 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). > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message