DNS服务器搭建

  • 反向解析配置
  • 缓存服务器搭建
  • 主从服务器搭建


反向解析配置

注释:反向解析就是以IP地址解析域名

设备准备:一台linux系统作DNS服务器,一台win10系统作客户端

  1. 两台设备都采用VNnet8
  2. 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                //更改主配值文件

centos反向解析md5 linux dns反向解析配置_centos反向解析md5


centos反向解析md5 linux dns反向解析配置_centos反向解析md5_02

[root@localhost named]# vim /etc/named.rfc1912.zones

centos反向解析md5 linux dns反向解析配置_DNS_03

[root@localhost named]# cp -p named.localhost test.com.zone
[root@localhost named]# vim test.com.zone

centos反向解析md5 linux dns反向解析配置_vim_04

3.win10上修改DNS服务器IP地址

centos反向解析md5 linux dns反向解析配置_vim_05

  1. 在win10上测试
  2. 这样看的不明显,我们在DNS服务器中测试
[root@localhost named]# vim /etc/resolv.conf

centos反向解析md5 linux dns反向解析配置_DNS_06

[root@localhost named]# nslookup 192.168.43.100   //解析ip

centos反向解析md5 linux dns反向解析配置_linux_07

缓存服务器搭建

缓存服务器主要提升了域名解析的速度,以免从根域开始查询

实验准备:一台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

centos反向解析md5 linux dns反向解析配置_linux_08

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

centos反向解析md5 linux dns反向解析配置_服务器_09

[root@localhost ~]# vim /etc/named.rfc1912.zones

centos反向解析md5 linux dns反向解析配置_服务器_10

[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

centos反向解析md5 linux dns反向解析配置_DNS_11

[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客户端配置:

centos反向解析md5 linux dns反向解析配置_DNS_12


在win10上测试:

centos反向解析md5 linux dns反向解析配置_服务器_13


在缓存服务器上

centos反向解析md5 linux dns反向解析配置_DNS_14

[root@AIDEBOY ~]# systemctl restart named       //重启named

然后在win10客户端上测试会发现任然可以

centos反向解析md5 linux dns反向解析配置_linux_15

主从服务器搭建

设置主从服务器,主要用于冗余备份,以免一台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

centos反向解析md5 linux dns反向解析配置_服务器_16

[root@localhost ~]# vim /etc/named.rfc1912.zones

centos反向解析md5 linux dns反向解析配置_linux_17


注释: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

centos反向解析md5 linux dns反向解析配置_vim_18

[root@localhost ~]# vim /etc/named.rfc1912.zones

centos反向解析md5 linux dns反向解析配置_DNS_19

[root@localhost named]# cp -p named.localhost test.com.zone 
[root@localhost ~]# cd /var/named
[root@localhost named]# vim test.com.zone

centos反向解析md5 linux dns反向解析配置_linux_20


在win10上测试:

设置Slave DNSIP地址

centos反向解析md5 linux dns反向解析配置_linux_21

centos反向解析md5 linux dns反向解析配置_服务器_22


设置主/从服务器的同步,在master DNS上

[root@localhost named]# vim /etc/named.rfc1912.zones

centos反向解析md5 linux dns反向解析配置_vim_23

[root@localhost named]# vim test.com.zone

centos反向解析md5 linux dns反向解析配置_linux_24

[root@localhost named]# rndc reload     //重载DNS配置

在Slave DNS服务器上测试,发现数据同步

centos反向解析md5 linux dns反向解析配置_vim_25