Register DHCP hostnames with DNS forwarder

How can I make it so that hostnames supplied by machines using the DHCP server are registered with the DNS forwarder? So that they can be resolved by other systems on the LAN.


This is no supported at this time

Thanks for the prompt reply!

Is it by now or what could be done to achieve this?

Could VyOS talk to an external DNS server and update it with dhcp leases/mappings?

i think in current rolling it’s supported but may require testing

Cool! I’m on rolling. How could I test it?

nope, my bad, still not possible
but now i think we can implement this
let me investigate on that

you can try rolling from here

1 Like

See -
looks like it already adds records to hosts file
and dns forwarder should serve them just fine

I think what is missing is way to configure domain

Domain name can be set with

set system domain-name xyz

It could/should take it from there as a start?

Hmm it doesn’t add records to /etc/hosts here on VyOS 1.2.0-rolling+201807050337

But it does seem to expose /etc/hosts records via DNS to clients resulting in

ping vyos.domain

from another host, pinging which makes no sense :wink:

Indeed it works! :tada::confetti_ball: :smiley:

It has to be enabled manually though, even if cli completion claims this is the default setting?
“enable Enable updating /etc/host file (default)”

set service dhcp-server hostfile-update enable

Then /etc/hosts gets updated and distributed via dns so all machines have it.

The domain though is not being added only the hostname, as you suspected.

This doesn’t seem to work for me on VyOS 1.3-rolling-202009070118 .

I’ve set

set service dhcp-server hostfile-update


> vyos@vyos:~$ cat /etc/hosts
> ### Autogenerated by VyOS ###
> ### Do not edit, your changes will get overwritten ###
> # Local host
>       localhost
> vyos
> # The following lines are desirable for IPv6 capable hosts
> ::1             localhost ip6-localhost ip6-loopback
> fe00::0         ip6-localnet
> ff00::0         ip6-mcastprefix
> ff02::1         ip6-allnodes
> ff02::2         ip6-allrouters

I assume I should have a line like:

# From DHCP and "system static host-mapping"
vyos@vyos# show service dhcp-server
 shared-network-name management_vyos {
     subnet {
         lease 86400
         range 0 {
         static-mapping vm-ansible {
             mac-address 0a:d4:d5:5b:2d:94