Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Nov 2010 12:52:52 -0800
From:      "Ronald F. Guilmette" <rfg@tristatelogic.com>
To:        freebsd-net@freebsd.org
Subject:   Re: Configuring for 1 static and 1 DHCP interface ? 
Message-ID:  <45858.1290545572@tristatelogic.com>
In-Reply-To: <20101123155323.GA51348@laptop.levsha.me> 

next in thread | previous in thread | raw e-mail | index | archive | help

In message <20101123155323.GA51348@laptop.levsha.me>, 
Mykola Dzham <i@levsha.me> 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?

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.

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?


Regards,
rfg


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?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45858.1290545572>