Register DHCP hostnames with DNS forwarder


#1

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.


#2

This is no supported at this time


#3

Thanks for the prompt reply!


#4

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?


#5

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


#6

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


#7

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 https://downloads.vyos.io/?dir=rolling/current/amd64


#8

See
on-dhcp-event.sh - https://github.com/vyos/vyatta-cfg-dhcp-server/blob/ba5569c069bd5b0e67a23c6bdc363916beaeefe3/scripts/system/on-dhcp-event.sh
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


#9

Domain name can be set with

set system domain-name xyz

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


#10

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 127.0.0.1 which makes no sense :wink:


#11

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.