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
相关推荐
颇有几分姿色5 分钟前
深入理解 Linux 内存管理:free 命令详解
linux·运维·服务器
光芒再现dev22 分钟前
已解决,部署GPTSoVITS报错‘AsyncRequest‘ object has no attribute ‘_json_response_data‘
运维·python·gpt·语言模型·自然语言处理
AndyFrank36 分钟前
mac crontab 不能使用问题简记
linux·运维·macos
筱源源1 小时前
Kafka-linux环境部署
linux·kafka
EricWang13581 小时前
[OS] 项目三-2-proc.c: exit(int status)
服务器·c语言·前端
成都古河云1 小时前
智慧场馆:安全、节能与智能化管理的未来
大数据·运维·人工智能·安全·智慧城市
算法与编程之美2 小时前
文件的写入与读取
linux·运维·服务器
xianwu5432 小时前
反向代理模块
linux·开发语言·网络·git
Amelio_Ming2 小时前
Permissions 0755 for ‘/etc/ssh/ssh_host_rsa_key‘ are too open.问题解决
linux·运维·ssh
心灵彼岸-诗和远方2 小时前
Devops业务价值流:软件研发最佳实践
运维·产品经理·devops