Master BIND DNS Server: Installation, Configuration, and Testing Guide
This comprehensive guide walks you through installing BIND on Linux, configuring primary and secondary DNS zones, setting up forward and reverse lookups, managing zone files, and testing resolution on both Windows and Linux clients, providing step‑by‑step commands and configuration examples.
Linux System Administrator Advanced: BIND DNS Server from Beginner to Master
Case: BIND Installation and Configuration Details
1. Install BIND Packages
Install BIND using the package manager or an RPM file.
yum install bind -y rpm -ivh bind-x.x.x-x.el7.x86_64.rpm2. Locate BIND Configuration Files
The main configuration file is /etc/named.conf, which controls global settings such as zones, forwarders, and ACLs. Zone configuration files include /etc/named.rfc1912.zones and /var/named/named.localhost.
3. Configure the Primary DNS Server (Forward Lookup)
Edit /etc/named.conf to set the listening port, directory, and allowed query networks.
options {
listen-on port 53 { 20.0.0.100; };
directory "/var/named";
allow-query { any; };
};
zone "my.com" IN {
type master;
file "my.com.zone";
allow-update { none; };
};Create the zone file my.com.zone with SOA, NS, A, MX, CNAME, and wildcard records.
$TTL 1D
@ IN SOA my.com. rname.invalid (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS my.com.
A 20.0.0.11
MX 10 mail.my.com.
www IN A 20.0.0.20
ftp IN CNAME www
* IN A 20.0.0.204. Configure Reverse Lookup
Add a reverse zone for the IP range.
zone "0.0.20.in-addr.arpa" IN {
type master;
file "my.com.zone.local";
allow-update { none; };
};In the reverse zone file, map IP addresses back to hostnames.
$TTL 1D
@ IN SOA my.com. rname.invalid (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS my.com.
100 IN PTR www.my.com.
200 IN PTR mail.my.com.5. Set Up Master‑Slave DNS Synchronization
On the master server, allow zone transfers to the slave IP.
zone "my.com" IN {
type master;
file "my.com.zone";
allow-transfer { 20.0.0.12; };
};
zone "0.0.20.in-addr.arpa" IN {
type master;
file "my.com.zone.local";
allow-transfer { 20.0.0.12; };
};On the slave server, configure the zones as slaves.
zone "my.com" IN {
type slave;
file "slaves/my.com.zone";
masters { 20.0.0.11; };
};
zone "0.0.20.in-addr.arpa" IN {
type slave;
file "slaves/my.com.zone.local";
masters { 20.0.0.11; };
};6. Start BIND Service and Test Resolution
Start or restart the BIND service and disable firewalls if necessary.
systemctl start named
systemctl stop firewalld
setenforce 0Test forward lookups on Windows using nslookup and on Linux using host or nslookup commands.
nslookup www.my.com 20.0.0.11
host 20.0.0.100Verify reverse lookups similarly.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
