I plan on standardizing host naming conventions and want to setup an "internal" network to allow easy communication between different servers. We purchase servers from multiple different dedicated server providers that aren't physically connected to the same local network. Currently when configuring web servers etc. we use each machines IP address. I wish to replace this with hostnames like "db1-fr.internalnet" to simplify things and to make things easily understandable. What is the best way to handle Name resolution on each machine? I'm currently planning on just plonking entries in the hosts file for each server however maintainability-wise this seems pretty low on the scale. I want to try and avoid hosting a full blown DNS server simply for internal network lookups but if that is the recommended way it is certainly an option. My next question would then be, where is the appropriate place to configure this DNS server? If I replace the server wide DNS servers things will start to break. Is there a certain config file for local lookups?


if your happy to use a production domain then you could run DNSMasq on your internal network and have all your servers use it as there caching resolver

this has 2 benefits

  1. Speed Up DNS resolution accross your internal network due to caching results locally
  2. Ability to use DNSMasq's alias config command to change DNS results on the fly

to give a bit more info about point 2 above from the dnsmasq example config:

# If you want to fix up DNS results from upstream servers, use the
# alias option. This only works for IPv4.
# This alias makes a result of appear as
# and this maps 1.2.3.x to 5.6.7.x
# and this maps> to>

basically this means that if you ever do a DNS lookup for an address that normally returns IP in DNS it will rewrite it on the fly to return

replace that for your external IP to internal IP mapping and then your on to a winner

the alternative if you want to use an "internal only zone" would again be to use DNSmasq and the hosts file on the dnsmasq server to define your internal DNS records, dnsmasq uses your hosts file and its configured external resolvers to return DNS results to its clients (with hosts file taking priority by default) just like if you were to add the records to the hosts file on each box but only having to do it in a single location

Just remember to reload/restart dnsmasq when you make changes to the hosts file on that machine

  • And what would be the recommended way to set it up? As the primary DNS server on each machine? What if the machine goes down, how would each machine "fallback"? Jan 30 '14 at 6:09
  • can set it up however you like - most internal networks generally only have 1 resolver anyway.... you can offer it via DHCP or manually configure it per machine. if you want failback just setup a second dnsmasq instance with an identical config Jan 30 '14 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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