时间:2023-01-30 19:00:01 | 来源:建站知识
时间:2023-01-30 19:00:01 来源:建站知识
yum install bind* caching-nameserver
源码安装tar zxvf bind-9.6.1.tar.gzcd bind-9.6.1./configure --prefix=/usr/local/bind9 --sysconfdir=/etc/named/ --enable-threads --disable-chroot --disable-ipv6make && make install
配置环境变量vim /etc/profile.d/bind.sh
追加以下行export PATH=/usr/local/bind9/bin:/usr/local/bind9/sbin:$PATH
帮助文档的查看man -M share/man/ namedvim /etc/man.config
追加以下行MANPATH /usr/local/bind9/share/man
DNS 单点配置#修改/etc/named.conf listen-on port 53 { any; }; 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"; allow-query { any; }; recursion yes; #(此处,做的是dns转发,当本地服务器无法解析的,如公网上的域名时,转发到114.114.114.114上)forwarders { 114.114.114.114; };};
#配置/etc/named.rfc1912.zones zone "test.com" IN { type master; file "test.com.zone";}; zone "40.168.192.in-addr.arpa" IN { type master; file "40.168.192.in-addr.arpa.zone";}; #test.com.zone 配置文件 $TTL 600@ IN SOA ns.test.com. root.test.com. ( 201810131834 ; serial 300 ; refresh (5 minutes) 60 ; retry (1 minute) 604800 ; expire (1 week) 3600 ; minimum (1 hour) ) @ IN NS ns.test.com.ns IN A 192.168.40.105mail IN A 192.168.40.103 rhl IN A 192.168.40.102 #40.168.192.in-addr.arpa.zone 配置文件 $TTL 600@ IN SOA ns.test.com. root.test.com. ( 201810151834 ; serial 300 ; refresh (5 minutes) 60 ; retry (1 minute) 604800 ; expire (1 week) 3600 ; minimum (1 hour) ) @ IN NS ns.test.com. 103 IN PTR mail.test.com.
DNS的主从同步#修改/etc/named.conf options { listen-on port 53 { any; }; 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"; allow-query { any; }; recursion yes; #(此处,做的是dns转发,当本地服务器无法解析的,如公网上的域名时,转发到114.114.114.114上 forwarders { 114.114.114.114; }; #配置/etc/named.rfc1912.zones zone "test.com" IN { type master; file "test.com.zone";allow-update {none;}; #从服务器地址 allow-transfer {192.168.40.170;}; notify yes; }; #反向解析 zone "40.168.192.in-addr.arpa" IN { type master; file "named.192.168.40"; allow-update {none;}; #从服务器地址 allow-transfer {192.168.40.170;}; notify yes; };
2)从服务器的配置#修改/etc/named.conf options { listen-on port 53 { any; }; 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"; allow-query { any; }; recursion yes; forwarders { 114.114.114.114; };}; #配置/etc/named.rfc1912.zones zone "test.com" IN { type slave; file "slaves/test.com.zone"; #设置主dns服务器的地址 masters { 192.168.40.105; }; allow-update { none; };}; zone "40.168.192.in-addr.arpa" IN { type slave; file "slaves/40.168.192.in-addr.arpa.zone"; masters { 192.168.40.105; }; allow-update { none; };};
DNS 配置文件检查#检查主配置文件named-checkconf #检查域名配置文件 named-checkzone test.com /var/named/test.com.zone #测试正向解析dig -t A rhl.test.com @192.168.40.105 #测试反向解析dig -x 192.168.40.103 @192.168.40.105
作者:秦伟/计宝满/任宏利关键词:配置,服务