Active DNS domain name resolution

1. Set the host name

[root@www ~]# hostnamectl set-hostname www.linyu.com

2. Disable the firewall and Selinux

[root@www ~]# systemctl stop firewalld

[root@www ~]# setenforce 0

[root@www ~]# vim /etc/selinux/config

3. Install the BIND software

Query whether the machine is installed bind software to use the RPM – qa | grep bind, if you have to use the RPM -e bind

[root@www ~]# yum install -y bind-license bind-9.11.4 bind-libs bind-libs bind-export bind-utils

4. Enable the named service to boot automatically

[root@www ~]# systemctl enable named

5. Modify the master configuration file /etc/named.conf and add the following information

zone “linyu.com” IN { type master; file “linyu.zheng”; };

Zone “9.168.192.in-addr. ARPA “in {type master; The file “192.168.9. ARPA”;

};

6. Compile forward and reverse lookup files (note that this file will be placed under /var/named/)

[root@www ~]# cd /var/named/ && ls -l

[root@www named]# cp./named. Localhost linyu.zheng

Write a reverse lookup file [root@www named]# vim 192.168.9.arpa

7. Configure the hosts file and add the host mapping and DNS server address to resovl.conf

[root@www named]# vim /etc/hosts

[root@www named]# vim /etc/resolv.conf

8. Start the service for testing

[root@www ~]# systemctl start named && netstat -lnpt | grep :53

TCP 0 0 192.168.9.66:53 0.0.0.0:* LISTEN 8921/named TCP 0 0 192.168.129.1:53 0.0.0.0:* LISTEN 1274/dnsmasq

9. Client testing

Edit client /etc/resolv.conf to add nameserver 192.168.9.66

Query the IP address by domain name

Use the nslookup command to test

Query the IP address by domain name

Query domain names by IP address

Pay attention to

Change the owner group of forward and reverse lookup files written in /var/named to named

[root@www named]# ls-l linyu.zheng 192.168.9.arpa-rw-r -----. 1 root named 331 6月 22 19:17 192.168.9.arpa-rw-r ----- Root named 440 6月 22 19:16 Linyu.zhengCopy the code