From owner-freebsd-net@FreeBSD.ORG Tue Nov 23 16:28:03 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C3DF106566C for ; Tue, 23 Nov 2010 16:28:03 +0000 (UTC) (envelope-from i@levsha.me) Received: from expo.ukrweb.net (mail.univua.net [91.202.128.78]) by mx1.freebsd.org (Postfix) with ESMTP id C30178FC0A for ; Tue, 23 Nov 2010 16:28:02 +0000 (UTC) Received: from [91.193.166.194] (helo=laptop.levsha.me) by expo.ukrweb.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.71 (FreeBSD)) (envelope-from ) id 1PKvBL-0007Np-Vb; Tue, 23 Nov 2010 17:53:27 +0200 Received: from levsha by laptop.levsha.me with local (Exim 4.72 (FreeBSD)) (envelope-from ) id 1PKvBL-000M5z-Nc; Tue, 23 Nov 2010 17:53:23 +0200 Date: Tue, 23 Nov 2010 17:53:23 +0200 From: Mykola Dzham To: "Ronald F. Guilmette" Message-ID: <20101123155323.GA51348@laptop.levsha.me> References: <41757.1290513201@tristatelogic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41757.1290513201@tristatelogic.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: Mykola Dzham X-SA-Exim-Connect-IP: 91.193.166.194 X-SA-Exim-Mail-From: i@levsha.me X-SA-Exim-Scanned: No (on expo.ukrweb.net); SAEximRunCond expanded to false Cc: freebsd-net@freebsd.org Subject: Re: Configuring for 1 static and 1 DHCP interface ? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 16:28:03 -0000 Ronald F. Guilmette wrote: > > I just recently re-jigged my main server/workstation so that instead > of just having a single interface that talks to the Internet via a > single static IP, it now has, in addition to that, one other interface > (and card) that's talking to one of those little black&blue Linksys > router thingies to which other machines on my local network are connected > (all using DHCP which is implemented in the Linksys box). > > For most stuff the default routing should be out via the original interface > (and its static IP) but when the main server/workstation wants to talk > to anything in 192.168.1.0/24, it should instead route those packets > via the second/newer interface over to the Linksys box, i.e. so that > this main machine can talk to other stuff on the local network. > > So anyway, here's what I have now in my /etc/rc.conf file: > > defaultrouter="69.62.255.254" > network_interfaces="fxp0 rl0 lo0 auto" > ifconfig_fxp0="inet 69.62.255.118 netmask 255.255.255.0" > ifconfig_rl0="DHCP" > > This is problematic for several reasons. First, as I have learned, > having any interface set to "DHCP" in the /etc/rc.conf file causes > all sorts of DHCP magic to happen at startup time, and the end result > of all that magic is that two undesirable things happen: > > 1) The /etc/resolv.conf file gets replaced with something that > causes DNS resolutions to go someplace other than where I want > them to go, and... > > 2) the default route that I attempted to set in the /etc/rc.conf > file gets clobbered and replaced by a default route obtained > from the DHCP negotiation on the second interface. You can totally disable resolv.conf changing and rote setting: put into /etc/dhclient-enter-hooks file this code: add_new_resolv_conf() { echo "doing nothing to resolv.conf" } add_new_routes() { echo "do not set routes" } -- LEFT-(UANIC|RIPE) JID: levsha@jabber.net.ua PGP fingerprint: 1BCD 7C80 2E04 7282 C944 B0E0 7E67 619E 4E72 9280