6

Question: Is it possible to combine DNS name servers?

For this example lets say that I lease the domain example.com through a service (godaddy, name.com, etc)

I have the option of pointing this domain and all it's records to a different nameserver however what if I want to keep this nameserver for things like the A records but point wildcard subdomains (*.example.com) to a different nameserver? Is this possible?

I have looked into NS records, however those only seem to be for the purpose of load balancing DNS across multiple servers.

In addition, the "custom" nameserver in this example would be a node application (dnsd)

Although I'm not sure if that is important.

To explain a little more (using local IPs for the sake of explanation):

My requirements are as follows:

These records are hosted on name.com for example:
A - example.com to ns1.name.com nameserver
A - api.example.com to ns2.name.com nameserver

These records are hosted on dnsd (a different nameserver):
A - *.example.com to 192.168.0.32 nameserver

Would a potential solution be to define a nameserver for example.com (ns.example.com) and then point an ns record of *.example.com to ns.example.com ?

  • 3
    Why do think you want different name servers for a wildcard vs other records? What would be the point of this? – Zoredache Aug 11 '16 at 18:21
  • Primarily because I'd like to use the existing (provided) name servers for stability and uptime, while using subdomains for other features, apps, services, etc - that require a more "dynamic" approach. For example usernames, or DNS record registrations as the service starts. Examples: levi.example.com or dev.example.com – Levi Roberts Aug 12 '16 at 0:10
  • 1
    Do keep in mind that there are many DNS hosting offerings that allows updating via APIs, and/or there are services that will act as secondaries to a authoritative server you directly manage. So there are pretty easy ways to fill both goals without having to do deal with delegation, or do something else unusual. Since you mentioned Godaddy, one thing would be to add the 'Premium DNS' service, then run your own 'master' name server, and have Godaddy act as a secondary for your zones. – Zoredache Aug 12 '16 at 19:53
  • I appreciate the information. With that in mind, this is primarily research for scalability in the future. I've considered all possibilities however we will want the DNS under our control. Another advantage is that subdomains can point to local IPs for networking behind firewalls for discoverability. While I understand there are alternatives, a custom DNS server is the easiest solution that requires the least amount of maintenance. ZeroMQ, Bonjour, etc all don't work as seamlessly for our use cases. – Levi Roberts Aug 13 '16 at 19:31
  • @LeviRoberts could you explain, how you did solve this finally? – BananaAcid Apr 1 at 16:42
16

DNS records are a hierarchy. Anything at the same level (v1.example.com, v2.example.com, etc) will all be resolved by the NS records set for that level (example.com)

You can have different nameservers for different levels / subdomains if you are so inclined, for example (example.com at godaddy, subdomain1.example.com network solutions, subdomain2.example.com dns made easy).

This is called zone delegation.

  • It's also worth noting that the boundary of that delegation is known as a zone cut, which is the important concept here. – Andrew B Aug 11 '16 at 21:23
  • Hey Tim, this sounds like what I'm looking for. Could you elaborate on the "if you are so inclined" part. What method am I looking for? Would this be provider specific on how to establish this goal? And potentially even be impossible with some providers? Would I need to study "zone delegation" in order to understand the concept? – Levi Roberts Aug 12 '16 at 0:13
  • 2
    You'll want to talk to your vendor or read their documentation. There are a couple ways to do this and I don't want to lead you astray. – Tim Brigham Aug 12 '16 at 0:25
-2

The correct way to do this is to setup a bigger cluster but you can have an NS record point to subdomains like this. You can dig this domain however I'm not going to keep it active on this vm that long.

$TTL 1m
$ORIGIN foobook.com.
@       IN      SOA     ns1.foobook.com. joeblownonesuch.foobook.com. (
        2016081602
        1m ; refresh
        2m ; update
        2m ; expiry
        2m ; minimum
        )
@       IN      NS      ns1
@       IN      NS      ns2
ns1     IN      A       212.109.220.95 ; glue records
ns2     IN      A       212.109.220.96

@       IN      A       212.109.220.95  ; misc a records for testing
www     IN      A       212.109.220.96
mail    IN      A       212.109.220.95
test    IN      A       212.109.220.95
@       IN      MX      10 mail.foobook.com.

sub.foobook.com.        NS      ns1.sedoparking.com.
www.foobook.com.        NS      ns1.sedoparking.com. ; overlaps with a record www.foobook.com.

This will give you the following results:

[root@otherserver master]# dig +short @localhost test.foobook.com
212.109.220.95 [answer is from my server]
[root@cpc2-cosh11-2-0-cust725 master]# dig +short @localhost www.foobook.com
72.52.4.120 [answer is from ns1.sedoparking.com]
[root@otherserver master]# dig +short @localhost whatever.sub.foobook.com
72.52.4.120 [answer is from ns1.sedoparking.com]
[root@otherserver master]# dig +short @localhost mail.foobook.com
212.109.220.95 [answer is from my server]
[root@otherserver master]# dig +short @localhost ns1.foobook.com
212.109.220.95 [answer is from my server]

Anyway 212.* is my server, and 72.* means its followed the NS pointer to sedoparking (which uses wildcard dns records for everything).

What you should actually do: What I did in a similar situation was use lots of bash scripting to turn the zone files into the new format of zone files, then I used a script with dig +short to compare the output of the two servers for each subdomain.

Setting things up with different servers supplying dns information for the subdomains is mainly useful when you want a different company or department to manage their own subdomain.

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.