From owner-freebsd-net@FreeBSD.ORG Tue Nov 23 21:21:59 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 C8A5410657C2 for ; Tue, 23 Nov 2010 21:21:59 +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 1FC5A8FC18 for ; Tue, 23 Nov 2010 21:21:58 +0000 (UTC) Received: from [95.135.77.208] (helo=laptop.levsha.me) by expo.ukrweb.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.71 (FreeBSD)) (envelope-from ) id 1PL0JH-000CQP-1m for freebsd-net@freebsd.org; Tue, 23 Nov 2010 23:21:58 +0200 Received: from levsha by laptop.levsha.me with local (Exim 4.72 (FreeBSD)) (envelope-from ) id 1PL0JB-0001vn-95 for freebsd-net@freebsd.org; Tue, 23 Nov 2010 23:21:49 +0200 Date: Tue, 23 Nov 2010 23:21:49 +0200 From: Mykola Dzham To: freebsd-net@freebsd.org Message-ID: <20101123212148.GB4910@laptop.levsha.me> References: <20101123155323.GA51348@laptop.levsha.me> <45858.1290545572@tristatelogic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45858.1290545572@tristatelogic.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: Mykola Dzham X-SA-Exim-Connect-IP: 95.135.77.208 X-SA-Exim-Mail-From: i@levsha.me X-SA-Exim-Scanned: No (on expo.ukrweb.net); SAEximRunCond expanded to false X-Spam-Level: -- X-Spam-Report: 1.1 DNS_FROM_OPENWHOIS RBL: Envelope sender listed in bl.open-whois.org. -1.8 ALL_TRUSTED Passed through trusted hosts only via SMTP -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] 1.3 AWL AWL: From: address is in the auto white-list 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 21:22:00 -0000 Ronald F. Guilmette wrote: > > In message <20101123155323.GA51348@laptop.levsha.me>, > Mykola Dzham wrote: > > > Ronald F. Guilmette wrote: > >> 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" > >} > > Wow! This is _very_ interesting! How did you know to even suggest this? > I mean are these things documented on some man page that I mised? dhclient-enter-hooks referred in dhclient-script(8), functions add_new_resolv_conf() and add_new_routes() found on /sbin/dhclient-script (this is shell script) > Well, anyway, that first part sure sounds like a perfect fix for the > first of the two issues I described. But as regards to that second > part, maybe that's doing a but more than what I want. > > I don't want the DHCP stuff to set -no- routes at all... I still do > want it to create a route to 192.168.1.0/24. I just don't want it > make any change to the default route that would otherwise be set, > you know, as a result of the defaultrouter= statement in my /etc/rc.conf > file. 192.168.1.0/24 is interface route. This route installed by ifconfig. dhclient-script does not install this route manually. So, replacing add_new_routes() function not affect on 192.168.1.0/24 route. dhclient-enter-hooks file used only by /sbin/dhclient-script , and dhclient-script used only by dhclient. So, this is not affect to settings, set on /etc/rc.conf > So is there a nice clean & simple way to get the DHCP stuff to only > create just that route to 192.168.1.0/24 , while leaving the default > route alone? Can you try my variant? > P.S. Oh yea... and one other question... at the top of this new > /etc/dhclient-enter-hooks file, should I be putting "#!/bin/sh" ? > Is that OK? Is it needed? That is ok, but not needed: file sourced into /sbin/dhclient-script using ``.'' command -- LEFT-(UANIC|RIPE) JID: levsha@jabber.net.ua PGP fingerprint: 1BCD 7C80 2E04 7282 C944 B0E0 7E67 619E 4E72 9280