【Linux】配置dns主从服务器,能够实现正常的正反向解析

​​​​​​1、首先,在主服务器上配置DNS解析器。打开配置文件/etc/named.conf,添加以下内容:

复制代码
zone"example.com" IN {
    type master;
    file "example.com.zone";
    allow-transfer { slave_ip_address:
};
};

zone"xx.168.192.in-addr.arpa" IN {
    type master;
    file "xx.168.192.zone";
    allow-transfer{ slave_ip_address;
};
};

2、创建正向解析区域文件example.com.zone,并添加以下内容:

复制代码
$TTL 86400
@   IN  SOA     ns1.example.com. admin.example.com. (
                  2022010101 ; Serial
                  3600       ; Refresh
                  1800       ; Retry
                  604800     ; Expire
                  86400 )    ; Minimum TTL
;
@   IN  NS      ns1.example.com.
@   IN  NS      ns2.example.com.
ns1 IN  A       master_ip_address
ns2 IN  A       slave_ip_address
www IN  A       web_server_ip_address

3、创建反向解析区域文件xx.168.192.zone,并添加以下内容:

复制代码
$TTL 86400
@   IN  SOA     ns1.example.com. admin.example.com. (
                  2022010101 ; Serial
                  3600       ; Refresh
                  1800       ; Retry
                  604800     ; Expire
                  86400 )    ; Minimum TTL
;
@   IN  NS      ns1.example.com.
@   IN  NS      ns2.example.com.
1   IN  PTR     ns1.example.com.
2   IN  PTR     ns2.example.com.
10  IN  PTR     www.example.com.

4、在从服务器上进行相同的配置,只需将type master改为type slave

5、重启DNS服务,使配置生效。

复制代码
sudo systemctl restart named
相关推荐
float_六七2 小时前
IntelliJ IDEA双击Ctrl的妙用
java·ide·intellij-idea
Tim风声(网络工程师)2 小时前
不同射频对应不同mac地址(查找无线用户连接AP信息)
服务器·网络·tcp/ip·智能路由器·无线ap
ajassi20003 小时前
开源 C++ QT Widget 开发(十五)多媒体--音频播放
linux·c++·qt·开源
能摆一天是一天3 小时前
JAVA stream().flatMap()
java·windows
JosieBook4 小时前
【远程运维】Linux 远程连接 Windows 好用的软件:MobaXterm 实战指南
linux·运维·windows
颜如玉4 小时前
🤲🏻🤲🏻🤲🏻临时重定向一定要能重定向🤲🏻🤲🏻🤲🏻
java·http·源码
文档搬运工4 小时前
Linux MInt启动速度的优化
linux
Broken Arrows5 小时前
Linux学习——管理网络安全(二十一)
linux·学习·web安全
程序员的世界你不懂5 小时前
【Flask】测试平台开发,新增说明书编写和展示功能 第二十三篇
java·前端·数据库
星空寻流年5 小时前
设计模式第一章(建造者模式)
java·设计模式·建造者模式