How to configure a LAN DNS server?
Preparatory work:
Prepare 3 servers:
Http server:192.168.1.3
Dns server: 192.168.1.4
Dns client:192.168.1.5
3 servers, DNS and HTTP services should be turned on in the firewall
1. Simply build a http service on the http server for testing
(1) yum-y install httpd
(2) [root@client Desktop] # echo "welcome to china test" > / var/www/html/index.html
[root@client Desktop] # systemctl restart httpd
[root@client Desktop] # systemctl enable httpd
two。 Install the dns service on the dns server and configure the dns master configuration file
Here three places are changed to: any
3. Create a domain tianyun.com in the main configuration file and add 4 lines of code:
Zone "tianyun.com" {
Type master
File "tianyun.com.zone"
}
4. Edit zone configuration file: vim / var/named/tianyun.com.zone
@ IN SOA dns root (2020030700 1H 15m 1W 1D)
@ IN NS dns
Dns IN A 192.168.1.4
Www IN A 192.168.1.3
@ indicates the current domain name
IN:internet
Www.tianyun.com=www
SOA: starting authorization record mandatory
NS:DNS server record enforcement
A: host record
CNAME: alias record
2020030700: update serial number
1H update time 1 hour
15m retry delay 15 minutes
1W failure time 1 week
1D invalid resolution record cache time 1 day
[root@dns-server Desktop] # systemctl restart named restart service
5. test
Change the DNS of the http sever service to: 192.168.1.4
[root@http-sever Desktop] # vim / etc/resolv.conf
Nameserver 192.168.1.4
When ping www.tianyun.com, automatically parse to 192.168.1.3, so the experiment is successful.