How to manually edit zone records?

jndawson

Well-Known Member
Aug 27, 2014
284
31
78
Western US
cPanel Access Level
DataCenter Provider
CLOUDLINUX 7.8 WHM v90.0.10 Bind 9.11 DNS Clustering

We shutdown one of our DSL systems and now need to remove around 2700 IPs from the zone record. Using either of the WHM zone editors is extremely time consuming, so we edited the zone file manually, and ran the following:

Code:
[ [email protected] named># nano -w domain.com.db
(removed unneeded records, incremented Serial Number)
[ [email protected] named># rndc flush
[ [email protected] named># rndc dumpdb
[ [email protected] named># rndc reload
Old zone still displays in WHM; file still shows our edits. Restarting named via WHM has no effect.

Tried again, but stopped named prior to editing. Tried using Webmin to edit Serial Number - unneeded records were still deleted - and saved.

The old zone record keeps returning in WHM even though the text file still reflects our edits. What are we missing?
 
Last edited by a moderator:

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
Hello,


First of all, what you're requesting is a feature request before this doesn't exist by default: https://features.cpanel.net/topic/bulk-change-modify-dns-zone-files


Secondly which nameserver are you running? If you're using PowerDNS, while it does use a bind-backend it does still have it's own reload commands. When you make these changes and then run the following does the content update as expected?

Code:
/scripts/rebuilddnsconfig
 

jndawson

Well-Known Member
Aug 27, 2014
284
31
78
Western US
cPanel Access Level
DataCenter Provider
First of all, what you're requesting is a feature request before this doesn't exist by default: https://features.cpanel.net/topic/bulk-change-modify-dns-zone-files
No. We want to manually edit the zone text files. In this case, just one zone to delete about 2700 records.

Secondly which nameserver are you running? If you're using PowerDNS, while it does use a bind-backend it does still have it's own reload commands. When you make these changes and then run the following does the content update as expected?

Code:
/scripts/rebuilddnsconfig
Using Bind. /scripts/rebuilddnsconfig did not use the manually-edited zone record, but reloaded the cached record which was deleted with DNS shutdown.

The problem is that we have manually edited zones in the past, but now, there seems to be no way to manually edit zones.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
The cache is most certainly the issue, I'm not understanding why it's not reloading the zone files based on the serial number increment and clearing the cache.

If you dump the cache manually it should work:

Code:
rndc flush
then reload
Code:
rndc reload
You can create a cache dump at /var/cache/bind/named_dump.db by running:

Code:
rndc dumpdb -cache
 

jndawson

Well-Known Member
Aug 27, 2014
284
31
78
Western US
cPanel Access Level
DataCenter Provider
The cache is most certainly the issue, I'm not understanding why it's not reloading the zone files based on the serial number increment and clearing the cache.

If you dump the cache manually it should work:

Code:
rndc flush
then reload
Code:
rndc reload
You can create a cache dump at /var/cache/bind/named_dump.db by running:

Code:
rndc dumpdb -cache
Not sure why you thought this would work when it didn't work the dozen or so times we've tried it.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
@jndawson

I completely overlooked the fact that you'd flushed the cache prior, please excuse my oversight. I am human and make errors on occasion. For some reason, I thought you'd just run rndc reload.

I can't replicate this behavior on a system running CentOS 7 w/ cPanel & WHM v90.0.12
The steps I took were:

  1. Edit DNS zone file :
    Code:
    vi /var/named/domain.tld.db
  2. Modify A record IP for one domain
  3. Update serial
  4. Clear any caches
    Code:
    rndc flushrndc reload
  5. Restart the nameserver (just for good measure though it shouldn't be necessary)
    Code:
    /scripts/restartsrv_named
  6. Check zone file and WHM for update
The only difference I have is that my server is not clustered. Does any other server in the cluster make changes to this one (i.e., are any set to write or synchronize changes to this one)
 

jndawson

Well-Known Member
Aug 27, 2014
284
31
78
Western US
cPanel Access Level
DataCenter Provider
@jndawson
[snip]
The only difference I have is that my server is not clustered. Does any other server in the cluster make changes to this one (i.e., are any set to write or synchronize changes to this one)
Yes, clustered as noted in the original post.
I would expect that after flushing, stopping, making the changes, restarting, one would think that DNS would use the newly edited zone.
 

jndawson

Well-Known Member
Aug 27, 2014
284
31
78
Western US
cPanel Access Level
DataCenter Provider
Update: We rebooted the server for a kernel update. We expected that the edited zone would be picked up. It wasn't. The server is still displaying the old zone in WHM, even though the hard file is the edited zone.

We have done manual edits in the past with no issues, but it was a couple of years ago. Clearly something was broken on the back end while trying to implement the new zone manager.

Our next effort will include disabling DNS clustering and see if THAT works.
 

cPSamuelM

Technical Analyst Team Lead
Staff member
Nov 20, 2019
196
37
103
USA
cPanel Access Level
Root Administrator
Hello @jndawson

Based on the information you provided, it does sound as though DNS Clustering is the culprit. If disabling DNS Clustering temporarily does not solve the problem, then please feel free to submit a ticket using the link my signature.