Linux学习篇第三章之~DNS服务器的配置及拓展

来源:互联网 发布:ymnets源码下载 编辑:程序博客网 时间:2024/05/22 00:14

DNS服务

一.DNS服务的信息说明:
服务的信息说明:
A:     正向记录
PTR:反向,ip到域名
host -l example.com:      查看域中的所有主机
dig -t soa example.com: 辅助dns
软件包: Bind bind-chroot caching-nameserver
DNS主配置目录
主配置目录:/var/named/chroot/
DNS主配置文件
主配置文件:/var/named/chroot/etc/named.conf
DNS A记录存放目录:
记录存放目录:/var/named/chroot/var/named
二.配置
--------正向解析----------

1) cp -p named.localhost westos.com.zone        ###用模板生成dns配置

2) vim westos.com.zone

3) vim /etc/named.rfc1912.zones

4) systemctl restart named
5) dns-client端测试

    --dig www.westos.com



----------反向解析----------
1)vim /etc/named.rfc1912.zones

2)cp -p /var/named/named.loopback /var/named/westos.com.ptr
3)vim /var/named/westos.com/ptr


4) dns-client端测试
[root@dns-client ~]# dig -x 172.25.254.111


-------dns更新---------
1) cp -p /var/named/westos.com.zone /mnt
2) vim /etc/named.rfc1912.zones
     zone "westos.com" IN {
         type master;
         file "westos.com.zone";
         allow-update { 172.25.254.243; };     ##允许243访问
};


3) chmod 770 /var/named
4) setsebool -P named_write_master_zones 1

5) systemctl restart named

5.客户端更新
[root@dns-client ~]# nsupdate
> server 172.25.254.143
> update add hello.westos.com 86400 A 172.25.254.222
> send
>


6.测试
 vim /etc/resolv.conf
[root@dns-server ~]# systemctl restart network
[root@dns-server ~]# dig hello.westos.com


-----dnskey update------

1)生成 keyfile
   dnssec-keygen -a HMAC-MD5 -b 256 -n HOST westoskey


2)mk key configfile
   cp -p /etc/rndc.key /etc/westos.key

   vim /etc/westos.key


3)config dns
 vim /etc/named.conf


vim /etc/named.rfc1912.zones
zone "westos.com" IN {
         type master;
         file "westos.com.zone";
         allow-update { key westoskey; }
4)check
scp Kwestoskey.+157+24460.* root@172.25.254.243:/mnt

客户端进行更新
[root@dns-client ~]# cd /mnt
[root@dns-client mnt]# nsupdate -k /mnt/Kwestoskey.+157+40938.private
> server 172.25.254.143
> update add hello.westos.com 86400 A 172.25.254.111
> send
>

------动态解析------

1.安装dhcp

> yum install dhcp -y

2.mk configfile

> cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

3.更改配置文件

> vim /etc/dhcp/dhcpd.conf


4.测试

dns-client

> hostnamectl set-hostname test.westos.com

> vim /etc/sysconfig/network-scripts/ifcfg-eth0

  

> systemctl restart network

> dig test.westos.com


0 0
原创粉丝点击