Which domain to register a service name with DNS-SD when domain is assigned by DHCP server?

244 views Asked by At

I want to register my device with DNS-SD and I have to register it in the domain assigned by the DHCP server. But how do I get the domain assigned by the DHCP server?

How should I know that a DHCP server has come up on the network and assigned my device new network configuration? Also if DHCP server does not assign a domain, I shall register the service in local domain.

Can I extract domain from resolv.conf?

1

There are 1 answers

0
Linville On

dhclient periodically runs a script called dhclient-script (incidentally, this is also the script that updates the domain name when using DHCP). dhclient-script will check for the existence of /etc/dhcp/dhclient-up-hooks and run it when a new lease is assigned. Put your DNS-SD registration code inside that script.

The current domain name can be retrieved using dnsdomainname.