Can I use IP address as Name Server instead of creating custom Name Server

TheKid picture TheKid · Jan 23, 2012 · Viewed 43.8k times · Source

I've just bought a VPS to host my website.
One of the problems I've faced during migration from shared hosting to VPS is to setup a Private Name Server.
I've instructed to create two Private Name Servers with the IP I've provided.

Example: ns1.mydomain.com points to 127.0.0.1 (say)
ns2.mydomain.com points to 127.0.0.1

My doubt is, instead of creating such name servers why I'm not allowed to use my IP as name server

I'm trying to enter IP address(of my website) in field where I've instructed to enter Name Servers. (

Enter Your Name Servers:

Name Server 1 :- 123.4.5.6
Name Server 2 :- 123.4.5.6 (see the picture here)
(if I enter ns1.mydomain.com(custom Name Server) which also points to the same IP 123.4.5.6)

if 'X' equals 'Y', why I cannot use the same 'Y' instead of 'X'
if ns1.domain.com wears the IP 123.4.5.6 , why I cannot fill 123.4.5.6 instead of (name Server)ns1.domain.com?

OR If one can access his site through IP and domain.com (where domain.com = IP) why this is not applicable in case of name server (where ns1.domain.com = some IP. and hence I can fill that IP instead of ns1.domain.com)

why this is not possible?

(PS: my question is NOT how to create Name Servers. I could do it.)

Answer

Conrad Shultz picture Conrad Shultz · Jan 23, 2012

1) Questions such as this should really be on ServerFault.

2) 127.0.0.1 is localhost, not a publicly accessible address. Respectfully, if you didn't understand this, you should go back to shared hosting... you will end up spending more time learning to run a VPS than making your site work. (If you were just using 127.0.0.1 as a placeholder, then this doesn't apply.)

3) Most individuals who don't have complex needs should probably just opt to use their domain registrar's DNS servers if available (e.g. NameCheap). If your registrar doesn't offer free DNS, your VPS provider almost certainly does (I know both Linode and Rackspace Cloud do). Regardless of where you are having DNS hosted, you need to use their name servers in your configuration, not addresses you invent. (You're not actually going to run your own name server with djbdns or BIND, right?)

EDIT: Attempt to explain DNS after question clarification.

Your question still isn't really clear, and I think it's because we aren't using the same terminology. DNS is a complicated system and you have to be very precise.

Let me try to explain the how DNS hierarchies are arranged as relates to your situation.

1) You register a domain, example.com. It is in the .com top-level domain (TLD). Each TLD has a single entity who manages the root nameserver for that TLD. In the case of .com, this is Verisign. When someone goes to look up www.example.com, they first talk (through a process that isn't really relevant here) to the TLD's root nameserver.

2) The root nameserver returns the authoritative nameserver(s) for the domain (example.com). This is what I believe you are trying to set. According to the DNS specification, the authoritative nameservers are given by name, not IP. Since you (hopefully) aren't trying to run your own authoritative nameserver, you should give your registrar (who in turn tells the TLD root nameserver) the nameservers designated by your hosting company; these were supplied in the link I gave you in the comments (ns1.ixwebhosting.com, etc.). The reason these need to be names, not IPs, is that your hosting company may need to move IP addresses later. If you were allowed to enter an IP, and they switched IPs, your record would be out of date. By entering a name, the DNS system can properly resolve the authoritative nameserver name to an IP.

3) The client interested in www.example.com, having obtained the name (and resolved the IP) for the authoritative name server for example.com (i.e., ns1.ixwebhosting.com), contacts the authoritative name server and requests the IP for www.example.com. The authoritative name server checks its records and returns the IP that you have told it. That is, you will use your hosting provider's interface (probably a web page you login to... contact them for assistance) to manage the subdomains for example.com, such as www.example.com.

If you don't use hosted DNS, you have to run your own DNS server (e.g. BIND or djbdns). This introduces a whole set of other complications that are beyond the scope of your question. Please just use hosted DNS and let your provider deal with these issues.

You will notice that nowhere here did I mention ns1.example.com. You only need to deal with such records if you are running your own DNS server, which you probably shouldn't be doing.

So in summary:

1) Tell your registrar that your domain uses your hosting provider's DNS servers (from the link I gave you).

2) Tell your hosting provider to use your VPS' IP address for actual host names for your domain.

Does that clear things up?