Feed on
Posts
Comments

How do I DNS?

  1. Buy a domain.Any registrar will do.
    If someone else is going to host the DNS for your domain, skip to step 4. Otherwise, continue from here. The next few steps are how you make sure the registrar knows your server exists as a nameserver. Until the registrar is aware of your server’s existence, no domains can tell the registrar that your server hosts their DNS.
  2. Create nameservers. You do this at the same registrar where you bought your domain. Login to your account at your registrar. This can be tricky, because registrars can’t seem to agree on what to call this. I would say you want to “register nameservers”. GoDaddy calls it creating “host records”. I don’t know what other registrars call it, because I use GoDaddy. The main idea is that you want to pick names (we’ll use ns1 and ns2.rootmypc.net as an example) and associate those names with IP addresses. You should have control over the DNS server configuration at those IPs. Here’s an example of registered nameservers:

    ns1.rootmypc.net - 1.1.1.1
    ns2.rootmypc.net - 2.2.2.2

    Now that the registrar has the IPs for these nameservers hard-coded, it solves the chicken/egg problem. More about this later.
  3. Create the “glue”. All that means is that you need to create an A record for each of the nameservers you just registered. Wherever DNS is hosted for “rootmypc.net”, go there and make sure these records exist in the zone file for “rootmypc.net”:

    ns1 IN A 1.1.1.1
    ns2 IN A 2.2.2.2

    Note: You just created/registered a couple nameservers. They’re not doing anything yet, but they exist, which means now we can tell stuff to start using them.

  4. Tell your registrar the nameservers that will be hosting DNS for your domain. Let’s say you want to use 1.1.1.1 and 2.2.2.2 (registered as ns1 and ns2.rootmypc.net) as nameservers for your domain. Go to the registrar where you bought your domain and set your authoritative nameservers to ns1 and ns2.rootmypc.net. You don’t need to give it IPs for this, because the guy who created these nameservers (maybe even YOU, if you followed the steps above) told his registrar the IPs tied to those names. You just use the names. How you do this will be different depending on your registrar.
  5. Create the zone file for your domain. You just told your registrar that ns1 and ns2.rootmypc.net are hosting DNS for your domain. Those names point to specific IPs (1.1.1.1 and 2.2.2.2). You need to go to the server(s) at those IPs and create a zone file for your domain. The leg work is done at this point, and the zone file is the raw data that you actually care about. Here’s an example of your zone file:

    $TTL 3600
    @ 3600 IN SOA ns1.domain.com. admin.domain.com. (
    2010030400 ; serial, todays date+todays
    3600 ; refresh, seconds
    30m ; retry, seconds
    3600000 ; expire, seconds
    3600 ) ; minimum, seconds
    domain.com. IN A 5.5.5.5
    www IN CNAME domain.com.

    You could even copy/paste that into your zone file if you want, but obviously you’ll want to put your own domain in place of domain.com, and you need to replace 5.5.5.5 with the IP address where your web site exists.
  6. Don’t forget your NS records. Yes, the registrar knows what nameservers your domain uses, and yes that should get the job done most of the time. However, your zone file should contain records indicating what nameservers your domain uses, and these records should agree with what you told your registrar. Still using ns1 and ns2.rootmypc.net as examples, here’s what you would need to add to your zone file:

    domain.com IN NS ns1.rootmypc.net.
    domain.com IN NS ns2.rootmypc.net.

    Update the serial number after making changes, and “rndc reload”, or restart the service, or whatever.

Now your domain resolves. Good for you.

Leave a Reply