系统环境
- 系统版本:
CentOS Linux release 7.1.1503 (Core)
- 软件安装:
bind bind-libs bind-devel bind-utils bind-chroot
安装
|
|
配置
拷贝 bind 相关文件, 准备 bind chroot 环境
1cp -R /usr/share/doc/bind-*/sample/var/named/* /var/named/chroot/var/named/在 bind chroot 的目录中创建相关文件
123456touch /var/named/chroot/var/named/data/cache_dump.dbtouch /var/named/chroot/var/named/data/named_stats.txttouch /var/named/chroot/var/named/data/named_mem_stats.txttouch /var/named/chroot/var/named/data/named.runmkdir /var/named/chroot/var/named/dynamictouch /var/named/chroot/var/named/dynamic/managed-keys.bind变更目录权限
12chown -R named:named /var/named/chroot/var/named/datachown -R named:named /var/named/chroot/var/named/dynamic拷贝 named.conf 配置文件
1cp -p /etc/named.conf /var/named/chroot/etc/named.conf修改 bind 配置文件
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354more named.conf// Default named.conf generated by install of bind-9.2.4-27.0.1.el4options {listen-on port 53 { serverip; };directory "/var/named";dump-file "/var/named/data/cache_dump.db";statistics-file "/var/named/data/named_stats.txt";memstatistics-file "/var/named/data/named_mem_stats.txt";version "oOoOo...";allow-query { any; };recursion no;allow-transfer { serverip; };pid-file"/run/named/named.pid";session-keyfile "/run/named/session.key";managed-keys-directory "/var/named/dynamic";};controls {inet 127.0.0.1 allow { localhost; } keys { rndckey; };};include "/etc/rndc.key";logging {channel "named_log" {file "/var/named/logs/named.log" versions 10 size 5m;severity dynamic;print-category yes;print-severity yes;print-time yes;};channel "query_log" {file "/var/named/logs/query.log" versions 10 size 5m;severity debug;print-severity yes;print-time yes;};category default { named_log; };category queries { query_log; };};zone "." IN {type hint;file "named.cache";};zone "czero.cn" IN {type slave;masters { serverip; };file "czero.cn.db";};zone 配置
1234567891011121314151617181920212223vim /var/named/chroot/var/named/example.local.zone;; Addresses and other host information.;$TTL 86400@ IN SOA example.local. hostmaster.example.local. (2014101901 ; Serial43200 ; Refresh3600 ; Retry3600000 ; Expire2592000 ) ; Minimum; Define the nameservers and the mail serversIN NS ns1.example.local.IN NS ns2.example.local.IN A 192.168.0.70IN MX 10 mx.example.local.centos7 IN A 192.168.0.70mx IN A 192.168.0.50ns1 IN A 192.168.0.70ns2 IN A 192.168.0.80启动服务
12345/usr/libexec/setup-named-chroot.sh /var/named/chroot onsystemctl stop namedsystemctl disable namedsystemctl start named-chrootsystemctl enable named-chroot