Centos7 Server DNS

本文详细介绍了DNS服务器的构建过程,包括基本配置、多区域解析、特殊解析、主从架构、子域授权和缓存服务器的设置。实验涵盖了从配置named.conf文件、创建地址库、设置权限到客户端配置和解析测试的全过程,强调了DNS服务在网络安全和效率中的重要角色。
摘要由CSDN通过智能技术生成

构建DNS服务器

  1. dns服务简介
    DNS domain network system 域名网络解析系统
    服务:named服务
    默认端口:TCP/UDP 53
    主要执行程序:/usr/sbin/named
    运行时的虚拟根环境:/var/named/chroot/
    服务器端所需的包:bind-9.9.4-29.el7.x86_64 //域名服务包 bind-chroot-9.9.4-29.el7.x86_64 //提供虚拟根支持 牢笼政策
    客户机端所需要的包:bind-utils-9.9.4-61.el7.x86_64 //提供nslookup命令来查看服务器端的域名服务
  2. 配置文件和地址库文件
    配置文件:/etc/named.conf
    地址库文件:/var/named/xxx
  3. 实验准备
    准备两台主机,一台为client,客户机要配置一下域名服务器的地址,一台为server
  4. 实验
    配置文件检查命令:named-checkconf /etc/named.conf
    地址库文件检查命令:named-checkzone test.com /var/named/test.com.zone
    实验一:简单配置并测试一下DNS服务器
    1. 修改named配置文件 vi /etc/named.conf
      在这里插入图片描述

    2. 建立并修改地址库配置文件
      注:保证named用户对地址库文件的读权限,cp -p /var/named/named.localhost /var/named/test.com.zone
      (-p 保持权限不变进行拷贝)
      在这里插入图片描述
      配置文件中:所有的域名必须以点结尾。如果没有以点作为结尾,那么默认补全本地库文件负责的域名在这里插入图片描述

    3. 检查
      进入客户机,将域名服务器的解析地址配置到/etc/resolv.conf中 echo nameserver 192.168.211.12 > /etc/resolv.conf
      检查是否可以访问server端 nslookup www.test.com
      实验二:多区域DNS解析,即再server端配置多个区域
      vi /etc/named.conf在这里插入图片描述
      创建test01.com.zone地址库配置文件,保证named对它的读权限 cp /var/named/test.com.zone /var/named/test01.com.zone
      修改test01.com.zone中的配置内容在这里插入图片描述
      client端检测:
      在这里插入图片描述
      实验三:特殊解析
      解释:当客户端发送请求时,服务端会根据情况来对客户端发送过来的域名进行解析。
      资源解析记录类型:
      NS:声明域名服务器
      A: 正向解析记录
      CNAME:别名解析记录
      解析分类:
      轮询解析:就是挨个问一下/var/named/test.com.zone地址库文件中的域名,查到就将ip地址返回过去。
      泛域名解析:泛域名即匹配所有的域名
      在这里插入图片描述
      别名:在这里插入图片描述
      实验四:DNS主从架构,从服务器可以备份主服务器
      主服务器上的配置(192.168.211.12):

      1. 配置文件上的配置vi /etc/named.conf
        在这里插入图片描述
        地址库文件的配置: 声明从DNS服务器
        在这里插入图片描述
        检查地址库配置是否有问题namedcheckzone test.com /var/named/test.com.zone
        重启一下且并不需要配置/etc/resolv.conf
        从服务器上的配置:
        配置配置文件 vi /etc/named.conf
        在这里插入图片描述
        地址库文件必须与主服务器同名
        当重启named服务后,从服务器会自动创建test.com.zone.slave
        需要将nameserver 192.168.211.15 加入到/etc/resolv.conf中

如果想解析域名完全按照主服务器,则将serial前的数字0修改一下在这里插入图片描述
实验五:子域授权
A虚拟机能够解析虚拟机B负责的域名(子域授权)地址库名称并不需要相同
B虚拟机上的配置:
和一般虚拟机配置一样
将nameserver 192.168.211.12写入/etc/resolv.conf
A虚拟机上的配置:
地址库配置中需要配置B中的
在这里插入图片描述
不需要配置/etc/resolv.conf配置文件,A会通过递归解析查询到B的域名解析内容。
总结:递归解析:客户端发送请求给首选DNS服务器,首选DNS服务器与其他DNS服务器交互,最终将解析结果带回来过程。
迭代解析:客户端发送请求给首选DNS服务器,首选DNS服务器告知下一个DNS服务器地址。
实验六:缓存服务器
在DNS服务器配置文件上配置一下即可
在这里插入图片描述
实验七:分离解析
能够区分客户机的来源地址,为不同类别的客户机提供不同的解析结果(IP地址),为客户端提供最近的服务器
服务器上的配置:
在这里插入图片描述
针对源地址定义acl列表:
在这里插入图片描述

Deploy and manage today's essential services on an enterprise-class, open operating system About This Book * Configure and manage Linux servers in varying scenarios and for a range of business requirements * Explore the up-to-date features of CentOS using real-world scenarios * See practical and extensive recipes to deploy and manage CentOS Who This Book Is For This book is for Linux professionals with basic Unix/Linux functionality experience, perhaps even having set up a server before, who want to advance their knowledge in administering various services. What You Will Learn * See how to deploy CentOS easily and painlessly, even in multi-server environments * Configure various methods of remote access to the server so you don't always have to be in the data center * Make changes to the default configuration of many services to harden them and increase the security of the system * Learn to manage DNS, emails and web servers * Protect yourself from threats by monitoring and logging network intrusion and system intrusion attempts, rootkits, and viruses * Take advantage of today's powerful hardware by running multiple systems using virtualization In Detail CentOS is derived from Red Hat Enterprise Linux (RHEL) sources and is widely used as a Linux server. This book will help you to better configure and manage Linux servers in varying scenarios and business requirements. Starting with installing CentOS, this book will walk you through the networking aspects of CentOS. You will then learn how to manage users and their permissions, software installs, disks, filesystems, and so on. You'll then see how to secure connection to remotely access a desktop and work with databases. Toward the end, you will find out how to manage DNS, e-mails, web servers, and more. You will also learn to detect threats by monitoring network intrusion. Finally, the book will cover virtualization techniques that will help you make the most of CentOS. Style and approach This easy-to-read cookbook is filled with practical recipes. Hands-on, task-based exercises will present you with real-world solutions to deploy and manage CentOS in varying business scenarios.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值