Debian Buster dhclient v6 overwrites resolv.conf with prepend domain_name_servers

dhcp at Biblestuph.com dhcp at Biblestuph.com
Sat Sep 18 18:44:40 UTC 2021


My Debian Buster AWS instance runs two copies of dhclient 
(isc-dhclient-4.4.1), one for -4 and one for -6. I wanted to prepend my 
localhost 127.0.0.1 to the nameservers written to resolv.conf, so I 
uncommented this line in dhclient.conf:

prepend domain-name-servers 127.0.0.1;

but instead of prepending, on the first execution after boot I get 
_only_ the localhost in the resolv.conf, nothing else. It's not the 
worse thing in the world as the next RENEW rewrites it with the fully 
correct values, but it's missing some intended values until then. (And 
later RENEW6 calls won't update, see the logic snippet below.)

Troubleshooting I found that on boot the v6 instance was overwriting the 
resolv.conf written by the v4 instance; I.E., the v4 dhclient-script 
instance gets (verified by the debug hook) BOUND, new_domain_name, and 
new_domain_name_servers, the last with my 127.0.0.1 in front as I 
expect, and therefore writes the resolv.conf as expected. But then it is 
immediately followed by a BOUND6 call from the v6 instance, which _also_ 
gets new_domain_name_servers but with _only_ the localhost entry and no 
new_domain_name. As a result, this logic in dhclient-script gets tripped:

         # update /etc/resolv.conf
         if [ "${reason}" = BOUND6 ] ||
            [ "${new_dhcp6_name_servers}" != "${old_dhcp6_name_servers}" 
] ||
            [ "${new_dhcp6_domain_search}" != 
"${old_dhcp6_domain_search}" ]; then
             make_resolv_conf
         fi

and make_resolv_conf rewrites per this logic:

     # DHCPv4
     if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
        [ -n "$new_domain_name_servers" ]; then

So ... is this a known issue, and/or is there a graceful work around?

Thank you!

Dan


More information about the dhcp-users mailing list