How to set up a dns server of slave type
This article mainly introduces "how to set up a slave-type dns server". In daily operation, I believe many people have doubts about how to establish a slave-type dns server. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to set up a slave-type dns server". Next, please follow the editor to study!
Type of DNS server:
Master: provides dns services and contains regional documents itself.
Slave: provides the dns service with Master. When the name and address pair on the Master server changes, the Slave server is automatically updated to achieve synchronization.
Cache-only: does not have its own regional document, just helps the client segment to request a query from the external dns, and then saves the results to his cache.
[@ more@]
1pr premuri configuration check
Dig-t axfr example.com @ 192.168.0.254
Host-l example.com 192.168.0.254
2, install the package
Yum install-y bind bind-utils bind-chroot caching-nameserver
3, edit named.conf
Zone "example.com" IN {
Type slave
Masters {192.168.0.254;}
File "slaves/example.com.zone"
Forwarders {}
}
4. Modify file permissions
[root@station10 etc] # ls-lZ
-rw-r--r-- root root system_u:object_r:locale_t localtime
-rw-r- root named system_u:object_r:named_conf_t named.caching-nameserver.conf
-rw-r- root root root:object_r:named_conf_t named.conf
-rw-r- root named system_u:object_r:named_conf_t named.rfc1912.zones
-rw-r--r-- root named system_u:object_r:dnssec_t rndc.key
[root@station10 etc] # chown root:named named.conf
[root@station10 etc] # chmod 640! $
Chmod 640 named.conf
[root@station10 etc] # ls-lZ
-rw-r--r-- root root system_u:object_r:locale_t localtime
-rw-r- root named system_u:object_r:named_conf_t named.caching-nameserver.conf
-rw-r- root named root:object_r:named_conf_t named.conf
-rw-r- root named system_u:object_r:named_conf_t named.rfc1912.zones
-rw-r--r-- root named system_u:object_r:dnssec_t rndc.key
[root@station10 etc] #
5. Start the service
[root@station10 etc] # service named configtest
Zone localdomain/IN: loaded serial 42
Zone localhost/IN: loaded serial 42
Zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
Zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 1997022700
Zone 255.in-addr.arpa/IN: loaded serial 42
Zone 0.in-addr.arpa/IN: loaded serial 42
[root@station10 etc] # service named restart
6. View the resulting file
[root@station10 etc] # cd / var/named/chroot/var/named/slaves/
[root@station10 slaves] # ls-lZ
-rw-r--r-- named named root:object_r:named_cache_t example.com.zone
[root@station10 slaves] # cat example.com.zone
7, test
[root@station10 slaves] # host-r station10.example.com localhost
Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases:
Station10.example.com has address 192.168.0.10
[root@station10 slaves] # dig + norecurse station10.example.com @ localhost
; DiG 9.3.3rc2 + norecurse station10.example.com @ localhost
; (1 server found)
;; global options: printcmd
;; Got answer:
;;-> > HEADER