7

Can I configure a DNS zone such that both a.b.c and b.c can serve as host names? In other words, can b.c be both a subdomain and a hostname at the same time?

Is this perhaps just a matter of serving both A and NS (for delegation) records for b in c's zone?

2 Answers 2

8

Yes you can! You also do somethhing similar when making example.com and www.example.com point to an A record. You will have to create the A record on the delegated zone though.

You can combine A and NS records but you can’t combine them with a CNAME record.

Note that the terms “hostname” and “subdomain” are kinda synonymous as you can createA records for www.test(.example.com.) and both wwe and test are considered a subdomain. You’re talking about a delegation of a zone here. And you can both delegate a zone and assign an A record to it (from the delegated zone, as its apex).

7

If you only want to have records for b.c and a.b.c subdomains are not necessary. It's completely valid to have more sub-levels in one file, for example in zonefile for c you can have

b    IN     A    127.0.0.1
a.b  IN     A    127.0.0.2

If you really want a subdomain b.c first define delegation i c zonefile.

b    IN     NS   ns.with.b.c.zone

the ns.with.b.c.zone can point on the same server, or to hosting provider for example. Is good practice to have at least two DNS server for domain. RFC1912

next define A record for b.c in zonefile for b.c

@    IN     A    127.0.0.2

or

b.c. IN     A    127.0.0.2
2
  • If I understand your example with delegation correctly, the host b.c hosts a domain server for the delegated domain b. Does this have to be the case or could it be hosted elsewhere?
    – rookie099
    Jan 25, 2019 at 9:40
  • It can be hosted everywhere, for example at hosting company. b IN NS some-ns.somecompany.com. in this case is not necessary to have following A record
    – Quantim
    Jan 25, 2019 at 9:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .