The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reset DNS Zone instead adds duplicate entries

Discussion in 'Bind / DNS / Nameserver Issues' started by JamesOakley, Apr 23, 2011.

  1. JamesOakley

    JamesOakley Well-Known Member

    Joined:
    Apr 15, 2011
    Messages:
    83
    Likes Received:
    2
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Forgive me if there is another post on the forum asking this question, but I couldn't find it.

    For one domain in my WHM installation, whenever I reset the DNS Zone to its defaults, it doesn't work. If I do it in WHM, it says it succeeded, and displays a box on the screen showing what the newly reset Zone should contain, and that box contains the correct information.

    However, if I then go to Edit the Zone, I find that all that has happened is that those entries have been added as extra records to the zone, rather than the entire zone being replaced by just those records.

    Something is wrong. The same result happens if I use the Advanced Editor in Cpanel to reset the Zone. All the other domains I host reset with no problem at all.

    Obviously, I could just delete the entries one by one, but that is masking the problem. If I ever have need to do a Zone reset in the future, the same thing would happen. Furthermore, there may well be something else amiss that is causing it, so I'd rather get to the root of the problem.

    Does anyone have any ideas what I could try? (It did occur to me that I could delete the Zone, and then add it again, but I really don't know what Add Zone does, so I didn't want to break things any further! I wasn't sure, for instance, if doing that would lose all the subdomains on that domain.)
     
  2. JamesOakley

    JamesOakley Well-Known Member

    Joined:
    Apr 15, 2011
    Messages:
    83
    Likes Received:
    2
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    I have found out a little more about this.

    If I look at the folder where all the zone files are stored, all the other domains have one file, named after the pattern example.com.db.

    This domain that is causing the problem has a file like that, but also a number of other files, named after the pattern of example.com.db.work.abcd1234ef567890 - that is, a suffix of .work, followed by another suffix of . followed by 16 random characters.
     
  3. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The filename with "work" in it indicates that the DNS editing process was somehow interrupted before it was completed. This is not a common problem, so it would be best to submit a ticket and let us look at it and determine what is happening. Please post the ticket number once submitted so that we can follow up on it.
     
  4. JamesOakley

    JamesOakley Well-Known Member

    Joined:
    Apr 15, 2011
    Messages:
    83
    Likes Received:
    2
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Thanks Jared

    I think I've solved it, so I won't submit a ticket unless things recur. At some point (a couple of years back), I had created a subdomain on that domain called mail(.example.com). With the domain creation, there was an automatic CNAME entry for the mail. subdomain. When the subdomain was created in cpanel, an A record was also created.

    I backed up the zone file, deleted the DNS Zone in WHM, added the zone back, then performed a zone reset. When I went to Edit the zone entries, I tried clicking "Save" whilst making no changes. That was when I got an error that I couldn't have the CNAME and the A-record. I recreated the Zone again, deleted the A-Record entry in the zone file, then restarted named, and all is well.

    Presumably, either cpanel should refuse when someone attempts to create a subdomain called 'mail', ("Reserved word, please choose a different name for your subdomain" or such). Or, it should know that this subdomain does not need an A-Record. The current situation is not ideal, because it created the near-duplicate entry with one hand, whilst being unable to cope with the other.
     
  5. JamesOakley

    JamesOakley Well-Known Member

    Joined:
    Apr 15, 2011
    Messages:
    83
    Likes Received:
    2
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Anyone else facing the same issue: Delete the CNAME, and leave the A-Record. I initially did it the other way around, which meant my mail.example.com subdomain only had a CNAME for it. That worked 90% of the time, but some mailing software, when sending e-mail to recipient@mail.example.com, resolved the CNAME and sent it to recipient@example.com instead, which is not the behaviour I wanted.

    Conclusion: On creating a domain, the DNS zone is set up with a mail. subdomain CNAME entry pointing to the main domain. If you then create a mail. subdomain in Cpanel, it will also create an A-Record for the mail. subdomain. For the zone editors in WHM and Cpanel to handle that zone correctly, you need to delete the CNAME entry.
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Of note, you can change the WHM > DNS Functions > Edit Zone Templates to hard-code an A record rather than a CNAME for the mail subdomain by changing the mail entry to the following:

    Code:
    mail IN A %ip%
    This would go into each the zone templates with a mail entry in them (standard and standardvirtualftp).
     
Loading...

Share This Page