How does DNS and sub-domain work?

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How does DNS and sub-domain work?

Post by VladSun »

josh wrote:... In your registrar there should be an option to "register nameservers" which actually adds your IP as the nameserver for your namespace, then you set up bind. Just like mail relaying tho a default bind install can be used by anyone as their DNS, so you'd probably want to harden the config so it only answers for domains you own
While most of this is true there are some things to be cleared:
1) these nameservers are called "authoritative DNS servers" for your domain zone;
2) all of these servers will appear in the answer part when 'dig domain.tld NS' is queried;
3) your registrar must require that you have at least 2 different authoritative nameservers with IP addresses from 2 different IP subnets;
4) these nameservers are queried in a round robin fashion by clients;
5) because of 4) these server have to be synchronized and to respond with the same answer (or answer set when round robin fashion is used for multiple IPs per domain name) to a single query;
6) because of 5) usually master-slave DNS servers are used. Whether the response to a DNS query is received from the master or any of its slave servers doesn't matter.
There are 10 types of people in this world, those who understand binary and those who don't
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: How does DNS and sub-domain work?

Post by josh »

VladSun wrote: 3) your registrar must require that you have at least 2 different authoritative nameservers with IP addresses from 2 different IP subnets
Nope. Try pinging ns1.ne8.net and ns2.ne8.net ;-) Again has nothing to do with subdomains
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How does DNS and sub-domain work?

Post by VladSun »

josh wrote:
VladSun wrote: 3) your registrar must require that you have at least 2 different authoritative nameservers with IP addresses from 2 different IP subnets
Nope. Try pinging ns1.ne8.net and ns2.ne8.net ;-)
WARNING: All of your nameservers (listed at the parent nameservers) are in the same Class C (technically, /24) address space, which means that they are probably at the same physical location. Your nameservers should be at geographically dispersed locations. You should not have all of your nameservers at the same location.
That's why I said "must require", right?
And ... viewtopic.php?f=30&t=87067
josh wrote:Again has nothing to do with subdomains
Reread the OP...
There are 10 types of people in this world, those who understand binary and those who don't
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: How does DNS and sub-domain work?

Post by josh »

VladSun wrote:Reread the OP...
I'm straight, thanks though.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How does DNS and sub-domain work?

Post by VladSun »

Why and when we should (should not) use wildcards :
http://www.iab.org/documents/docs/2003- ... cards.html
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: How does DNS and sub-domain work?

Post by Jenk »

josh wrote:There is no way Apache Virtual hosting (the name-based one, of course) feature can be used without a properly set up DNS for the "virtual hosted" subdomains.
If I have the domain name example.com registered as 192.168.10.1, and on that machine is Apache running with NamedVirtualhost directives for http://www.example.com and somethingelse.example.com, and I type http://www.example.com in my web browser, I will get the page I am looking for.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How does DNS and sub-domain work?

Post by VladSun »

Well, the "no way" thing is not so true :)
If one edits his/her hosts file it will work.
If one constructs his/her own GET request, sets a proper HOST header and access the Apache server by IP it will work again :)
Otherwise a properly setup DNS must be used.
Jenk wrote:If I have the domain name example.com registered as 192.168.10.1, and on that machine is Apache running with NamedVirtualhost directives for http://www.example.com and somethingelse.example.com, and I type http://www.example.com in my web browser, I will get the page I am looking for.
I don't think so:

Code: Select all

DNS:
example.com. A 192.168.10.1
 
browser: 
http://www.example.com -> won't work (IP can not be resolved)
http://somethingelse.example.com -> won't work (IP can not be resolved)

Code: Select all

DNS:
example.com. A 192.168.10.1
www CNAME example.com.
 
browser: 
http://www.example.com -> OK
http://somethingelse.example.com -> won't work (IP can not be resolved)

Code: Select all

DNS:
example.com. A 192.168.10.1
www CNAME example.com.
somethingelse CNAME example.com.
 
browser: 
http://www.example.com -> OK
http://somethingelse.example.com -> OK

Code: Select all

DNS:
example.com. A 192.168.10.1
*.example.com. CNAME example.com.
 
browser: 
http://www.example.com -> OK
http://somethingelse.example.com -> OK
That's what will happen, IMHO. I think I've misunderstood what you meant, so please elaborate.
There are 10 types of people in this world, those who understand binary and those who don't
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: How does DNS and sub-domain work?

Post by josh »

Generally when you set up DNS your hosts creates the 2 entries for you, that's why it works with and without www. Jenk. @ vlad Next time I launch a site I'll tell my client we don't need DNS since his users can just type the IP :D
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How does DNS and sub-domain work?

Post by VladSun »

josh wrote:@ vlad Next time I launch a site I'll tell my client we don't need DNS since his users can just type the IP :D
You'd better insist that they should use telnet and HTTP1.1 ;)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How does DNS and sub-domain work?

Post by VladSun »

I just want to post my PM answer to PCSpectra:
PCSpectra wrote: ... We have our ISP provide our DNS ...
... we do not want to call up the ISP and request the add another CNAME for yet anotehr sub-domain...
VladSun wrote:The best way to manage your domain is to setup your own DNS server which will be the master one for the DNS servers at your ISP (only for your domain zone). This master DNS server will not answer any client DNS queries (stealth DNS). Instead, on its zone files change it will notify and transfer the zone files to the slave servers, which will be listed as the authoritative servers for your domain zone and will answer DNS queries for it - this is a common scenario.
Last edited by VladSun on Sat Mar 07, 2009 8:56 am, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How does DNS and sub-domain work?

Post by VladSun »

A nice how-to could be found at http://www.howtoforge.com/debian_bind9_ ... ave_system
It also shows how to use DNSSEC to transfer the zone files :)
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply