Import/Convert BIND zone file to cPanel/WHM server

ashworth102680

Active Member
May 3, 2007
26
1
153
We have a ton of domains we're trying to take control over from GoDaddy (about time, I know). All of the DNS settings for each domain name exports to a bind-compatible zone file, but in all my searching, I haven't found any creative solutions for either:

1) Convert from BIND format to cPanel's format (so I can mostly copy/paste into added domains)

2) Import via some script to convert and insert the records on the fly

I'm open to any options, but copy/paste for every zone file for every domain doesn't seem like the most productive route to take. Your responses are valued.
 
Last edited:

ashworth102680

Active Member
May 3, 2007
26
1
153
Nobody's come across this before? Getting zone files converted from BIND to cPanel so we don't need to manually data enter all the zones/records? This seems like it would be something affecting most of us if migrating large quantities of websites from another hosting vendor.
 

cPanelKenSmith

Member
Staff member
Aug 17, 2010
10
0
126
The zone format used by cPanel servers is BIND compatible because the default DNS server in use is BIND. You can also choose to use NSD, however that loads BIND zone files as well.

You can see the zones currently on the machine by looking in /var/named/*.db. You'll find them all to be standard BIND zone files.
 

cPanelKenSmith

Member
Staff member
Aug 17, 2010
10
0
126
Okay, so I was thrown off a bit when I looked at the zone files that cPanel created vs. the BIND zone files that I have. They are noticeably different in structure. Maybe cPanel doesn't care, and will automatically detect and fix it?

chirpy's post below suggests to me that there's more to it than we may be talking about here.

http://forums.cpanel.net/f5/import-bind-into-dns-only-47561.html
The zones themselves are bind zones that bind is happy to load and use. Our UI does put some extra comments into the zone files that wouldn't be there normally, but that's because our UI is what's writing and reading them.

As a test, you could simply copy a couple ones over to a test cpanel machine to the /var/named directory and then go to the "edit dns zone" tool within WHM. If the zones show up okay in the UI you're all set.

If not, then you may need to modify a few things as Chirpy points out. Also take note that the thread you point out is over 5 years old now. The code involved has changed quite a bit since then.
 

cPanelKeithS

Active Member
Staff member
Oct 14, 2008
32
1
133
I have noticed in the past that the Edit DNS Zone section of WHM does look for comments in the zone file that lets it know the zones were created by cPanel & WHM. This is an example from one of the zones on my server.

; cPanel first:11.30.0.32 (update_time):1328727535 Cpanel::ZoneFile::VERSION:1.3 hostname:vps.cpks.info latest:11.30.5.6
; Zone file for keithacct2.test

If you replicate those comments, and have a properly BIND formatted zone file, cPanel & WHM should populate properly.