Bind Application of DNS Domain name Resolution
I. Environmental preparation
Virtual machine: vmware workstation 11
Linux system: centos7.3,centos6.8
Bind installation: yum install bind
DNS master server A: environment: centos7.3 IP:172.16.252.35 DNS hostname: dns1.ilinux.io.
DNS slave server B: environment: centos6.8 IP:10.0.0.68 DNS hostname: dns2.ilinux.io (for subsequent experiments)
Virtual domain name: www.ilinux.io
Modify the bind main configuration file (all centos7.3,6.8 are modified):
# Note: only the changes in options {} are listed, and the rest remain unchanged: vi / etc/named.conf options {/ / listen-on port 53 {127.0.0.1;}; # by default, all IP listeners are allowed to listen on port 53 / / listen-on-v6 port 53 {:: 1;}; / / allow-query {localhost;}; # disable only allows native dnssec-enable no parsing # for convenience, turn off the DNS security feature dnssec-validation no;}
1 forward parsing
Steps
Step 1: edit the parsed database file
Vi / var/named/ilinux.io.zone $TTL 600ilinux.io. IN SOA ilinux.io. Nsadmin.ilinux.io. (2017052301 1H 5m 1W 6H) IN NS dns1.ilinux.io. IN NS dns2.ilinux.io. IN MX10 mx1.ilinux.io. Dns1.ilinux.io. IN A 172.16.252.35 dns2.ilinux.io. IN A 10.0.0.68 mx1.ilinux.io. IN A 10.10.1.1 www.ilinux.io. IN A 172.16.1.1 web IN CNAME www ftp IN A 172.16.0.111
Step 2: edit the bind secondary configuration file
Vi / etc/named.rfc1912.zones... (omit part of the content) # add the following content to the last line: zone "ilinux.io" IN {type master; file "ilinux.io.zone";}
Step 3: specify the resolution server IP
Vi / etc/resolv.conf nameserver 172.16.252.35
Step 4: permission and group modification (based on security considerations)
Chmod o = / var/named/ilinux.io.zone chown: named/ var/named/ilinux.io.zone ls-l / var/named/ilinux.io.zone-rw-r-. 1 root named 454 May 28 10:17 / var/named/ilinux.io.zone
Step 5: check for syntax errors
Named-checkconfnamed-checkzone ilinux.io ilinux.io.zone zone ilinux.io/IN: loaded serial 2017052301 OK # verify correct
Step 6: reload the parsed database file and configuration file
Rndc reload server reload successful systemctl restart named.service
Step 7: test domain name resolution
Dig www.ilinux.io; DiG 9.9.4-RedHat-9.9.4-37.el7 www.ilinux.io;; global options: + cmd;; Got answer:;-> HEADERHEADERHEADERHEADER