Binary zone file on BIND9

binddomain-name-system

A DNS Master zone file has been transferred to a slave, but I cannot read the zone file:

> less db.example.com

"db.example.com "may be a binary file.  See it anyway?

This happened after I used this command:

cp -r /usr/local/sbin/* /usr/sbin/.

I installed bind V.9.9 instead of V.9.6. I would like to be able to read the zone file as plain text.

Best Answer

Slave zone data files in BIND 9.9 are in "raw" format by default. You can convert "raw" format zone files to "text" format using the named-compilezone utility that comes with BIND.

raw to text:

# convert raw zone file "example.net.raw", containing data for zone example.net,
# to text-format zone file "example.net.text"
#
#   (command)     (format options)   (output file)  (zone origin) (input file)
named-compilezone -f raw -F text -o example.net.text example.net example.net.raw

text to raw:

# convert text format zone file "example.net.text", containing data for zone
# example.net, to raw zone file "example.net.raw"
#
#   (command)     (format options)   (output file) (zone origin)  (input file)
named-compilezone -f text -F raw -o example.net.raw example.net example.net.text