Can somebody help me getting Bind to work on Centos 5?

Discussion in 'Server Operation' started by treeman, Aug 13, 2009.

  1. treeman

    treeman New Member

    I have set up bind on a centos 5 box on my network to act as a dns for my domain.
    Bind is installed and starting ok.

    This is my setup:

    WAN "mywanip" -> ROUTER -> NAT:53 -> Centos 5 "192.168.0.28"
    When i use online port checking tools it shows as connection successfull on port 53 WAN ip so I am assuming there is no problem there.

    Domain.com -> Nameserver = "mywanip"

    when I "ping" Domain.com I get reply from "mywanip"

    when I "host" Domian.com I get :
    Domain.com has address "mywanip"
    Host Domain.com not found: 3(NXDOMAIN)
    Host Domain.com not found: 3(NXDOMAIN)

    when I "host" Domian.com from Centos5 box I get:
    Domain.com has address "mywanip"
    Host Domain.com not found: 2(SERVFAIL)
    Host Domain.com not found: 2(SERVFAIL)

    I am still new to Bind so I am guessing its my zone files that are not right, altho I have experimented with a few configurations that I found in tutorials but this is the furthest I can get.

    Here is a copy of my named.conf and zone files:




    Any tips or observations would be helpfull, thank you
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Code:
    domain.com IN NS ns1.domain.com.
    domain.com IN NS ns2.domain.com.
    must be
    Code:
    domain.com[B][COLOR="Red"].[/COLOR][/B] IN NS ns1.domain.com.
    domain.com[B][COLOR="Red"].[/COLOR][/B] IN NS ns2.domain.com.
    Did you check your zone on www.intodns.com ?
     
  3. treeman

    treeman New Member

    I tried that but still same result. I got the following errors from the dns report

    Is there anything else to look at except named.conf and zone files?
     
  4. treeman

    treeman New Member

    It just occoured to me that my port 80 is being blocked by my isp. But I am not trying to host a web page, just testing and learning DNS, would the ns record get blocked by the port 80 block? Port 53 is not blocked and forwarded through my router to correct internal IP

    Update: I tried with the centos 5 box off and i got

    ;; connection timed out; no servers could be reached
    ;; connection timed out; no servers could be reached

    With the centos 5 box on i got

    Host domain.com not found: 3(NXDOMAIN)
    Host domain.com not found: 3(NXDOMAIN)

    So i guess its getting through just the zone file not working properly
     
    Last edited: Aug 15, 2009
  5. falko

    falko Super Moderator Howtoforge Staff

  6. treeman

    treeman New Member

    Is there any way to do it without setting a glue record? I just want to set up a simple basic dns that will work with my domain.

    I went through alot of guides for bind on centos and none mentioned glue records
     
  7. falko

    falko Super Moderator Howtoforge Staff

    If you don't want to create a glue record, you must host the domain.com zone on name servers that don't use domain.com in their hostname (i.e., instead of ns1.domain.com and ns2.domain.com use ns1.example.com and ns2.example.com).
     
  8. treeman

    treeman New Member

    sorry but I am not sure what to use for "example" in ns1.example
     
  9. falko

    falko Super Moderator Howtoforge Staff

    Any domain other than domain.com.
     
  10. treeman

    treeman New Member

    Hi, thanx for trying to help, I am still stuck so I must be doing something wrong with the basics or my whole understanding of dns. So i got myself a book apress - pro dns and bind and im going to start from scratch, thanx for your help
     
  11. falko

    falko Super Moderator Howtoforge Staff

  12. treeman

    treeman New Member

    Thanks for the post, the guide is really good and the easiest to understand from what I have found so far. Really good on the details, so after reading it a few times I was so confident ill get it going I started from scratch and now I am stuck in the same place:(

    I must be missing something that I failed to see, this is what I have done from the very beginning:

    1. Registered a domain at dynadot.com
    2. Set the name servers linked to my domain as:
    ns1.domain.com -> wan ip
    ns2.domain.com -> wan ip
    domain.com -> wan ip
    just for the sake of it i put in domain.com wont hurt right?

    3. After doing this and waiting for the records to update when i type in host domain.com or ns1.domain.com I get my wan ip back, this is good I presume now the domain knows where to look for the dns server.

    4. Install bind use system-config-bind to get all my config files in right places.
    5. Start bind to make sure its running - OK
    6.. Edit localdomain.zone and localhost.zone, didn't edit nothing in named.conf or change zone file names, I hope this is ok just for testing
    7. Make sure my wan ip port 53 is nat to internal dns server port 53, this looks to be working ad online tools tell me port 53 is open.
    8. So now in my mind this is the picture I have when a query is made to my domain
    user contacts domain, domain says this is the dns server and gives user ns1.domain.com or domain.com since I put them all in step 2. User is redirected to those addresses which both resolve to my wan ip. User queries my wanip on port 53 and talks to bind. So bind should now read out my zone files and translate what is set in them to the user?
    But when i type in www.domain.com it does not work, when i try host domain.com I get either
    Host domain.com not found: 2(SERVFAIL)
    or
    connection timed out; no servers could be reached

    Im lost, I must of missed something in my setup, I know you mentioned glue records but I want to keep it as simple as possible, I tried a few different possiblities for ns but nothing. sorry to be annoying
     
  13. treeman

    treeman New Member

    Im such a jackass lol

    As simple as it was the problem was my external zone in named.conf was not the same as my nameserver at my domain so naturally no nameserver could be contacted and soa record retreived. Right now I am getting a almost perfect report from http://www.intodns.com just a few minor thing associated with using single ip etc.

    Well i guess it was that plain that nobody mentioned it in any guide and I simply missed it, hope this can save somebody alot of pain and long nights, thanx Falco for giving me support
     
    Last edited: Aug 29, 2009

Share This Page