How to reload zone file after manual editing

ithurtswhenIP

Registered
Jan 23, 2020
3
0
1
UK
cPanel Access Level
Reseller Owner
Hi there,

I'm currently trying to write a script to automatically move DNS zone files from an old FreeBSD BIND server over to cPanel and I'm trying to figure out the individual moving parts. I understand that I need the cPanel default comments in the top of the zone file in order for the imported zone file to be visible in the Zone Editor in cPanel/WHM (which works, they do show up), but the imported zone doesn't seem to 'propagate' down to our (cPanel) nameservers.

I've incremented the serial as you would with a manual change on BIND, but it still doesn't push the changes down to the nameservers themselves. They're visible in cPanel/WHM, but in order for the changes to be recognised by the nameservers I need to add a record in the Zone Editor and then remove it.

It seems to me like the Zone Editor does something when you change a record to 'push' the changes and this is what I need to replicate in my script once the zone file has copied from the old server to cPanel. It doesn't seem to be rndc reload and I can't find the code used for the Zone Editor in order to reverse engineer it myself.

Can anyone help with this? All insight is good insight :cool:
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,269
313
Houston
Hello,

Most likely you need to reload the zones. Why this is happening, is cPanel expects that the zone file is created upon account creation and performs the reload of the zone/update of named.conf when the account's userdata is present.

What nameserver are you using on the cPanel server you're moving the zones too? BIND or pdns?

If you're using bind you'll want to most likely run rndc reload and pdns pdns_control reload if it's a change and pdns_control rediscover if it's a new zone file (i.e., it did not exist in the named.conf prior) more information on pdns_control commands can be found here: BIND zone file backend — PowerDNS Authoritative Server documentation
 

ithurtswhenIP

Registered
Jan 23, 2020
3
0
1
UK
cPanel Access Level
Reseller Owner
Hello,

Most likely you need to reload the zones. Why this is happening, is cPanel expects that the zone file is created upon account creation and performs the reload of the zone/update of named.conf when the account's userdata is present.

What nameserver are you using on the cPanel server you're moving the zones too? BIND or pdns?

If you're using bind you'll want to most likely run rndc reload and pdns pdns_control reload if it's a change and pdns_control rediscover if it's a new zone file (i.e., it did not exist in the named.conf prior) more information on pdns_control commands can be found here: BIND zone file backend — PowerDNS Authoritative Server documentation
Hi Lauren,

Thanks for your reply. Neither of those commands work unfortunately . pdns_control doesn't exist as a command and rndc reload doesn't appear to work, I get the following output:

WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
rndc: connect failed: 127.0.0.1#953: connection refused

Bear in mind that while this server has the zone files, the server in question isn't actually the nameserver. I'm not sure if this makes any difference though.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,269
313
Houston
I am so sorry, please accept my humblest apologies I completely missed your response here.

pdns_control most certainly exists, if you're running PowerDNS.

Code:
[[email protected] ~]# pdns_control reload
Ok

WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
rndc: connect failed: 127.0.0.1#953: connection refused
This error is typical when you're running named but for some reason, it was unable to start.

In regard to the above error what is the output of the following:


Code:
ps faux |grep named
Code:
netstat -plan |grep ":953"
What is the selection at WHM>>Service Configuration>>Nameserver Selection?

If it is currently set to named or pdns what is the output of the following:
Code:
/scripts/rebuilddnsconfig