ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux系统中部署DNS从服务器

2020-12-12 17:04:54  阅读:185  来源: 互联网

标签:14 bind 192.168 64 DNS linux 服务器 el7


DNS域名解析服务的三种服务器:

主服务器:管理域名和IP地址的对应关系

从服务器:同步域名和IP地址的对应关系(缓解跟服务器压力,提高解析速度)

缓存服务器:转发域名和IP地址的对应关系(缓解根服务器压力,提高解析速度)

 

DNS从服务器要解决的问题:

从主服务器中获取指定的区域数据文件,起到备份同步和负载均衡的作用,缓解主服务器压力,提高DNS解析效率。

 

下面实验中要用到两台虚拟机,分别为PC1(主服务器)和PC2(从服务器)。IP分别为192.168.10.10和192.168.10.20。

 

1、查看主服务器和从服务器基本信息,测试联通性

[root@PC1 ~]# ifconfig | head -n 3  ## 查看主服务器IP
eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.10  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::20c:29ff:fe66:37f7  prefixlen 64  scopeid 0x20<link>
[root@PC2 ~]# ifconfig | head -n 3  ## 查看从服务器IP
eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.20  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::20c:29ff:fe25:bb3e  prefixlen 64  scopeid 0x20<link>
[root@PC2 ~]# ping -c 3 192.168.10.10  ## 测试从服务器和主服务器的连通性,没有问题
PING 192.168.10.10 (192.168.10.10) 56(84) bytes of data.
64 bytes from 192.168.10.10: icmp_seq=1 ttl=64 time=0.222 ms
64 bytes from 192.168.10.10: icmp_seq=2 ttl=64 time=0.202 ms
64 bytes from 192.168.10.10: icmp_seq=3 ttl=64 time=0.228 ms

--- 192.168.10.10 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.202/0.217/0.228/0.016 ms

 

2、主服务器上一实验已经配置好BIND服务,只需给从服务器配置好BIND服务。

[root@PC2 network-scripts]# yum install bind-chroot  ## 安装bind服务
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package bind-chroot.x86_64 32:9.9.4-14.el7 will be installed
--> Processing Dependency: bind = 32:9.9.4-14.el7 for package: 32:bind-chroot-9.9.4-14.el7.x86_64
--> Running transaction check
---> Package bind.x86_64 32:9.9.4-14.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================
 Package                Arch              Version                      Repository        Size
==============================================================================================
Installing:
 bind-chroot            x86_64            32:9.9.4-14.el7              rhel7             81 k
Installing for dependencies:
 bind                   x86_64            32:9.9.4-14.el7              rhel7            1.8 M

Transaction Summary
==============================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 1.8 M
Installed size: 4.3 M
Is this ok [y/d/N]: y
Downloading packages:
----------------------------------------------------------------------------------------------
Total                                                         189 MB/s | 1.8 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 32:bind-9.9.4-14.el7.x86_64                                                1/2 
  Installing : 32:bind-chroot-9.9.4-14.el7.x86_64                                         2/2 
rhel7/productid                                                        | 1.6 kB  00:00:00     
  Verifying  : 32:bind-9.9.4-14.el7.x86_64                                                1/2 
  Verifying  : 32:bind-chroot-9.9.4-14.el7.x86_64                                         2/2 

Installed:
  bind-chroot.x86_64 32:9.9.4-14.el7                                                          

Dependency Installed:
  bind.x86_64 32:9.9.4-14.el7                                                                 

Complete!
[root@PC2 network-scripts]# vim /etc/named.conf   ## 修改主配置文件,修改第11行和第17行
  1 //
  2 // named.conf
  3 //
  4 // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
  5 // server as a caching only nameserver (as a localhost DNS resolver only).
  6 //
  7 // See /usr/share/doc/bind*/sample/ for example named configuration files.
  8 //
  9 
 10 options {
 11         listen-on port 53 { any; };  ## 表示所有的IP均可提供DNS服务
 12         listen-on-v6 port 53 { ::1; };
 13         directory       "/var/named";
 14         dump-file       "/var/named/data/cache_dump.db";
 15         statistics-file "/var/named/data/named_stats.txt";
 16         memstatistics-file "/var/named/data/named_mem_stats.txt";
 17         allow-query     { any; };  ## 表示允许任何人使用DNS查询服务
 18 
 19         /* 
 20          - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
 21          - If you are building a RECURSIVE (caching) DNS server, you need to enable 
 22            recursion. 

修改从服务器网卡参数,将DNS服务改为本机的IP:

 

 

[root@PC2 Desktop]# systemctl restart named  ## 重启bind服务
[root@PC2 Desktop]# systemctl restart network  ## 重启网卡服务

 

2、

 

标签:14,bind,192.168,64,DNS,linux,服务器,el7
来源: https://www.cnblogs.com/liujiaxin2018/p/14125276.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有