在CentOS 7.x中部署主、从DNS服务器,主要涉及到两个步骤:安装和配置,我们需要在两台服务器上安装BIND服务,然后在主服务器上进行配置,最后在从服务器上进行同步。
安装BIND服务
在CentOS 7.x中,我们可以使用yum命令来安装BIND服务,以下是具体的步骤:
1、打开终端,输入以下命令来更新系统软件包:
sudo yum update -y
2、输入以下命令来安装BIND服务:
sudo yum install bind bind-utils -y
配置主服务器
在主服务器上,我们需要进行以下配置:
1、编辑named.conf文件:
sudo vi /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; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "." IN { type hint; file "named.ca"; }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key";
2、创建正向区域文件:
sudo vi /var/named/example.com.zone
在文件中添加以下内容:
$TTL 604800 @ IN SOA ns1.example.com. admin.example.com. ( 3 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; Name servers: fqdn of your master server and secondary server here, separated by a space. For example: @ NS ns1.example.com. ns2.example.com. www IN A 192.168.1.1 www IN AAAA 2001:db8::1 www IN CNAME example.com www IN MX 10 mail IN A 192.168.1.2 mail IN AAAA 2001:db8::2 mail IN CNAME example.com mail IN MX 10 mail3 IN A 192.168.1.3 mail3 IN AAAA 2001:db8::3 mail3 IN CNAME example.com mail3 IN MX 10 @ IN SOA ns1.example.com. admin.example.com. (3 ; serial number, also known as the zone serial number) (
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/332292.html