3

This question already has an answer here:

I use /etc/hosts to define names to local addresses in the network, so I can type ssh user@raspberry instead of ssh user@192.168.0.5.

It works very well for a single machine, but now I need to replicate to many machines. So naturally, a central name server in the server is a better approach, so I configure the machine once and the changes are all made in the server.

The question is: Whats the better way to implement this? I want to to keep it simple, just like using the hosts file, and something like BIND seems to be a little overwhelming. And what the pros and cons of a certain approach?

marked as duplicate by Gilles, Scott, Stephen Harris, Julie Pelletier, Anthon Aug 25 '16 at 4:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Install unbound, bind it to the local interface on your server, and configure all machines to use it. It's a good DNS cache, and it can also act as an authoritative server for your local network. Nor particularly simple, but still a whole lot simpler than bind. – Satō Katsura Aug 24 '16 at 19:13
  • Why not install a web panel? Those usually have a very simple DNS configuration interface. – Julie Pelletier Aug 25 '16 at 4:14
5

Dnsmasq will serve up the data in your /etc/hosts file as a dns server - authoritative for your lical domain and providing caching for internet lookups. It also provides a dhcp server.

2

For ssh(1) you would create ~/.ssh/config

host raspberry
  hostname 192.168.0.5
  user user

Then you can just do ssh raspberry

Of course, DNS is the solution for central host database, that is exactly it's function! You don't have to use bind if that sounds too frightening, there are smaller servers like dnsmasq which could do it more easily.

Not the answer you're looking for? Browse other questions tagged or ask your own question.