Convert DNS Export Into BIND Format

One bright sunny day I received a sloppy text file which was most likely exported through a zone AXFR and my task was to import the records into a CDN’s DNS. The import was not very happy with it, however, I did figure out how to fix the issue without manually editing any data by converting the DNS export into BIND format.

The command is called named-compilezone and it’s pretty awesome (included in the bind-utils pkg).  Essentially all you need to do is import the text file and write it out as raw, then import the raw and export as text. It’s a two step process but you could make it a one-liner:

$ named-compilezone -f text -F raw -o YourFile.com.raw DomainName.com OriginalFile.txt && named-compilezone -f raw -F text -o YourNewFile.bind.text YourDomain.com YourFile.com.raw

Originally I found the idea on Internet Systems Consortium. In my opinion, they are one of the least known and thanked software companies that have greatly contributed to the internet infrastructure in general.

BINDbaɪnd/, or namedneɪmdiː/, is the most widely used Domain Name System (DNS) software on the Internet. On Unix-like operating systems it is the de factostandard.

The software was originally designed at the University of California Berkeley (UCB) in the early 1980s. The name originates as an acronym of Berkeley Internet Name Domain, reflecting the application’s use within UCB. The software consists, most prominently, of the DNS server component, called named, a contracted form of name daemon. In addition, the suite contains various administration tools, and a DNS resolver interface library. The latest version of BIND is BIND 9, first released in 2000.
[credit goes to Wikipedia]

Share
Disqus Comments Loading...

Recent Posts

FreeNAS Error Creating Pool

command '('gpart', 'create', '-s', 'gpt', '/dev/da8')' returned non-zero exit status 1. If you get this error while trying to create… Read More

June 7, 2019 3:44 pm

Change Grub Default Boot Entry on Linux Mint

I'm dual booting Windows and Linux Mint on my laptop. The grub default is to boot into Linux Mint, however… Read More

April 23, 2019 7:45 pm

How to Reset Secure Channel On Active Directory Domain Controller

When you're a little too careless about virtualizing your domain controllers, cloning, migrating, backing up and restoring, returning from vacation… Read More

April 21, 2019 8:14 am

Run Systemd Script Before System Shutdown

I tried to retain the NGINX FastCGI cache and have it persist across system reboots instead of being ephemeral by… Read More

April 20, 2019 10:14 am

Learn Systemctl Usage to Manage Systemd Service in Linux

Systemd is new service manager for Linux. It's a replacement for all previous init systems (SysV/SysVinit & Ubuntu's Upstart) and… Read More

April 20, 2019 7:55 am

Force Delete Windows Server DHCP Failover Relationship

If you've found yourself here then chances are you messed up one of your domain controllers or at least one… Read More

April 20, 2019 5:54 am