# how can i create a name server for my domain names

What I have:

• 1 Virtual Private Server (Unmanaged Linux VPS)

Purchased from X hosting Company

• Few Domain names

Purchased from Y hosting Company

What I Want to do

I need to set the nameserver from my domain names which i have purchased from a different hosting company.

How can i create a set nameserver at my VPS so that i can resolve all the domain names with corresponding IP addresses and Resource Records

Example

Say i have domain names:

domainname1.com domainname2.com domainname3.com

i want to create a nameserver like ns1.domainame1.com so that i will be able to resolve all the DNS records for my above domain names.

so that i can point each:

domainname1.com --> ns1.domainame1.com
domainname2.com --> ns1.domainame1.com
domainname3.com --> ns1.domainame1.com


I tried usingbind9 and quite comfortable with, the only problem lies with the nameserver i.e. ns1.domainname1.com

You install bind9 on your server, which i'll say has the IP address 1.2.3.4; we'll call it ns1.domainname1.com. You configure it to be primary for the three zones domainname1.com, domainname2.net and domainname3.org (let's spread the love in the TLDs!). Ensure that you have an SOA record that lists ns1.domainname1.com and ns2.domainname1.com as authoritative for each domain, and A records for both ns1.domainname1.com and ns2.domainname1.com pointing to 1.2.3.4).

You test that they're working by

ns1% dig soa domainname1.com @localhost


and likewise for the other two domains. Don't go any further until you've got this bit working.

Change your glue records, that is, the records maintained through your registrar (the organisation you pay for the right to have the domain names domainname1.com, domanname2.net, etc.) so that the listed nameservers for each of the domains are ns1.domainname1.com and ns2.domainname1.com. When doing this for domainname1.com's records, you will have to give the IP addresses of the two nameservers as well, which are 1.2.3.4. This avoids the chicken-and-egg problem where I go to look up www.foo.com, get told that the authoritative servers for foo.com are ns1.foo.com and ns2.foo.com, so I try to look those up, and get told that the authoritative servers for foo.com are ns1.foo.com and ns2.foo.com, so I try to look those up, you can see where this is going wrong, yes?

And that should be it. You can check the glue records are right with

whois domainname1.com


and you already know that your nameservers are serving because you checked it with dig above, right? Check it again anyway, preferably from a third box so you don't overlook any firewall-related or i-only-listen-on-127.0.0.1 issues.

Optional extra: find a friend with a nameserver and have him/her run secondary NS for you. Generally, you need to advertise two NS records for a domain, and while it's possible to list the same one twice, it's bad form. There is a bunch of other stuff you need to do here, making sure that ns1 allows your friend's box to transfer the zone, that your friend's box is configured to look to you as master, that sort of thing). If you do all this, change the A record for ns2.domainname1.com to your friend's name server's address in your zone files, and your glue records accordingly.

Enjoy nameservery goodness, and have a well-earned coffee. Does that make sense?

• @MadHatter, i am too much screwed up with this DNS stuff, if possible can we have a chat on gtalk or IRC? – Idlecool Nov 1 '10 at 9:58
• let say i have a domain name domainname1.com, now what should be my VPS host name: ns1.domainname1.com or i can keep it anything as i wish? – Idlecool Nov 1 '10 at 10:02
• Define hostname. Do you mean "the name that the machine calls itself"? That can be anything you like. All I'm saying above is that the DNS needs to be self-consistent; you need to have an A record for ns1.domainname1.com which points to 1.2.3.4, both the name and the address need to appear in the glue records for domainname1.com, and ns1.domainname1.com needs to appear in the SOA record of the domainname1.com zone. – MadHatter Nov 1 '10 at 10:58
• I apologise, but I don't have the time to talk you through this on a chat forum. If you can formulate questions here, I'll try to answer them in my spare minutes. DNS is complex - not tricky, but there are a lot of things that all have to be setup right for it all to work - so you need to do your research and take care! – MadHatter Nov 1 '10 at 11:00
• @MadHatter thanks for the assistance.. seems it will help me to solve the problem – Idlecool Nov 1 '10 at 11:42

What you are looking for is a vanity DNS and you can find some info here.

• i dont want to use some service in between, i want to create such service for myself – Idlecool Nov 1 '10 at 7:57
• Just saw that you have got an answer. Cheers. – sybreon Nov 2 '10 at 1:28