-1

In a lot of documentation I've seen recently, servers are referred to by internal hostnames, such as production-1, production-2, db-1. I realize I can associate these names in the hosts file on the server, but this would obviously mean maintaining a host file for multiple servers, which for anything greater than 2 or 3 would get unwieldy.

Is there some simple way people manage common hostnames across multiple servers and keep them in sync, without having to edit multiple files every time?

Dan
  • 161
  • 3
  • 5
    I'm not sure what you're asking... is the answer "use a DNS server?" – HopelessN00b Aug 31 '12 at 17:53
  • DNS, NetBIOS, WINS, plenty of options. Would help immensely if you could tell us if you're running a domain (Windows/*NIX), etc. – gravyface Aug 31 '12 at 17:54
  • All of my servers are running Ubuntu 12.04. – Dan Aug 31 '12 at 17:58
  • @Dan That's... well, that doesn't really help clarify what you're asking, though. – HopelessN00b Aug 31 '12 at 18:03
  • The question is *tagged* as DNS. He's just surprised it's even a question because that's the answer. (I'm guessing, any way.) – Aaron Copley Aug 31 '12 at 18:34
  • @AaronCopley Yeah, that's about the size of it. I wasn't sure if the question `was do I use a DNS server?`, or... `how do I rename a bunch of servers?`, or `how do I use the same common hostname across a bunch of servers?`, or whatever else. – HopelessN00b Aug 31 '12 at 19:11

1 Answers1

4

You'll want a DNS server. DNSMasq is quite easy to use and is in the apt repository on Ubuntu (apt-get install dnsmasq) and believe it's an option during the install you can check off.

It will also do DHCP and will append hostnames to your DNS suffix (i.e. yourcompany.local or whatever) when leases are obtained, so helpful for workstations too.

Obviously you'll need to set all your servers/machines on your network to use the IP of the server you choose to run DNSMasq. It started life as a caching DNS forwarder, and does a very good job of that, but you can do things like use the server directive to specify forwarders for specific domains (i.e. if you have a corporate DNS server that's authoritative for some other domain i.e. for resolving requests over VPN, etc.).

You also need to specify upstream DNS servers: Google Public DNS (8.8.8.8/8.8.4.4), OpenDNS (208.67.222.222/208.67.220.220), your ISP's DNS servers, or perhaps your router; basically whatever you use now is likely fine.

The docs and dnsmasq.conf are quite easy to follow; should be fairly straightforward to setup.

gravyface
  • 13,957
  • 19
  • 68
  • 100