DNF 主从服务器的搭建

1,主服务器的配置

关闭防火墙和Linux的安全程序

[root@localhost ~]# systemctl stop firewalld.service #关闭防火墙
[root@localhost ~]# setenforce 0 #关闭安全策略

下载DNS

[root@localhost ~]# dnf install bind -y

配置操作

bash 复制代码
[root@localhost ~]# vim /etc/named.conf



options{
        listen-on port 53 { 192.168.85.136; };
        directory "/var/named";
        allow-query { any; };
        allow-transfer { 192.168.85.135; };
};

zone "openlab.com" IN {
        type master;
        file "named.openlab.com";
};

zone "85.168.192.in-addr.arpa" IN {
        type master;
        file "named.192";
        allow-update { none; };
};

2,从服务器的配置

关闭防火墙和Linux的安全程序

[root@localhost ~]# systemctl stop firewalld.service #关闭防火墙
[root@localhost ~]# setenforce 0 #关闭安全策略

下载DNS

[root@localhost ~]# dnf install bind -y

配置操作

bash 复制代码
options{
        listen-on port 53 { 192.168.85.135; };
        directory "/var/named/slaves";
        allow-query { any; };
};

zone "openlab.com" IN {
        type slave;
        file "named.openlab.com";
        masters { 192.168.85.136; };
};

zone "85.168.192.in-addr.arpa" IN {
        type slave;
        file "named.192";
        masters { 192.168.85.136; };
};

3,完全区域传送

主服务器:

bash 复制代码
[root@localhost ~]# vim /var/named/named.openlab.com



$TTL 1D
@       IN      SOA     @       lxx.qq.com. ( 
                                        2024110100
                                        1D
                                        1H
                                        5H
                                        1D
)
        IN      NS      ns.openlab.com.
ns      IN      A       192.168.85.136


www     IN      A       172.25.250.111
ftp     IN      A       172.25.250.100
mail    IN      A       172.25.250.132
wwww    IN      CNAME   www



[root@localhost ~]# systemctl restart named

从服务器:

bash 复制代码
[root@localhost ~]# systemctl restart named



[root@localhost ~]# ll /var/named/slaves
total 16
-rw-r--r--. 1 named named  821 Nov  1 22:16 managed-keys.bind
-rw-r--r--. 1 named named 3733 Nov  1 22:16 managed-keys.bind.jnl
-rw-r--r--. 1 named named  463 Nov  1 21:52 named.192
-rw-r--r--. 1 named named  384 Nov  1 21:52 named.openlab.com

4,增量区域传送

主服务器:

bash 复制代码
[root@localhost ~]# vim /var/named/named.openlab.com




$TTL 1D
@       IN      SOA     @       lxx.qq.com. ( 
                                        2024110101
                                        1M
                                        1M
                                        1M
                                        1M
)
        IN      NS      ns.openlab.com.
        IN      NS      slave.openlab.com.
ns      IN      A       192.168.85.136
slave   IN      A       192.168.85.135


www     IN      A       172.25.250.111
ftp     IN      A       172.25.250.100
mail    IN      A       172.25.250.132
wwww    IN      CNAME   www
wwwww   IN      CNAME   www



[root@localhost ~]# systemctl restart named

从服务器:

bash 复制代码
[root@localhost ~]# tail -f /var/log/messages
Nov  1 22:23:57 localhost systemd[1]: Started Network Manager Script Dispatcher Service.
Nov  1 22:24:07 localhost systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Nov  1 22:37:01 localhost named[41618]: client @0x7f2924057a98 192.168.85.136#46600: received notify for zone 'openlab.com'
Nov  1 22:37:01 localhost named[41618]: zone openlab.com/IN: notify from 192.168.85.136#46600: serial 2024110101
Nov  1 22:37:01 localhost named[41618]: zone openlab.com/IN: Transfer started.
Nov  1 22:37:01 localhost named[41618]: transfer of 'openlab.com/IN' from 192.168.85.136#53: connected using 192.168.85.135#45691
Nov  1 22:37:01 localhost named[41618]: zone openlab.com/IN: transferred serial 2024110101
Nov  1 22:37:01 localhost named[41618]: transfer of 'openlab.com/IN' from 192.168.85.136#53: Transfer status: success
Nov  1 22:37:01 localhost named[41618]: transfer of 'openlab.com/IN' from 192.168.85.136#53: Transfer completed: 1 messages, 11 records, 280 bytes, 0.001 secs (280000 bytes/sec) (serial 2024110101)
Nov  1 22:37:01 localhost named[41618]: zone openlab.com/IN: sending notifies (serial 2024110101)



[root@localhost ~]# nslookup 
> server 192.168.85.135
Default server: 192.168.85.135
Address: 192.168.85.135#53
> slave.openlab.com
Server:		192.168.85.135
Address:	192.168.85.135#53

Name:	slave.openlab.com
Address: 192.168.85.135
> wwwww.openlab.com
Server:		192.168.85.135
Address:	192.168.85.135#53

wwwww.openlab.com	canonical name = www.openlab.com.
Name:	www.openlab.com
Address: 172.25.250.111
相关推荐
爱写Bug的小孙14 分钟前
docker搭建私有的仓库
java·运维·spring boot·docker·容器
WZF-Sang15 分钟前
Linux—进程概念学习-03
linux·运维·服务器·c语言·开发语言·学习·vim
周雨濛18 分钟前
通过shell脚本分析部署nginx网络服务
linux·服务器·nginx
tlog1 小时前
【vim】vim怎么把某一列内容复制到另一列
linux·编辑器·vim
ID_14 HuFei1 小时前
MHA高可用
linux
BIO系统1 小时前
ASUS/华硕灵耀14 UX3402ZA 原厂win11系统 工厂文件 带ASUS Recovery恢复
运维·5g·电脑·个人开发
✿ ༺ ོIT技术༻1 小时前
Linux:进程间通信之进程池和日志
linux·运维·服务器
慧都小妮子2 小时前
质量留住用户:如何通过测试自动化提供更高质量的用户体验
运维·软件测试·自动化·ux
Holen&&Beer2 小时前
【Linux】安装cuda
linux·运维·服务器
是阿建吖!2 小时前
【Linux】进程优先级
linux·运维·服务器