Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I hijack a DNS entry for an domain name on Linux (Ubuntu 12.04)? I am interested in creating a DNS CNAME alias for to

The problem is the applications uses 5 domains that point to 5 different DB instances and I want them all to point to the same DB instance. I don't want to rely on /etc/hosts because the IP can change.

I tried using a DNS server for this, but it seems to be overkill in this case and introduces too much complexity to the project.

share|improve this question

closed as not a real question by Dan, TheCleaner, Scott Pack, mdpc, jscott Dec 6 '12 at 0:45

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

I've had a good think about this and tested one idea and it doesn't do what you want. Can you explain why you want to do this - what are you trying to achieve - there may be different ways to do it. – Iain Dec 5 '12 at 12:20
i have 2 read replicas for mysql on read1.domain and read2.domain. and i want only on the admin server to hijack the dns to point to master and on the frontends to remain the same – Bogdan Cosmin Dec 5 '12 at 12:32
up vote 4 down vote accepted

No, a DNS server is not overkill or complex. It's exactly what you're looking for.

Distributing a HOSTS file across systems would be more work than just setting up an internal DNS server.

share|improve this answer

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