How is /etc/resolv.conf updated?

Hi all,

I'm trying to comprehend how FreeBSD updates /etc/resolv.conf. Upon boot my interface gets an IP from the DHCP server, but resolv.conf remains missing. Running dhclient vxm0 gets an IP, but does not populate the various kenv variables that /etc/rc.d/resolv uses.

Does anyone know what chain of events sets up /etc/resolv.conf? Who sets the kenv variables? TIA.

OS: FreeBSD 13.1-RELEASE.

/etc/rc.d is:
Code:
hostname="host.example.com"
ifconfig_vmx0="DHCP"
sshd_enable="YES"
ntpdate_enable="YES"
dumpdev="AUTO"
 
resolvconf(8).
/sbin/dhclient-script will use it (or directly update resolv.conf if it is disabled) to add DNS configuration obtained from DHCP.

Thanks. So should dhclient call dhclient-script? dhclient() mentions dhclient-script only in the SEE ALSO section, nowhere else.

Running dhclient under truss shows no sign of dhclient calling dhclient-script.

Given my rc.conf on a fresh install of FreeBSD, would you expect resolv.conf to be populated?

Thanks,
Scott
 
Yes, it's the default script if nothing else is configured, see https://cgit.freebsd.org/src/tree/sbin/dhclient/clparse.c?h=releng/13.1#n54

So, I'd bet either your dhclient has some special configuration, or your DHCP server doesn't offer nameservers...

Thanks. My current thinking is that an earlier invocation of local_unbound created resolvconf.conf which, although I subsequently disabled local_unbound, prevented the creation/update of resolv.conf. So I deleted it.

Now if I delete resolv.conf and dhclient.leases.* and reboot the resolv.conf gets created and correctly populated.

The only niggling thing I have is that if I delete resolv.conf and dhclient.leases.* and restart dhclient (without rebooting) dhclient gets a lease, creates the leases file, but still does not create resolv.conf. However a reboot restores it. Any thoughts as to why?

The lease offer definitely contains domain information.
 
Back
Top