On dhclient and resolv.conf

I just put in /etc/rc.conf the line

local_unbound_enable="YES"

and did service local_unbound start.

This put the local DNS in /etc/resolv.conf.

Nice, that it took the work for me, but I want to be conscious of what I do and do not like that the computer suppose I am stupid (Windows users like computers more intelligent than them).

Now dhclient does not write /etc/resolv.conf anymore. This is not bad only because I wanted it in this case.

My question: what happened in order that dhclient do not write /etc/resolv.conf and how to eventually reverse it.
 
IIRC, dhclient doesn't write /etc/resolv.conf directly.
This is done by resolvconf and one of the inputs is the data retrieved by dhclient.
You can create a /etc/resolvconf.conf that changes the default behavior of resolvconf.
 
My question: what happened in order that dhclient do not write /etc/resolv.conf and how to eventually reverse it.
When in doubt always check the manualpage, so man dhclient which gives you dhclient(8). This will not give you a direct answer but it does lead you do dhclient.conf(5) where you'll learn about /etc/dhclient.conf which can be used to supersede, append or prepend any given options by the DHCP server, including the required DNS servers.

So if you want to control the DHCP server's response from your client then this is the right way to go.

But if this is only about /etc/resolv.conf then yeah, you want to check resolvconf.conf(5). The advantage is that this daemon can control /etc/resolv.conf no matter what the provider is. So it doesn't matter if you're connecting using DHCP, a VPN or any other option.

If you want this behavior to be turned off so that it only relies on your local settings then all you'd need is to set the option resolvconf to no.
 
I see, FreeBSD has a complicated mechanism. But it is disturbing that configuration in /etc is done automatically only due to starting a server: it is not my configuration of the system!

Note to ShelLuser: thanks, you wrote a lot, but did not answer my question.
 
By the way, I installed once Ubuntu and deleted it immediately afterwads: for a similar behavour. In makes intrusive configurations in /etc only due to installing packages. This is perhaps good for people that come from Windows, but it is not what one expects from a good operating system.
 
I see, FreeBSD has a complicated mechanism. But it is disturbing that configuration in /etc is done automatically only due to starting a server: it is not my configuration of the system!
Correction: configuration in /etc is not done automatically. FreeBSD doesn't work this way. You're ignoring the fact that this is merely how DHCP works: you get assigned with a specific IP addresss, a specific routing and because of all that also a specific DNS resolver.

And the only way a Unix system knows how to configure a DNS resolver is through /etc/resolv.conf.

But that does not imply that it suddenly "automagically" configures stuff in /etc. All it did was what you told it to.
 
You did not read my question, and also not my posting: there I describe exactly what I did and what I got. After reading the post of Duffyx I also noted that it created a file /etc/resolvconf.conf automatically. It is your last posting the one that do not correspond to the facts.
 
When local_unbound is started, the init script automatically adjust /etc/resolv.conf to get it working right away and /etc/resolvconf.conf to make it persistent through reboots. This can be found from reading the init script local_unbound and the call it makes to a shell script local-unbound-setup. Both files are well documented to understand what happens.

When you want to revert back to default behavior, you will have to delete /etc/resolvconf.conf and execute service resolv restart (not sure about the command though) or reboot the machine. AND of course make sure local_unbound doesn't start because when the init script is executed it will modify both files again.
 
Back
Top