当前位置: 首页 > article >正文

DNS正反向解析,区域备份

DNS作业

正反向解析:
关闭防火墙、selinux:
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld.service 
编写配置文件:
[root@localhost ~]# vim /etc/named.conf 
编写数据配置文件
[root@localhost ~]# cp   -a /var/named/named.localhost /var/named/named.192
cp: overwrite '/var/named/named.192'? y
[root@localhost ~]# vim /var/named/named.192
[root@localhost ~]# vim /var/named/named.openlab.com
[root@localhost ~]# systemctl restart named
测试:
[root@localhost ~]# nslookup

> server 192.168.36.131
> Default server: 192.168.36.131
> Address: 192.168.36.131#53
> www.openlab.com
> Server:		192.168.36.131
> Address:	192.168.36.131#53

Name:	www.openlab.com
Address: 192.168.36.33


dig解析测试:
[root@localhost ~]# dig www.openlab.com @192.168.36.131

; <<>> DiG 9.16.23-RH <<>> www.openlab.com @192.168.36.131
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62608
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: d69077111ae8183201000000672982db97c2eb04161ee260 (good)
;; QUESTION SECTION:
;www.openlab.com.		IN	A

;; ANSWER SECTION:
www.openlab.com.	86400	IN	A	192.168.36.33

;; Query time: 0 msec
;; SERVER: 192.168.36.131#53(192.168.36.131)
;; WHEN: Tue Nov 05 10:28:43 CST 2024
;; MSG SIZE  rcvd: 88

正向解析:

options {
	listen-on port 53 { 192.168.36.131; };
	directory 	"/var/named";
	allow-query  { any; };
};
zone "openlab.com" IN {     
	type master;              
	file "named.openlab.com"; 
};

反向解析:

zone "36.168.192.in-addr.arpa" IN {  
        type master;
        file "named.192";
        allow-update { none; };
};
区域备份
主服务器:
关闭防火墙、selinux:
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld.service 
设置静态IP:
[root@localhost named]# nmcli c modify ens160 ipv4.method manual ipv4.addresses '192.168.36.131/24' ipv4.gateway '192.168.36.2' ipv4.dns '192.168.36.131'
[root@localhost named]#  nmcli  c  reload
[root@localhost named]# nmcli  c  up  ens160
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
编写配置文件,子配置文件:
[root@localhost ~]# vim  /etc/named.conf
[root@localhost ~]# vim  /etc/named.rfc1912.zones
[root@localhost ~]# cd  /var/named
[root@localhost named]# ls
data  dynamic  named.ca  named.empty  named.localhost  named.loopback  slaves
编写模块配置文件:
[root@localhost named]# cp  -a  named.localhost  named.openlab.com
[root@localhost named]# vim  named.openlab.com
[root@localhost named]#  cp -a named.loopback  named.192
[root@localhost named]#  vim  /var/named/named.192
[root@localhost named]# systemctl restart named
从服务器:
关闭防火墙、selinux:
[root@localhost ~]# systemctl stop firewalld.service 
[root@localhost ~]# setenforce 0
编写配置文件,子配置文件:
[root@localhost ~]#  vim   /etc/named.conf
[root@localhost ~]# vim /etc/named.rfc1912.zones
编写模块文件:
[root@localhost ~]# cd  /var/named/slaves
[root@localhost slaves]# ls
[root@localhost slaves]# cd
[root@localhost ~]# cd  /var/named/slaves
[root@localhost slaves]# systemctl start named
测试:
[root@localhost ~]# nslookup  www.openlab.com
Server:		192.168.36.132
Address:	192.168.36.132#53

Name:	www.openlab.com
Address: 192.168.36.131

[root@localhost ~]#  dig @192.168.36.131 www.openlab.com

; <<>> DiG 9.16.23-RH <<>> @192.168.36.131 www.openlab.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59195
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 043868bb84985e9201000000672996b5a8fd6370c35dbe17 (good)
;; QUESTION SECTION:
;www.openlab.com.		IN	A

;; ANSWER SECTION:
www.openlab.com.	86400	IN	A	192.168.36.131

;; Query time: 2 msec
;; SERVER: 192.168.36.131#53(192.168.36.131)
;; WHEN: Tue Nov 05 11:53:25 CST 2024
;; MSG SIZE  rcvd: 88

主服务器配置文件,子配置文件,数据模块文件:
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
从服务器配置文件,子配置文件:
请添加图片描述
请添加图片描述


http://www.kler.cn/a/381605.html

相关文章:

  • 【RK3588 Linux 5.x 内核编程】-等待队列(WaitQueue)
  • 5. Redis的 安全与性能优化
  • Vue 3 单元测试与E2E测试
  • 使用SQLark如何将Oracle迁移到达梦数据库
  • npm入门教程1:npm简介
  • 软件测试基础九 (python基础)
  • 计算机毕业设计Python+大模型膳食推荐系统 知识图谱 面向慢性病群体的膳食推荐系统 健康食谱推荐系统 机器学习 深度学习 Python爬虫 大数据毕业设计
  • 室内定位论文精华-20241104
  • 【深度学习】梯度累加和直接用大的batchsize有什么区别
  • c语言简单编程练习10
  • 前后端分离,Jackson,Long精度丢失
  • 命令行参数、环境变量、地址空间
  • Django遍历文件夹及文件
  • 设置HTTP会话(Session)的Cookie域
  • doris使用使用broker从HDFS导入数据
  • ArcGIS/QGIS按掩膜提取或栅格裁剪后栅格数据的值为什么变了?
  • 域名自动重定向8080端口无法访问后端服务问题
  • C++算法练习-day37——112.路径总和
  • pyspark基础准备
  • Spring Boot 配置文件启动加载顺序
  • 录屏天花板,录课新玩法,人像+一切,PPT/PDF/视频/网页,也可即可录
  • 使用Mybatis-plus出现数据库id很大或者为负数情况排查解决
  • VUE2升级成VUE3的优化与区别
  • Linux第三讲:环境基础开发工具使用
  • Qt 练习做一个登录界面
  • 使用java从提前pdf中的文字