Operations 8 min read

How to Set Up Bind DNS on CentOS 8: A Step‑by‑Step Guide

This tutorial walks through installing and configuring the Bind DNS service on a CentOS 8.3 virtual machine, covering environment preparation, SELinux and firewall settings, main and zone file configuration, and how to start and verify the DNS server.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Set Up Bind DNS on CentOS 8: A Step‑by‑Step Guide

DNS Forward Lookup

Experiment environment:

CentOS 8.3.2011 IP address 192.168.100.50, VMware NAT network, domain to resolve test.com.

Environment preparation

Configure yum repository (omitted) and install common tools. # yum install -y vim net-tools bind bind-utils Disable SELinux and firewall (or open DNS ports).

# setenforce 0  # temporary disable SELinux (will revert after reboot)
# systemctl stop firewalld && systemctl disable firewalld

Permanent SELinux disable by editing the configuration file. # vim /etc/sysconfig/selinux Change SELINUX=enforcing to SELINUX=disabled and save.

Open firewall for DNS service.

# firewall-cmd --add-service=dns --permanent
# firewall-cmd --reload

Experiment steps

Edit the main Bind configuration file /etc/named.conf. The file is divided into global options, logging, zone definitions, and include statements. # vim /etc/named.conf Adjust the global options so the server listens on all addresses and allows any host.

named.conf global options
named.conf global options

Define a zone for test.com directly in the main file (remember the trailing semicolons).

named.conf zone definition
named.conf zone definition

Zone types supported by Bind:

Forward (转发)

Master (主)

Slave (从)

Hint (根)

Zone files are stored under /var/named. Copy the example file and edit it.

# cp named.localhost test.com.zones
# vim test.com.zones
test.com zone file example
test.com zone file example

The @ symbol represents the current origin (the zone name). $TTL sets the default TTL, and the SOA record is mandatory as the first record in the file.

4.3.5.1. The @ (at‑sign) When used in the label (or name) field, the at‑sign represents the current origin. At the start of the zone file, it is the <zone_name> followed by a trailing dot (.).

Typical records in the zone file:

NS records specify which name servers serve the zone.

A records map a domain name to an IPv4 address.

AAAA records map a domain name to an IPv6 address.

After editing, set proper ownership and enable the service.

# chgrp named test.com.zones
# systemctl enable --now named

Test the DNS resolution from the host.

DNS resolution test result
DNS resolution test result
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

networkLinuxDNSSystem AdministrationBINDCentOS
MaGe Linux Operations
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.