1

I checked this question, but it does not solve my issue.

I'm using BIND on Debian Jessie, and I am the authoritative person for subdomain.example.com. I have a new subdomain that I want to point to, subdomain2.example.com. I am not figuring this issue out.

I want subdomain2.example.com to point to an IP address, but I do not have control over example.com's name servers. I want to make the change locally, so we can setup the site before making it go live to the rest of the world. How can I do this when I don't have that zone yet?

Canadian Luke
  • 885
  • 15
  • 44
  • 1
    Just add an entry to the etc/hosts file for subdomain2.example.com on the client machines that need to test this. – Clayton Aug 04 '16 at 19:33
  • I'm wanting to do this on a large scale, just for this site. It would not be a good use of my time touching each machine that needs this setting. Can it be done in BIND? – Canadian Luke Aug 04 '16 at 19:54

1 Answers1

3

You can't add entries for other domains to your existing zone, that will generate an warning/error message in Bind for your zone file regarding out-of-zone data:

subdomain.example.com.:line-#: ignoring out-of-zone data (subdomain2.example.com.)

But you don't have to be the actual owner of a domain or zone to make your own name server act authoritative for it. That is not best practice, but since it will only affect your own users, it won't break the internet for anyone else either.

Simply create an additional zone for subdomain2.example.com. and set up the A (and any other records) with the ip-address you want.

dmourati
  • 25,540
  • 2
  • 42
  • 72
HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • OK, that was what I was looking for - either a "No, it can't be done", or a "Here's how". You answered both – Canadian Luke Aug 04 '16 at 20:31
  • 1
    Alternatively, to override specific records without having to steal authority for entire zones, consider investigating BIND's [RPZ feature](http://serverfault.com/q/618106/152073). – Andrew B Aug 04 '16 at 22:29
  • Now that's a nice feature I wasn't aware of @AndrewB – HBruijn Aug 04 '16 at 22:37