Convert Bind zone file raw binary format to text

From ezUnix
Jump to: navigation, search
                                    pdf_icon.png Download this article as a single PDF document 

Introduction

In Bind v9.9.0 the default option for zone file format on a slave is a raw binary format.
For troubleshooting these can be converted back to text using named-compilezone.


Execution

Convert zone files using named-compilezone:

# /usr/sbin/named-compilezone -f raw -F text -o /tmp/zone.domain_name.tld domain_name.tld /var/named/data/zone.domain_name.tld

Then the contents of the tmp file can be viewed:

# cat /tmp/zone.domainname.co.uk


Create an alias

To make this a bit easier I added the following to /root/.bash_profile

myshowzone()
{
echo ${1?Error domain name is not defined e.g. showzone domain.org.uk }
/usr/sbin/named-compilezone -f raw -F text -o /tmp/myzone $1 /var/named/data/zone.$1
cat /tmp/myzone
rm -rf /tmp/myzone
}
alias showzone=myshowzone
echo “To view zone data run: showzone domain.tld”



Marcin


<comments />
Talk:Convert Bind zone file raw binary format to text