Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up a custom nameserver with BIND9

Lets say that I purchased a new domain (somedomain.com) from a domain registar and I wanted to setup my own nameserver on a server that has two IP addresses.

  1. First I buy the domain.
  2. I get the server.
  3. install BIND9.
  4. I login to the server and prepare the DNS records for NS1.SOMEDOMAIN.COM and NS2.SOMEDOMAIN.COM.

Where do I set these up in BIND and how should I do it?

Next Step: Go back to the domain registar and set the DNS to point to NS1.SOMEDOMAIN.COM and NS2.SOMEDOMAIN.COM.

Is it a bad thing if the domain that I am forwarding is pointed to its OWN nameserver domain? Should I change this? How does it know where NS1 and NS2 go when both subdomains are apart of the domain that is being forwarded to them?

Should I just use the DNS provided by my registar and make two CNAME record entries for NS1 and NS2 to point to the server ips of the newly created DNS server? Would this work?

Can anyone explain this process to me? Thanks.

like image 713
matsko Avatar asked Nov 29 '10 23:11

matsko


1 Answers

Do add the following step which is crucial to using your name servers in the WHOIS record:

Step 5: Go back to your registrar (wherever you bought the domain in step 1) and create the special NameServer records in their administrative control panel; for example, on godaddy.com, you need to go to advanced > hosts and there you can set up ns1 to point to the IP address of your server (step 2).

You will need to do the same for ns2.

This will vary from registrar to registrar, consult their documentation or contact customer support.

Step 6: Update the WHOIS record to reflect your new nameservers.

  • Where do I set these up in BIND and how should I do it?

You would set these up in the domain's zone record, not unlike this:

yourdomain.com.   IN    SOA     ns1.yourdomain.com. you.yourdomain.com. (
                        1032789388
                        10800
                        3600
                        604800
                        300 )
yourdomain.com.   IN      NS      ns1.yourdomain.com.
yourdomain.com.   IN      NS      ns2.yourdomain.com.
ns1.yourdomain.com.       IN      A       xxx.xxx.xxx.xxx
ns2.yourdomain.com.       IN      A       yyy.yyy.yyy.yyy
  • Is it a bad thing if the domain that I am forwarding is pointed to its OWN nameserver domain? Should I change this?

Running DNS from the same domain is fine.

  • How does it know where NS1 and NS2 go when both sub-domains are apart of the domain that is being forwarded to them?

See Step 5 above - your registrar handles this bit, registering your name servers and allowing them to participate in the 'net.

  • Should I just use the DNS provided by my registar and make two CNAME record entries for NS1 and NS2 to point to the server ips of the newly created DNS server? Would this work?

This would not work as you would still need to do Step 5; to be honest, I'm not sure what would happen if you did not serve the DNS for ns1 off of the same host.

Additional note:

While you CAN run one DNS server for both ns1 and ns2, it is not recommended.

Usually you want your secondary (slave) DNS server to be as far away as possible from your primary (master) DNS server... located in a different country is usually the best.

But, there is nothing technically preventing you from using two different IPs on the same physical hardware.

like image 132
baraboom Avatar answered Sep 28 '22 11:09

baraboom