Can I use IP address as Name Server instead of creating custom Name Server [closed]
Asked Answered
C

2

17

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.)

Centipoise answered 23/1, 2012 at 17:19 Comment(1)
Nowadays, this isn't a very good fit for this site. Stack Overflow is for programming questions, not server administration ones. (Yes, I realize that in 2012 it was fine; this is for the inevitable user saying that their question shouldn't have been closed because this one wasn't)Eyas
C
21

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?

Capsicum answered 23/1, 2012 at 17:35 Comment(6)
Yes, here 127.0.0.1 (localhost) is just a place holder. The essence of my question is Why I'm not allowed to user IP address itself as NameServer?. can you please have a look at this image.. Thanks.Centipoise
Because that's not how DNS works. Who is hosting your name server?Capsicum
my host is IXwebhosting. can you please give a link or an answer for last part of my question Is there any strict format for Name Servers like, it should be like $this and it should not be like $that ? -thanksCentipoise
Your question is unclear. If you are using IXwebhosting for DNS (ixwebhosting.com/hosting-manual/domain-name-system) then you need to enter their name servers (NOT IPs), as described on the linked page. You only enter IPs if you are setting up your own name SERVER not just your own domain. This is all part of the basic Internet architecture (RFC 1034, 1035, etc.) if you want to lookup the docs.Capsicum
Hey Conrad, I've got a registrar asking for the IP as well as the name of the nameservers. How do I find out the ip of the nameservers? Do I just run it through one of those whois checkers?Tauromachy
GoDaddy asks for both name and IP slots when setting Nameserver, just in case you only have the IP, or it's [unusually] a custom nameserver. Simply leave the IP slot blank, and just give it the name.Zeeland
T
11

I had a similar question to this one over at serverfault, but it got voted down but no one offered to explain why it can't be done. After researching the web looking for DNS principles, here is my answer as to why you can't substitute IPs for nameservers. It is long, but it also helps me understand the convention.

Let's say you registered the domain abc123.com, the "com" is the top level domain, the "abc123" part is the second level domain.

When a web user wants to visit abc123.com, he types in abc123.com into his web browser. The browser then contact the DNS resolver (such as google DNS, level3, or opendns -- which is acting as a cache) to query if the DNS resolver has the IP address for abc123.com previously saved. If some one had tried to reach abc123.com previously through this resolver, the resolver should have the IP address for the abc123.com domain name and return the IP to the browser. But if no has ever queried the DNS resolver for abc123.com, the resolver does not have the IP cached. The resolver then need to contact the root DNS server for that information.

The root DNS server works in a way that explains why you can't substitute IP for conventional alphanumeric nameserver names. The root DNS server gets its info from the domain registrars. When you register the abc123.com domain, abc123.com is recorded by the root DNS server; along with the nameservers/IP (optional).

I think why the nameserver names have to follow the FQDN (fully qualified domain name) format is because of the way the root DNS server is designed to work. Example, for ns1.mynameserver.com nameserver name, the guess is that the "mynameserver.com" must exist in the root DNS server for it be able to logically say that ns1.mynameserver.com to be valid. If mynameserver.com does not exist in the record, then ns1.mynameserver.com must not be valid. The same goes for the IP as nameserver name, the root DNS server can never have your IP on record as a valid domain name (because the IP is not a valid FQDN format, there is no numeric top level domain -- ie .42 is currently not a valid TLD).

Going back to the original question as to whether you can use IP addresses as nameserver names. Even if you choose to ignore convention, it is not possible for you to set IP as nameserver names because your registrar won't allow it. If you own abc123.com and you log into your registrar to register nameserver names, the top (".com") and second ("abc123") level domains are locked. You can only enter values for the sub level domain. So what you could end up with is 12.23.45.33.abc123.com as your nameserver name (that is if your registrar allows you to have that many dots).

Tipi answered 10/4, 2012 at 6:20 Comment(1)
This answer is wrong. Root servers only contain information about the TLDs, not about the individual domains.Rhearheba

© 2022 - 2024 — McMap. All rights reserved.