centOS7 DNS Domain Name Resolution Service Setup - Forward Resolution

centOS DNS Domain Name Resolution Service Setup-Forward Resolution

------------------------------------ Basic Overview-------------------------

The function of DNSX system in network is to maintain an address database, which records the corresponding relationship between various host domain names and IP addresses in order to provide forward or reverse address query services for client programs, that is, forward and reverse resolution

  • Forward Resolution: Find the IP address based on the domain name, which resolves the specified domain name to the corresponding IP address.Forward domain name resolution is the most basic and common function of DNS server.
  • Reverse resolution: Finds a domain name based on the IP address, that is, the specified domain name is resolved to the corresponding IP address.Reverse domain name resolution is not very common and is only used for special occasions, such as anti-spam authentication.


Common DNS types
1. Cache Domain Name Server: Provides only the caching function of domain name resolution results, in order to improve query speed and efficiency, but there is no region address data under your control.When building a cached domain name server, you must set the root domain and specify a different DNS server as the resolution source.
2. Primary Domain Name Server: Maintain the address database of a specific DNS zone, and have autonomous control over the parsed records. It is the only authoritative server or official server that exists in the specified zone.When you build a primary domain name server, you need to create your own address data file for the area you are responsible for.
3. From Domain Name Server: Provides the exact same DNS resolution server as the primary domain name server, usually used for hot backups of DNS services.For clients, the query results are the same whether they use a primary domain name server or a secondary domain name server.The key difference is that the resolution results provided from the domain name server are not self-determined.Instead, it comes from the primary domain name server.When building a slave server, you need to specify the location of the primary domain name server so that the server can automatically synchronize the address database for the zone.


DNS (Domain Name System), a distributed database on the World Wide Web that maps domain names and IP addresses to each other, enables users to access the Internet more easily without having to remember IP strings that can be read directly by machines.The process of getting the IP address corresponding to a domain name through a domain name is called domain name resolution (or hostname resolution).The DNS protocol runs on top of the UDP protocol using port number 53.

-------------------------Set up DNS domain name resolution service---------------------

1, Use first when connected to the network yum Warehouse DNS Service Package

[root@localhost ~]# yum install bind -y 


2,See DNS Domain Name Resolution Service Requires What Important Profiles

[root@localhost ~]# rpm -qc bind

3. Enter the master profile, modify the listening address in the master profile and the network segments that allow access to DNS services, save by wq after modification

[root@localhost~]# vim /etc/named.conf


4,After modifying the master profile, forward parsing also requires modifying the zone profile

[root@localgost~]# vim /etc/named.rfc1912.zones

The main changes are as follows


5,Get into"/var/named"Catalog, copy one"named.localhost"File, named"kgc.com.zone"

[root@localhost ~]# cd /var/named/
[root@localhost named]# cp -p named.localhost kgc.com.zone


6,Modify Zone Data File

[root@localhost named]# vim kgc.com.zone (modify data profile)

$TTL 1D->//Lifetime of valid parsing records
@      IN SOA  kgc.com.  admin.kgc.com (->//SOA tags, domain names, managed mailboxes
0; serial ->#Version Serial Number
1D ; refresh -—> #Survival address of invalid parsed record
1H ; retry -— >#Refresh time, interval between downloads of address data
1W ; expire -—> #Failure time, abandon if event cannot be downloaded beyond
3H ) ; minimum->#Cache can be saved for up to 3 hours
NS       kgc.com.->Name of the server
A—>#Address of host server
IN MX 10 mail.kgc.com. ->#Mail Exchange Record
www  IN A>#Host Resolution Address
ftp IN A>#ftp
smtp IN CNAME www->#Alias resolution
* IN A ->#Generic domain name resolution


7. Turn off firewalls and enhanced security features, and then turn on DNS services

[root@localhost ~]#systemctl stop firewalld.service
[root@localhost~]#setenforce 0
[root@locailhost~]systemctl start named

8,Will be local DNS The server IP Change the address to your own IP Address, with your own DNS Server to resolve domain name.Check to see if the change was successful

echo "nameserver" > /etc/resolv.conf
cat /etc/resolv.conf



1,Use host Command Forward Resolve Domain Name

[root@localhost~]# host www.kgc.com
[root@localhost~]# host smtp.kgc.com
[root@localhost~]#host ftp.kgc.com
[root@localhost~]#host abc.com


If you don't have the host command, you can just install it
centOS7 DNS-

Tags: Linux DNS Database network vim

Posted on Thu, 05 Sep 2019 20:24:03 -0700 by Nicoza