When upgrading from BIND 9.6 to 9.9, you might encounter an unexpected behavior where your zone files appear as binary when transferred to slave servers. This typically happens after executing commands like:
cp -r /usr/local/sbin/* /usr/sbin/.
BIND 9.9 introduced a more efficient zone file storage format. The binary representation you're seeing is actually BIND's internal "raw" format, which occurs because:
- The zone file was loaded and saved in the new format
- Zone transfer defaults to raw format for efficiency
- The file permissions or copy operation triggered format conversion
Here are three methods to handle this:
Method 1: Force Text Transfer
Modify your slave server's named.conf:
zone "example.com" {
type slave;
masters { 192.0.2.1; };
file "db.example.com";
masterfile-format text; // Add this line
};
Method 2: Convert Existing File
Use named-compilezone to convert back to text:
named-compilezone -f raw -F text -o db.example.com.text example.com db.example.com
Method 3: Check File Operations
Verify your copy operation preserves file attributes:
rsync -a /usr/local/sbin/ /usr/sbin/
To avoid this during BIND upgrades:
# Before upgrade
rndc freeze example.com
cp db.example.com db.example.com.backup
named-compilezone -f text -F text example.com db.example.com > db.example.com.text
# Proceed with upgrade
Use these commands to inspect files:
file db.example.com
strings db.example.com | head
ls -la db.example.com
Remember that binary zone files are valid - they load faster and use less disk space. The text format is primarily for human readability.
When upgrading from BIND 9.6 to BIND 9.9, you might encounter an issue where zone files appear as binary when viewed with text editors like less
. This typically happens after copying files between directories during the upgrade process.
> less db.example.com
"db.example.com" may be a binary file. See it anyway?
BIND 9.9 introduced a more efficient zone file format for slave servers. When transferring zone files between master and slave servers, BIND may:
- Compress the zone file for faster transfers
- Use a binary format for better performance
- Store additional metadata not present in plain text format
To convert the binary zone file back to human-readable format, use BIND's named-compilezone
utility:
named-compilezone -f raw -F text -o db.example.com.text example.com db.example.com
This command will:
-f raw
: Use raw input format-F text
-o
: Specify output file
To avoid this issue when upgrading BIND versions:
# Instead of copying all files:
cp /usr/local/sbin/named /usr/sbin/named
cp /usr/local/sbin/rndc /usr/sbin/rndc
# Leave other files in their original locations
Or better yet, use your package manager:
# For Debian/Ubuntu:
apt-get install bind9
# For RHEL/CentOS:
yum install bind
After conversion, always verify your zone files:
named-checkzone example.com db.example.com.text
This ensures your DNS records maintain proper formatting and syntax.
If you prefer working with binary zone files for performance reasons, you can manage them via rndc:
rndc reload example.com
This will reload the zone without converting it to text format.