With the vyos-hostsd and template for resolv.conf, nameservers received via DHCP will be added to the resolv.conf only if an interface is listed in the set system name-server option.
This is good for normal usage, but exist situations when a CLI configuration is not available or a nameserver should be used regardless of what contains CLI config. The first case that we met is deploying in clouds that use a DNS name for Meta-Data (for example, Google Cloud, Equinix Metal). Since a Meta-Data should be fetched before a config will be available, this causes the impossibility of doing this, because of missed nameservers in the resolv.conf.
We need to guarantee that Cloud-Init and other tools can use nameservers during the early boot stage.
The most logical solution for this seems to be having two modes for dhclient:
- The current one - configuring via vyos-hostsd.
- The fallback - when vyos-hostsd is not available, use the original way to configure resolv.conf,
Additionally, we need to be sure that vyos-hostsd is not started before services like Cloud-Init, otherwise, this will conflict with the set system name-server option.