e0xbr

Member
Jul 7, 2011
5
0
51
Hello

I have CPANEL + CentOS

I need to multiple insert a NS record and a A record on all DNS Zones. I have a lot of zones, and to insert one by one is out of question...

How can I do that with cpanel?


Thanks!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,606
33
238
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello e0xbr,

Are you actually adding a record to all zones or changing an existing record in all zones? If you are adding a record, you could do the following:

Code:
cp -R /var/named /var/named.bak110713
cd /var/named
for x in `cat /etc/trueuserdomains | cut -d: -f1` ; do echo "$x. 86400 IN NS ns#.domain.com." >> /var/named/$x.db ; done
for x in `cat /etc/trueuserdomains | cut -d: -f1` ; do echo "ns#.$x. 14400 IN A IP#" >> /var/named/$x.db ; done
Please replace ns#.domain.com. with the actual nameserver name and please replace IP# with the actual IP number. Do not replace the other details.

After doing the above, you'd want to follow the details in this forum thread on updating the serials for the zones:

http://forums.cpanel.net/f5/how-incremental-serial-number-dns-zone-211732.html#post873142

If anything goes wrong, you will always have /var/named.bak110713 to use to restore the prior working zones.

Thanks.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,606
33
238
somewhere over the rainbow
cPanel Access Level
Root Administrator
Please specify exactly what needs added to what. You mention multiple A records with different IPs, but you aren't providing enough information on why each would need a different IP. The issue here is that if you need 50 different IPs for each different zone, you are probably better off doing it manually period.