父域和子域配置实现
作者:互联网
- 父域配置 10.0.0.101
[root@localhost ~]# vim /etc/named.conf options { // listen-on port 53 { 127.0.0.1; }; // allow-query { localhost; }; allow-transfer {10.0.0.102;}; #只允许从服务器(子域)进行区域传输 } dnssec-enable no; #关闭加密验证 dnssec-validation no;第二步:修改主配置文件/etc/named.rfc1912.zones,创建区域信息
[root@localhost ~]# vim /etc/named.rfc1912.zones zone "magedu.org" IN { type master; file "magedu.org.zone"; };第三步:创建区域数据库文件,并修改权限、所属组
[root@localhost ~]# vim /var/named/magedu.org.zone $TTL 1D @ IN SOA master admin.magedu.org. ( 20201231 1H 10M 3D 12H ) NS ns1 shanghai NS ns2 #创建一个NS记录shanghai.magedu.org. ns1 A 10.0.0.101 ns2 A 10.0.0.102 #将子域shanghai.magedu.org.指向10.0.0.102 www A 10.0.0.103 [root@localhost named]# chmod 640 magedu.org.zone [root@localhost named]# chown .named magedu.org.zone第四步:重启服务器
systemctl restart named
- 子域配置 10.0.0.102
options { // listen-on port 53 { 127.0.0.1; }; // allow-query { localhost; }; allow-transfer {none;}; }第二步:修改主配置文件/etc/named.rfc1912.zones,创建区域信息
[root@localhost ~]# vim /etc/named.rfc1912.zones zone "shanghai.magedu.org" IN { type master; file "shanghai.magedu.org.zone"; };第三步:创建区域数据库文件,并修改权限、所属组
[root@localhost named]# vim shanghai.magedu.org.zone $TTL 1D @ IN SOA master admin.magedu.org. ( 20201231 1H 10M 3D 12H ) NS ns1 ns1 A 10.0.0.102 k8s A 10.0.0.200 www A 10.0.0.201 [root@localhost named]# chmod 640 shanghai.magedu.org.zone [root@localhost named]# chown .named shanghai.magedu.org.zone第四步:重启服务器
systemctl restart named
- 客户端测试
dig k8s.shanghai.magedu.org @10.0.0.101 dig www.shanghai.magedu.org @10.0.0.101
标签:10.0,named,zone,配置,magedu,子域,org,localhost,父域 来源: https://www.cnblogs.com/linchenkai/p/14258787.html