-4

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 domain1.com to domain2.test.com.

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.

Dan
  • 15,430
  • 1
  • 36
  • 67
Bogdan Cosmin
  • 301
  • 1
  • 3
  • 10
  • 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. – user9517 Dec 05 '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 05 '12 at 12:32

1 Answers1

4

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.

pauska
  • 19,620
  • 5
  • 57
  • 75