3

I'd like to create a sub-domain, like sub.example.com.

I have already configured example.com with NS "glue" records to point to the DNS server which will manage the sub-domain. They look like:

sub    IN    NS    other.dns.server.example.com.

Where do I put the A record for sub.example.com? Do I put it on the DNS server for example.com like:

sub    IN    A    192.168.0.1

Or do I put it in the DNS server for the sub-domain (in my example, other.dns.server.example.com), like:

@      IN    A    192.168.0.1

Or should I put it in both?

I've tried different combinations already, but I want to know what the right way to do it is.

Christopher
  • 133
  • 1
  • 6
  • Have you tried to solve this on your own? – gxx Jul 14 '16 at 23:12
  • @gf_ Yes. I've tried various combinations. Right now, I have it in the sub-domain's zone only, and that *seems* to work (but with caching... I don't know if it will continue to work). Regardless of what I've tried, and even regardless of "what works", I'm trying to figure out the *right* way to do it, preferably with a citation to an authority on the matter. – Christopher Jul 14 '16 at 23:14
  • Great! Please put these information into your question. – gxx Jul 14 '16 at 23:15
  • @gf_ I think you're being a bit too pedantic. By asking the question on SE network, it is implied that one is looking for an authoritative answer. The question was phrased about what I *should* do, not the kind of "help me do this, it's broke" sort of question which would elicit a "what did you try?" response. Nevertheless, I've added a statement at your request. Do you have an answer? – Christopher Jul 14 '16 at 23:32
  • You should tell people exactly what you have done so they don't waste time going over ground you have already covered. – user9517 Jul 15 '16 at 05:55
  • @Iain Since he wouldn't know whether what he had done was right or not, I'm not sure how that would help. He wants to know what the recommended method is. What he's tried has no bearing on that. – David Schwartz Jul 15 '16 at 08:08
  • 1
    Can you clarify why you say you are creating a subdomain rather than adding a host to the domain. What makes it a subdomain? Does it have other hosts in it? – David Schwartz Jul 15 '16 at 08:09
  • @Christopher It was quite late over here yesterday, and I reviewed many questions (which were just shitty) just before I came across your post. So, maybe this influenced my mood (and thus, my comments). I agree that this question is not about "help me do this, it's broke", but that's not the point in my opinion. Still, I think, a good question should present research which one did on his / her own, even if the question is about "how should I do that". It's completely fine and valid if you for yourself didn't came to a conclusion which made you happy, but if so, please say so. ... – gxx Jul 15 '16 at 09:15
  • ... Put all the information you know about into your question to present "the audience" and "complete picture and broad view". I doubt this is too pedantic, but maybe you're right, who knows. I think it boils down to personal preference and what ones thinks makes a good question. "Do you have an answer?": I just dealt once in the past with a situation like this, and I handled it the way you did. I think the answer of @DavidSchwartz raises valid points, for example putting the record into the root zone, to save clients a additional nameserver query. ... – gxx Jul 15 '16 at 09:24
  • ... I'm not sure what makes an answer an "authoritative" one, but I'm quite sure this information is to be found in [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt), and buried somewhere in there. I'm lacking time to do this research, but maybe this is an option for you. That's all for the moment, good luck and all the best! **Edit**: Because of "Fan of freedom and equality. " in your profile: +1. Cheers! – gxx Jul 15 '16 at 09:27
  • @DavidSchwartz By "subdomain", I'm referring to the segregation of a subset of the top-level domain with a separate zone in DNS. This is done by providing "glue records", which specify that another name server (NS) is responsible for providing records for that sub-domain. This is different than a host on this domain, in that a host's records are in the same zone as the domain itself, usually as an A record. – Christopher Jul 15 '16 at 18:40
  • @gf_ Thanks for the reference to RFC1035. That's helpful, but unfortunately, I couldn't find anything to specifically explain where the subdomain's A record should reside. I'll keep looking. And, apologies if I contributed in any way to your worsened mood last night. Hope today is better. – Christopher Jul 15 '16 at 18:42
  • @Christopher Reading the comment you addressed at DavidSchwartz: I think the questions is as well, if you need (or a forced to?) a setup like you're implementing. Yes, you're using glue records. But: Do you need these? Is there a valid reason why just putting the records of the hosts into the root zone won't work? (I think, something along these lines DavidSchwartz tried to raise.) – gxx Jul 15 '16 at 18:46
  • @Christopher So: Is it just `sub.domain.com`, or will there be `foo.sub.domain.com` and `bar.sub.domain.com` as well? – gxx Jul 15 '16 at 18:47
  • @gf_ Currently, just the one, but could add more later. You can also just add regular host records without creating a subdomain by putting "sub", "foo.sub", and "bar.sub" as A records in the parent domain's zone. For many people, that's enough. However, in my case, I cannot do this... I actually need to delegate management of the subdomain to another DNS server. It's not a technical requirement, it's a business requirement. – Christopher Jul 15 '16 at 18:56
  • 1
    @Christopher I'm aware of the possibilities regarding records, thanks. :) I wanted to find out if you have to delegate or not. Thanks for the clarification. – gxx Jul 15 '16 at 19:06

1 Answers1

4
  1. You must put the A record for the subdomain in the domain's records if it does not have any NS records.

  2. You must put the A record for the subdomain in the domain's records if it is a nameserver for itself. (Otherwise, you have a chicken and egg problem.)

  3. You may put the A record for the subdomain in the domain's records even if neither of the first two conditions apply. This has the advantage of saving clients who just need the A record from having to query the subdomain's nameservers, though they may ignore it anyway.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
  • #1 doesn't apply in my case, because the subdomain has it's own nameservers (specified by the glue records in the top domain). #2 is not the case, since I'm using different name servers than the domain itself, but it's good to keep in mind. Can you clarify #3? Does this mean that clients may obtain A record from the top-level domain without querying the sub-domain's name servers, but that they may also query the sub-domain's name servers to read the A record from there? – Christopher Jul 15 '16 at 18:36
  • 1
    @Christopher Correct. This can save clients a round trip. For people who care about how many milliseconds a web query takes, that may be worth doing. But clients sometimes ignore it or use it only to decide what IP address to send DNS queries to so if it's not a nameserver, it has no effect. – David Schwartz Jul 15 '16 at 18:45
  • So, it sounds like I definitely should put it in the subdomain's DNS server, but it's recommended I include it in the parent's also. Thanks! – Christopher Jul 18 '16 at 17:54