bind从服务器
蒜香大龙虾
2024-08-07 23:24:38
Categories:
Tags:
环境
linux1作为dns服务器
linux2作为从(备份)服务器
bind从服务器
安装
1
| yum install bind bind-utils -y
|
自行修改监听端口等
配置主区域
linux1的/etc/named.rfc1912.zones
添加allow-transfer
,后面跟随从服务器地址
1 2 3 4 5 6 7 8 9 10 11 12
| zone "skills.com" IN { type master; file "skills.zone"; allow-update { none; }; allow-transfer { 172.20.20.12; }; }; zone "20.20.172.in-addr.arpa" IN { type master; file "skills.arpa"; allow-update { none; }; allow-transfer { 172.20.20.12; }; };
|
配置从区域
1 2 3 4 5 6 7 8 9 10 11 12
| zone "skills.com" IN { type slave; file "skills.zone"; masters { 172.20.20.11; }; masterfile-format text; # <----不加这个,去查看区域文件会乱码 }; zone "20.20.172.in-addr.arpa" IN { type slave; file "skills.arpa"; masters { 172.20.20.11; }; masterfile-format text; };
|
测试
任意服务器测试
1 2 3 4
| # nslookup最后跟随ip,指定dns服务器查询 nslookup linux1.skills.com 172.20.20.12 # 登录从服务器查看文件 ls /var/named/skills.*
|
结果
1 2 3 4 5 6 7 8 9 10 11
| [root@linux2 ~]# nslookup linux1.skills.com 172.20.20.12 Server: 172.20.20.12 Address: 172.20.20.12#53
Name: linux1.skills.com Address: 172.20.20.11
[root@linux2 ~]# ls /var/named/skills.* /var/named/skills.arpa /var/named/skills.zone [root@linux2 ~]#
|