Can someone see why my DNS won't work? I followed everything in the tutorial, but won't work

7,595

You haven't got A records for your nameservers ns1.main.com and ns2.main.com. The named-checkzones hasn't worked as it is warning you that you haven't got A records for your nameservers:

zone main.com/IN: NS 'ns1.main.com' has no address records (A or AAAA)

zone main.com/IN: NS 'ns2.main.com' has no address records (A or AAAA)

So you need to add the following to your main.com.db file:

ns1           IN    A    174.143.182.1
ns2           IN    A    174.143.182.2

Without these glue records the whole thing won't work.

Also your SOA record for main.com is wrong. It should be:

@       IN      SOA     ns1.main.com. info.main.com.

It didn't fail in the named-checkzones because you have a main.com A record and BIND assumed that was the name server record.

Share:
7,595

Related videos on Youtube

Alex
Author by

Alex

Updated on September 17, 2022

Comments

  • Alex
    Alex almost 2 years

    If anyone can help me troubleshoot this, I would very much appreciate it!!

    The tests work. It's just that when I do the manual ping/nslookup test, nothing is working. By the way, I followed everything in this tutorial.

    This is my /etc/bind/zones/master/main.com.db file:

    ;
    ; BIND data file for main.com
    ;
    $TTL    604800
    @       IN      SOA     main.com. info.main.com. (
                                2007011501         ; Serial
                                      7200         ; Refresh
                                       120         ; Retry
                                   2419200         ; Expire
                                    604800)        ; Default TTL
    ;
    @       IN      NS      ns1.main.com.
    @       IN      NS      ns2.main.com.
    main.com.    IN      MX      10      mail.main.com.
    main.com.    IN      A       174.143.182.58
    www                     IN      CNAME   main.com.
    mail                    IN      A       174.143.182.58
    ftp                     IN      CNAME   main.com.
    main.com.            IN      TXT     "v=spf1 ip4:174.143.182.58 a mx ~all"
    mail                    IN      TXT     "v=spf1 a -all"
    

    This is my reverse DNS (/etc/bind/zones/master/174.143.182.rev) file:

    $TTL 1d ;
    $ORIGIN 182.143.174.IN-ADDR.ARPA.
    @       IN      SOA     ns1.main.com.   info.main.com. (
                                           2007011501
                                           7200
                                           120
                                           2419200
                                           604800
    )
            IN      NS      ns1.main.com.
            IN      NS      ns2.main.com.
    1       IN      PTR     ns1.main.com.
    2       IN      PTR     ns2.main.com.
    

    This is my named.conf.local file for BIND:

    zone "main.com" {
           type master;
           file "/etc/bind/zones/master/main.com.db";
    };
    
    zone "182.143.174.IN-ADDR.ARPA" {
           type master;
           file "/etc/bind/zones/master/174.143.182.58.rev";
    };
    

    When I do my named-checkzones, it works.

    named-checkzone main.com main.com.db
    zone main.com/IN: NS 'ns1.main.com' has no address records (A or AAAA)
    zone main.com/IN: NS 'ns2.main.com' has no address records (A or AAAA)
    zone main.com/IN: loaded serial 2007011501
    OK
    

    However, something is wrong when I restart BIND9.

    /etc/init.d/bind9 restart
    Stopping domain name service...: bind9rndc: connect failed: 127.0.0.1#953: connection refused
    .
    Starting domain name service...: bind9.
    

    When I do a ping test, it does not work:

    ping ns1.main.com
    PING ns1.main.com (72.16.146.146) 56(84) bytes of data.
    64 bytes from ns1.main.com (72.16.146.146): icmp_seq=1 ttl=52 time=20.0 ms
    

    I expect the ping test to show my IP (174.143.182.58) instead of 72.16.146.146.

    I even tried to edit my resolve.conf to the same IP:

    nameserver      174.143.182.58
    

    If anyone can help figure out why it's not detecting my own IP when I ping it...please help me!

    • Admin
      Admin over 14 years
      Describing what's actually going wrong would be a mighty fine start. Use the standard template: What you expect to see versus what you actually see.
    • Admin
      Admin over 14 years
      I expect the ping test to show my IP (174.143.182.58) instead of 72.16.146.146.
    • Admin
      Admin over 14 years
      I think the example in the tutorial you followed is broken but works for them because they have an A record for example.com that happens to be the IP for the name server.
  • Alex
    Alex over 14 years
    Hi Sim. Thanks for the answer. I made the changes, and the name-checkzones did not give the "no address records" warning anymore. However, when I do a ping...it still does not go to my IP? Is it because when I started the BIND9, it had a warning: Stopping domain name service...: bind9rndc: connect failed: 127.0.0.1#953: connection refused?
  • Sim
    Sim over 14 years
    Hang on a second. What are the IPs for your DNS server(s) are they 174.143.182.1 and 174.143.182.2 or should it be 174.143.182.58 and ? At the moment the authoritative name servers for your main.com domain are 174.143.182.1 and 174.143.182.2 - is that right?
  • Sim
    Sim over 14 years
    If you are doing this just to learn then as Zoredache points out in his comment you should be using example.com or example.net or example.org as that is what they are explicitly designed for. See en.wikipedia.org/wiki/Example.com