Configuring for 1 static and 1 DHCP interface ?
Ronald F. Guilmette
rfg at tristatelogic.com
Tue Nov 23 20:52:52 UTC 2010
In message <20101123155323.GA51348 at laptop.levsha.me>,
Mykola Dzham <i at 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?
More information about the freebsd-net
mailing list