I want to set up a DNS server on my network. I want to keep it simple and just use $(hostname -s).catpants.lan as the DNS entry for each system on my network. Internal DNS only.

Is there a way I can make each of my systems automatically tell the DNS server their hostname and IP? Or do I have to edit a config on my DNS server every time I spin up a new vm? Is there a name for this particular way of doing DNS?

To keep it simple, all systems on my network are running Linux.

  • DHCP might be worth a look, but I'm actually not sure in which direction the hostname info flows. Oct 23, 2015 at 21:13
  • I believe there are clients that will do dynamic DNS for nameservers like BIND, but I don't know much about that. You might be interested in AVAHI. It's an auto host-name advertising service that runs on your local network. When setup, it Just Works. It's also built into MacOS, and there's a simple Windows client available from Apple to bring the third OS into the mix. If you install avahi-daemon, you should soon be able to ssh machinea from machineb, and vice versa.
    – Paul
    Oct 23, 2015 at 21:18

1 Answer 1


If you use the ISC DHCP client (dhcp-client on Debian, Ubuntu, etc.) then you most definitely can set the hostname via /etc/dhcp/dhclient.conf. On recent versions, this is accomplished by:

    send host-name = gethostname();

On earlier versions, you had to hardcode the hostname in the directive.

I'm not so sure about setting the IP address through the DHCP lease process, but there is a "fixed-address" directive in the dhclient.conf which would appear to do what you want. See the dhclient.conf manpage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .