Peters School of Business · Assiniboine College · NETW-0014
2 hours · Lab 3D · PTR records, in-addr.arpa, zone transfer, allow-transfer, dig interrogation
Forward DNS verified — now extend with reverse and redundancy
dig @192.168.50.1 s1.yourname.net — should return S1's IP. Ask: "What is a reverse DNS lookup, and when would you need it?" — maps IP to hostname. Applications: SSH login logs showing hostnames instead of IPs; email servers check PTR records to verify that a sending mail server's IP matches its claimed hostname; security tools use PTR for readable output in reports.50.168.192.in-addr.arpa. The octets are reversed because DNS hierarchy reads left-to-right (general → specific), but IP addresses read left-to-right (network → host) — reversing the octets aligns them properly in the DNS tree.Lab 3D — Reverse zone, secondary DNS on S2, zone transfer verification, allow-transfer, dig
Part 1 — Add the reverse zone declaration (15 min)
/etc/bind/named.conf.local on S1. Add the reverse zone declaration below the existing forward zone:
zone "50.168.192.in-addr.arpa" {
type primary;
notify no;
allow-query { any; };
file "/etc/bind/db.yourname.rev";
};
.in-addr.arpa.
sudo named-checkconf. Fix any errors before creating the database file.Part 2 — Create the reverse zone database file (20 min)
sudo cp /etc/bind/db.127 /etc/bind/db.yourname.rev. Edit: sudo nano /etc/bind/db.yourname.rev.$TTL 2D
@ IN SOA s1.yourname.net. hostmaster.yourname.net. (
2024112101 ; serial
3600 ; refresh
3600 ; retry
3600 ; expire
3600 ) ; minimum
@ NS s1.yourname.net.
1 PTR s1.yourname.net.
2 PTR s2.yourname.net.
1 refers to 192.168.50.1, 2 refers to 192.168.50.2. PTR targets must be FQDNs with trailing dots.
sudo named-checkzone 50.168.192.in-addr.arpa /etc/bind/db.yourname.rev. Restart BIND9. Verify in the journal: look for both zones loading successfully.dig @192.168.50.1 -x 192.168.50.1. Should return s1.yourname.net.. Also test: nslookup 192.168.50.2 192.168.50.1. Should return s2.yourname.net.Part 3 — Configure S2 as a secondary DNS server (30 min)
/etc/bind/named.conf.local on S2. Add the secondary zone declaration:
zone "yourname.net" {
type secondary;
file "db.yourname.net";
primaries { 192.168.50.1; };
};
file "db.yourname.rev".
/etc/bind/named.conf.local on S1 and add allow-transfer { 192.168.50.2; }; inside each zone declaration:
zone "yourname.net" {
type primary;
notify yes; (change from 'no' to trigger notification on change)
allow-query { any; };
allow-transfer { 192.168.50.2; };
file "/etc/bind/db.yourname.net";
};
sudo journalctl -u named -f. You should see:
transfer of 'yourname.net/IN' from 192.168.50.1#53: Transfer status: success
dig @192.168.50.2 s1.yourname.net. Confirm the zone loaded from the transfer file in /var/cache/bind/.dig @192.168.50.1 yourname.net AXFR from S2's perspective — only S2 should be allowed. Try from S3: dig @192.168.50.1 yourname.net AXFR — should return REFUSED.Part 4 — Using dig for DNS interrogation (30 min)
dig @server domain [type]
NOERROR = found, NXDOMAIN = name doesn't exist, REFUSED = server won't answer this query, SERVFAIL = server error.
dig @192.168.50.1 yourname.net ANY — query all record types
dig @192.168.50.1 s1.yourname.net — standard A query
dig @192.168.50.1 -x 192.168.50.1 — reverse lookup (PTR)
dig @192.168.50.1 yourname.net NS — nameserver records
dig @192.168.50.1 yourname.net SOA — SOA record (verify serial)
dig @192.168.50.1 yourname.net AXFR — full zone transfer (should succeed from S1 to itself)
dig @192.168.50.1 yourname.net AXFR from S3 — should return REFUSED
dig @172.17.0.1 google.com — verify S1 forwards to classroom DNS for internet names. dig @192.168.50.1 google.com — verify S1 also forwards correctly when queried directly.Public zone transfer with dig — what AXFR reveals
dig @nsztm1.digi.ninja zonetransfer.me AXFR. This domain exists specifically to demonstrate zone transfer exposure.dig @192.168.50.1 yourname.net AXFR from S3 — REFUSED. The allow-transfer restriction prevents this exact scenario.Learning outcomes — by end of Day 4, students can…
Common issues and fixes
| Issue | Likely cause | Fix |
|---|---|---|
| Reverse lookup returns NXDOMAIN | PTR records missing trailing dots on FQDNs, or zone not reloaded after adding PTR records | Every PTR target must end with a dot: 1 PTR s1.yourname.net. Reload: sudo systemctl reload named |
| Zone transfer on S2 fails — "connection refused" in log | S1's named.conf.local still has notify no and no allow-transfer for S2 | Add allow-transfer { 192.168.50.2; }; to both zone declarations on S1. Change notify no to notify yes. Restart S1's named |
| dig AXFR from S2 returns REFUSED | allow-transfer not yet added to S1's zone, or added to wrong zone block | Check S1's named.conf.local — allow-transfer must be inside the zone block, not outside it. Run named-checkconf after editing |
| S2's zone transfer succeeds but dig @S2 returns SERVFAIL | S2's BIND9 loaded a corrupted or incomplete zone file from the transfer | Delete the cached file on S2: sudo rm /var/cache/bind/db.yourname.net. Restart S2's named to re-transfer |