The primary DNS server is refusing to send zone data to the secondary DNS server, breaking the replication of DNS records.
Common Causes and Fixes:
1. Incorrect allow-transfer Directive in Primary’s named.conf
- Diagnosis: On the primary DNS server, check the zone definition in its
named.conf(or equivalent configuration file). Look for theallow-transferdirective.grep "allow-transfer" /etc/named.conf - Cause: The secondary server’s IP address is not listed or is incorrectly specified in the
allow-transferlist for the zone. - Fix: Add the secondary DNS server’s IP address to the
allow-transferlist. For example, if your secondary is at192.168.1.10and your primary is at192.168.1.5:
Then, reload the primary DNS server’s configuration:zone "example.com" { type master; file "zones/db.example.com"; allow-transfer { 192.168.1.10; }; // Add or verify this line };systemctl reload named - Why it works: This directive explicitly grants permission to specific IP addresses to request zone transfers from the primary. Without it, the primary denies all such requests.
2. Firewall Blocking Port 53 (TCP/UDP)
- Diagnosis: From the secondary DNS server, attempt to connect to the primary DNS server on port 53 using
telnetornc.
If it times out or connection is refused, the firewall is likely the culprit. Also, check firewall rules on both the primary and secondary servers, and any network firewalls in between.# On secondary server telnet <primary_ip> 53 # Or nc -vz <primary_ip> 53 - Cause: A firewall on the primary server, the secondary server, or in the network path is preventing traffic on UDP port 53 (for queries) and TCP port 53 (for zone transfers).
- Fix: Allow traffic on TCP and UDP port 53 between the primary and secondary DNS servers.
firewalld(CentOS/RHEL/Fedora):# On primary server firewall-cmd --permanent --add-port=53/tcp firewall-cmd --permanent --add-port=53/udp firewall-cmd --reload # On secondary server (if it has outbound restrictions) firewall-cmd --permanent --add-port=53/tcp firewall-cmd --permanent --add-port=53/udp firewall-cmd --reloadiptables(Debian/Ubuntu/older systems):# On primary server iptables -A INPUT -p tcp --dport 53 -s <secondary_ip> -j ACCEPT iptables -A INPUT -p udp --dport 53 -s <secondary_ip> -j ACCEPT service iptables save # or equivalent command to persist rules # On secondary server (if it has outbound restrictions) iptables -A OUTPUT -p tcp --dport 53 -d <primary_ip> -j ACCEPT iptables -A OUTPUT -p udp --dport 53 -d <primary_ip> -j ACCEPT service iptables save # or equivalent command to persist rules
- Why it works: Zone transfers use TCP port 53 to reliably transfer the entire zone file. DNS queries typically use UDP port 53. Allowing traffic on these ports ensures the secondary can communicate with the primary for DNS lookups and zone data retrieval.
3. Incorrect masters Directive in Secondary’s named.conf
- Diagnosis: On the secondary DNS server, check the zone definition in its
named.conf. Look for themastersdirective.grep "masters" /etc/named.conf - Cause: The IP address of the primary DNS server is not correctly specified in the
masterslist for the zone on the secondary. - Fix: Ensure the primary DNS server’s IP address is listed correctly in the
mastersdirective.
Then, reload the secondary DNS server’s configuration:zone "example.com" { type slave; file "slaves/db.example.com"; masters { 192.168.1.5; }; // Ensure this is the primary's IP };systemctl reload named - Why it works: This directive tells the secondary server where to fetch the zone data from. An incorrect IP here means the secondary is trying to contact the wrong server.
4. named Service Not Running on Primary
- Diagnosis: Check the status of the BIND (named) service on the primary DNS server.
systemctl status named - Cause: The BIND service on the primary server is stopped or has crashed, meaning it cannot respond to any requests, including zone transfer requests.
- Fix: Start and enable the BIND service on the primary server.
systemctl start named systemctl enable named - Why it works: The
namedprocess is the daemon that handles DNS requests. If it’s not running, no DNS functionality, including zone transfers, can occur.
5. SELinux or AppArmor Restrictions
- Diagnosis: Check the system logs (e.g.,
/var/log/audit/audit.logfor SELinux, or/var/log/syslogfor AppArmor) for any AVC denial messages related tonamedor network operations.sudo ausearch -m avc -ts recent | grep named # Or sudo grep named /var/log/syslog - Cause: Security Enhanced Linux (SELinux) or AppArmor policies are preventing the
namedprocess from binding to network sockets or performing necessary file operations for zone transfers. - Fix:
- SELinux: Temporarily set SELinux to permissive mode to test:
sudo setenforce 0. If zone transfers work, you need to create or adjust SELinux policies. A common fix is to ensure thenamedprocess can access network ports and has the correct context for its zone files. For example, to allow transfers to a specific port:sudo semanage port -a -t named_port_t -p tcp 53. More specific rules might be needed depending on the exact denial. Re-enable enforcing mode withsudo setenforce 1after testing. - AppArmor: Edit the AppArmor profile for
named(usually in/etc/apparmor.d/named.confor/etc/apparmor.d/local/named.conf) to allow necessary network access or file permissions. Reload AppArmor profiles:sudo service apparmor reload.
- SELinux: Temporarily set SELinux to permissive mode to test:
- Why it works: SELinux and AppArmor enforce mandatory access control. Incorrect policies can block legitimate operations by the
namedservice, even if standard firewall rules permit the traffic. Adjusting these policies allowsnamedto perform its required functions.
6. Incorrect Zone File Permissions on Primary
- Diagnosis: Check the permissions of the zone file on the primary DNS server.
ls -l /var/named/zones/db.example.com # Or wherever your zone files are located - Cause: The
namedprocess (often running as usernamedorbind) does not have read permissions on the zone file it’s serving. While this typically affects serving queries, it can sometimes manifest as transfer issues if the process can’t access the data it’s supposed to send. - Fix: Ensure the
nameduser has read access to the zone file.chown named:named /var/named/zones/db.example.com chmod 644 /var/named/zones/db.example.com systemctl reload named - Why it works: The
namedservice needs to read the zone file from disk to send its contents during a zone transfer. Correct ownership and read permissions ensure the service can access the file.
After resolving these issues, you should see the secondary server successfully perform a zone transfer. The next error you might encounter is a "SERVFAIL" response for DNS queries if the secondary server itself is misconfigured or if there are still network issues preventing it from responding to queries.