Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My server has one IP assigned to it. It is running as a DNS server, but no domains are pointing at it - nothing is using it for DNS right now. I have a domain which I want to host on this server.

Can I have my server providing the DNS for the domain, as well as the hosting?

So can I have one server:

One domain:

And set these nameservers for the domain at my registrar:

... I can't think how this would work. Surely I need a separate server with its own DNS to act as the nameserver? Then my server can only act as the nameserver for other domains, but not the nameserver for ..?

(FYI: those are not the real domain or IP)

share|improve this question
You would do well to have a bit of a read about DNS and get at least an overview of the mechanisms involved. Google is your friend. – John Gardeniers Jul 17 '09 at 8:07

3 Answers 3

It will work because of glue records - in addition to the NS records, the com zone would also contain A records for and

Example ( provides free DNS hosting, hope they don't mind using them here):

$ dig any  +norecurse
; <<>> DiG 9.5.1-P2 <<>> any +norecurse
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28941
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 4, ADDITIONAL: 3

; 		IN	ANY

;; AUTHORITY SECTION:  	86400	IN	NS  	86400	IN	NS  	86400	IN	NS  	86400	IN	NS

;; ADDITIONAL SECTION:  	86400	IN	A  	86400	IN	A  	86400	IN	A

;; Query time: 42 msec
;; WHEN: Thu Jun  4 22:15:27 2009
;; MSG SIZE  rcvd: 159 is not in the zone and thus needs no glue record here.

share|improve this answer
glue records are the trick - for clarity "the com zone" = your registrar, who would have an option to add glue records for ns1 and ns2 – Mark Regensberg Jun 4 '09 at 20:24

The answer is yes, but with some qualifications.

1- There is no reason a single physical server cannot do both functions. The same type of server software (DNS server, typically BIND), does both.

2- However, you will need an additional system to be your backup nameserver. When you say "hosted", I interpret that as: available to the public via DNS. If so, your registrar will require two nameservers. You do not necessarily need to provision that server yourself, but you do need your DNS domain to be served off of at least two distinct IP addresses (presumably two different systems.)

share|improve this answer

There is no technical reason why this cannot work. However, the reason why you should have more than one nameserver, is of course that if one server is down, the other one is reachable, so many domain registrars demand that these are not identical.

What you can do, is be your own primary domain service, and find some (free) secondary domain service (like

That way, this will work perfectly.

As for the reason why this works in the first place: there is also the 'whois' system, which is used to find the first nameserver. More details can be found in Wikipedia (

share|improve this answer
Whois isn't used when doing DNS lookups. The first name server is found by querying the root nameservers. You can see how this works by using the following command: dig +trace +all <domain> – Mike Conigliaro Jun 4 '09 at 20:25
-1 because of the mention of whois, which is completely unrelated to "why this works" – bortzmeyer Jun 5 '09 at 7:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.