0

This is hypothetical. Been learning about DNS and I'm curios. Say I have a web server and an authoritative dns server and I want to host other sites. Do I need to purchase a domain name for my web server? Or is it not needed. I can just insert dns records (NS and A of my dns) of the domains I'm hosting to point to my authoritative dns server when that domains are requested. Then I can have CNAME records on my dns server that points all those sites to my web server. Of course I have one A record that maps the name of my web server to its IP address.

1 Answer 1

0

Considering things in the strictest way possible, you really only need a domain for your name server (so you can hand out e.g. ns1.yourdomain.com, ns2.yourdomain.com). A records for clients can then be created to point to your web server e.g.

clientdomain.com.  IN A  1.2.3.4

Where 1.2.3.4 is your web server IP (without a domain).

However, as soon as you introduce CNAME records (regardless of who is hosting the DNS services), you need a domain for the web server:

yourdomain.com.  IN A      2.3.4.5
sub              IN A      1.2.3.4
client           IN CNAME  sub.yourdomain.com

A records map to IP addresses, CNAME (Canonical Name) records map to domains.

3
  • Thanks! I'm assuming here yourdomain.com is the domain name of my web server. Then shouldn't that IP also be 1.2.3.4? Also can my clients have their own domain names like client1.com and client2.com and I just insert the record in the name server to point to yourdomain.com which is my web server?
    – roland
    Commented Feb 9, 2018 at 9:27
  • yourdomain.com is a domain you own. All the entries in your DNS do not have to point to the same servers (IP addresses). But yes, it is common to have the naked domain e.g. just yourdomain.com, point to your web server (so the IP could certainly be 1.2.3.4 if you like). The example above assumes a second web server (2.3.4.5) that might, for example, just be for hosting your primary website, not your clients. Commented Feb 9, 2018 at 9:55
  • Regarding records, all you need to do is add the appropriate zones and A records for e.g. client1.com, client2.com to your name server (as in the first part of the answer). If you mean you want them to control DNS, and you just host the content, there are ways to do this with CNAMEs. But most hosting providers have you update your name servers to theirs since it makes things much simpler. If you want clients to have blog.client.com, and have it hosted on clientblog.yourdomain.com, this is potentially doable but more work on your end (configuring your servers). Commented Feb 9, 2018 at 10:10

You must log in to answer this question.

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