Linux----DNS服务器构建(反向解析,缓存服务器,主从服务器)!
Posted handsomeboy-东
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux----DNS服务器构建(反向解析,缓存服务器,主从服务器)!相关的知识,希望对你有一定的参考价值。
反向解析配置
注释:反向解析就是以IP地址解析域名
设备准备:一台linux系统作DNS服务器,一台win10系统作客户端
- 两台设备都采用VNnet8
- linux系统下载bind,设置DNS配置文件,并开启DNS
[root@localhost slaves]# yum install -y bind
[root@localhost named]# systemctl stop firewalld.service //关闭防火墙
[root@localhost slaves]# vim /etc/named.conf //更改主配值文件
[root@localhost named]# vim /etc/named.rfc1912.zones
[root@localhost named]# cp -p named.localhost test.com.zone
[root@localhost named]# vim test.com.zone
3.win10上修改DNS服务器IP地址
- 在win10上测试
- 这样看的不明显,我们在DNS服务器中测试
[root@localhost named]# vim /etc/resolv.conf
[root@localhost named]# nslookup 192.168.43.100 //解析ip
缓存服务器搭建
缓存服务器主要提升了域名解析的速度,以免从根域开始查询
实验准备:一台linux系统作缓存服务器,一台linux系统作DNS服务器,一台win10作客户端都使用VMnet8
缓存服务器配置:
[root@AIDEBOY home]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.135 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 fe80::b99f:450f:f461:751d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:7f:e2:cf txqueuelen 1000 (Ethernet)
RX packets 617488 bytes 921706213 (879.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 268897 bytes 16324895 (15.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@AIDEBOY home]# yum install -y bind
[root@AIDEBOY ~]# systemctl start named //开启named
DNS服务器配置:
[root@localhost slaves]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.129 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 fe80::5fa0:eef1:92e9:a987 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:62:71:0f txqueuelen 1000 (Ethernet)
RX packets 627957 bytes 927366002 (884.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 283225 bytes 17278824 (16.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@AIDEBOY home]# yum install -y bind
[root@localhost slaves]# 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 -p named.localhost test.com.zone
[root@localhost named]# vim test.com.zone
[root@localhost named]# systemctl start named
[root@localhost named]# netstat -anup | grep named
udp 0 0 192.168.122.1:53 0.0.0.0:* 80197/named
udp 0 0 192.168.43.129:53 0.0.0.0:* 80197/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 80197/named
udp6 0 0 ::1:53 :::* 80197/named
win10客户端配置:
在win10上测试:
在缓存服务器上
[root@AIDEBOY ~]# systemctl restart named //重启named
然后在win10客户端上测试会发现任然可以
主从服务器搭建
设置主从服务器,主要用于冗余备份,以免一台DNS服务器失效,所有的主机名都不能被找到
实验设备:一台linu系统作为Master DNS。一台服务器作为Slave DNS,一台win10系统作测试用
Slave DNS配置:
[root@localhost ~]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.129 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 fe80::5fa0:eef1:92e9:a987 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:62:71:0f txqueuelen 1000 (Ethernet)
RX packets 629067 bytes 927451443 (884.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 283382 bytes 17292286 (16.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# yum install -y bind
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# vim /etc/named.rfc1912.zones
注释:slaves是主从服务器同步的数据储存位置
[root@localhost ~]# systemctl restart named
Master DNS配置:
[root@localhost named]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.100 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 fe80::36e:5ed4:356a:545c prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:5c:6d:85 txqueuelen 1000 (Ethernet)
RX packets 24266 bytes 4023347 (3.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14161 bytes 1626567 (1.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# yum install -y bind
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# vim /etc/named.rfc1912.zones
[root@localhost named]# cp -p named.localhost test.com.zone
[root@localhost ~]# cd /var/named
[root@localhost named]# vim test.com.zone
在win10上测试:
设置Slave DNSIP地址
设置主/从服务器的同步,在master DNS上
[root@localhost named]# vim /etc/named.rfc1912.zones
[root@localhost named]# vim test.com.zone
[root@localhost named]# rndc reload //重载DNS配置
在Slave DNS服务器上测试,发现数据同步
以上是关于Linux----DNS服务器构建(反向解析,缓存服务器,主从服务器)!的主要内容,如果未能解决你的问题,请参考以下文章
Linux——DNS(正向解析+反向解析+多域配置+主从配置)