misc/106902: Suggest, setting nameservers in rc.conf

Doug Barton dougb at FreeBSD.org
Wed Dec 20 12:20:06 PST 2006


[LoN]Kamikaze wrote:
> Doug Barton wrote:
>> Synopsis: Suggest, setting nameservers in rc.conf
>>
>  > I don't see this as a generally useful idea, but perhaps you
>> can say more about the conditions under which your resolv.conf
>> changes, and why you need to rewrite it at boot time?
>>
>> Thanks,
>>
>> Doug
> 
> While taking it around to other places I connect to different networks via wireless, so my rc.conf gets changed often by dhclient and vpnc. But at home I prefer to use cable LAN and there's no DHCP server running (it's a static network, no need for that). I can set the IP/subnet and the gateway in rc.conf, but I have to get the nameserver into the resolv.conf and there's simply not a convenient way to do this.
> If I'd make it read only, I wouldn't be able to use wireless any more. And I like the idea of having the network configuration in one place (rc.conf).
> Even if I want to reset it on runtime I only have to type
> # rcstart resolv
> (I'm using sysutils/bsdadminscripts), so for me it's a really just the most convenient way to reset the resolv.conf.
> 

If someone else chimes in and says, "Yes, that sounds like a really
useful idea that I can see XYZ applications for" then I'd be likely to
say let's go ahead and add it.

Meanwhile, I have a similar situation, and what I do to fix it is use
an /etc/rc.local script that looks like this:

#!/bin/sh
PATH=/bin:/usr/bin:/sbin
export PATH
for ip in `ifconfig | awk '/inet / {print $2}'`; do
        case "${ip}" in
        127.0.0.1|0.0.0.0) ;;
        <my home network>.*)	Do a bunch of stuff ;;
	*)			Do other stuff ;;
	esac
done
exit 0

I obviously think rc.d is a great tool, but I don't think trying to
shoehorn every system administration problem into it is a good idea.

hth,

Doug

-- 

    This .signature sanitized for your protection


More information about the freebsd-rc mailing list