【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
相关推荐
小马爱打代码3 小时前
Spring Boot:模块化实战 - 保持清晰架构
java·spring boot·架构
青青草原技术员灰太狼4 小时前
Nginx的https搭建
linux·服务器·网络
小坏讲微服务4 小时前
SpringBoot4.0整合knife4j 在线文档完整使用
java·spring cloud·在线文档·knife4j·文档·接口文档·swagger-ui
xu_yule4 小时前
网络和Linux网络-4(应用层)序列化和反序列化(网络计算器)
linux·网络
8***Z894 小时前
springboot 异步操作
java·spring boot·mybatis
i***13244 小时前
Spring BOOT 启动参数
java·spring boot·后端
坚持不懈的大白4 小时前
后端:SpringMVC
java
IT_Octopus4 小时前
(旧)Spring Securit 实现JWT token认证(多平台登录&部分鉴权)
java·后端·spring
kk哥88994 小时前
Spring详解
java·后端·spring
S***26754 小时前
Spring Cloud Gateway 整合Spring Security
java·后端·spring