1

I have a domain example.com, and subdomains a.example.com and b.example.com on a production server.

I also have a development server dev.example.com, with subdomains a.dev.example.com and b.dev.example.com.

Both of these servers are running their own DNS.

Is there a way to setup DNS so all dev.example.com and *.dev.example.com entries are located and configured on the dev.example.com DNS?

Basically, I want all of the subdomain lookups to go to my development server. This way I don't have to log onto a separate server to manage DNS for my development box.

  • I don't think you can without programming. You want to resolve *.dev.example.com ---> *.example.com Alias can solve but is an static solution. I think you're looking for a dynamic solution right? – Oscar Perez Mar 16 '16 at 5:44
  • 2
    If not, how could "google.com" go on a different server from "serverfault.com"? Wouldn't they both have to be on the ones that handle "com"? – David Schwartz Mar 16 '16 at 6:27
4

The other answer made the assumption that:

You want to resolve *.dev.example.com ---> *.example.com

But that's not how your question seems to read. It sounds to me like you want to delegate control over the dev.example.com domain to your own machine. If that's the case, then the delegation is easy:

  • On whatever machine is your nameserver for example.com, you'd add an NS record that says your dev machine is the nameserver for dev.example.com
  • You'd also add a glue record, an A record giving the IP of your dev machine.

In your case, if this is Bind, you'd have something like this on the nameserver for example.com:

$ORIGIN dev.example.com.
@             IN      NS     dev.example.com.
dev           IN      A      1.2.3.4 

And then on your dev machine you'd set up Bind to be authoritative for dev.example.com (You're on your own for this part, but it's straightforward.)

  • Yes, this is exactly what I was looking for. I'm not sure why my question got voted down so much. Did I say something wrong? – muncherelli Mar 18 '16 at 3:01
  • @muncherelli The downvotes might be because it wasn't completely clear what you wanted to do. I thought it sounded like you wanted to delegate nameserving to your dev machine and answered that. – Ward Mar 18 '16 at 3:07
  • I did not downvote the question, but I might have on the basis not only that it's unclear but on the basis that questions are supposed to demonstrate basic understanding of the subject matter, and both subdomain delegation and wildcard IPs are really very basic functions of DNS. – Law29 Mar 18 '16 at 4:51
  • I didn't know I needed to prove my basic understanding of DNS to ask a question. I've been making websites for over 15 years and I've never done this before. – muncherelli Apr 1 '16 at 13:35
4

Yes, without a problem, this is one of the basic functions of DNS.

On the DNS server for example.com, you define the IP for dev.example.com, and that the NS for dev.example.com is dev.example.com, and on dev.example.com you define all the sub-names of dev.example.com.

  • This was a great answer too, gave the point to @Ward due to more explanation. – muncherelli Mar 18 '16 at 3:11
0

If I understand correctly your use case, you might have some luck in setting up a local DNS with PowerDNS and it's recursor functionality https://www.powerdns.com/recursor.html

You can then use the forward-zones to delegate the resolution to various zones see the (not so great) documentation : https://doc.powerdns.com/md/recursor/settings/#forward-zones

I've heard good things about UnboundDNS https://unbound.net/ which should be able to provide solutions for this scenario too.

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.