I have some machines on a network. This network has a DHCP server - which I have no control over, and no DNS server, i.e. the DHCP lease refer you to some ISP's server and do not serve IPs for local machine names. I plan to install a dnsmasq to address this issue. However, the machine I'll install the dnsmasq on itself gets its IP via DHCP. Thus, I need other machines to determine, dynamically, what the dnsmasq machine's IP address is.
The solution I thought of is using a DHCP client to get a lease from this dnsmasq server. Now, I can think of two ways this can work:
- Each macine M gets its IP from the main DHCP server; on interface up, they run another instance of a DHCP client, this time restricted to making some request, and this is answered by the dnsmasq server. M then take the lease we obtained, not updating the IP, but writing the DHCP to /etc/resolv.conf
- Each macine M only uses a DHCP client once, getting a response from the dnsmasq machine; that machine will also run a DHCP proxy, but when returning the reply from the original DHCP server, it will (a) rewrite the lease with itself as the DNS server and (b) write down that M (identified by a MAC) gets some IP x.y.z.w . Assuming it has a MAC-to-name table, this could then dynamically feed the DHCP server.
Are there packages doing this? Is it at all advisable? Which of the two options is better, in your opinion?
Note: Of course the reasonable thing to do in this situation is just set up a DNS centrally which is fed by the central DHCP server; or get a static IP for a DNS server, in which case you can ignore the DNS server entry of the DHCP lease you're getting. But this is not an option for reasons which are irrelevant here. It is impossible to access or control any central behavior or service, not is it possible to obtain a fixed IP address for anything.