Bind 操作

yum install bind caching-nameserver bind-chroot –y

在/var/named/chroot/etc目录操作

Cp named.caching-nameserver.conf named.conf

查看权限 ll

clip_image002

Ln –s named.conf /etc/named.conf

查看权限

clip_image004

修改/etc/named.conf

修改options中的部分:

options {

listen-on port 53 { 127.0.0.1;any; };

allow-query { localhost;any; };

allow-query-cache { localhost;any; };

};

view localhost_resolver {

match-clients { localhost;any; };

match-destinations { localhost;any; };

*//在options中修改的部分,这个在主DNS和备用DNS的设置一样!

——————————————————————————————

zone "resting.me"{

type master;

file "resting.me";

allow-transfer{192.168.2.101;};};

zone "2.168.192.in-addr.arpa"{

type master;

file "192.168.2.rev";

allow-transfer {192.168.2.101;};

};}; *// DNS的解析对象

——————————————————————————————

现在,写DNS的区域解析文件

进入/var/named/chroot/var/named/ 目录

Cp named.local resting.me *// 复制模板文件为正向解析文件并进行编辑

RHCE课程之Bind 操作_第1张图片

Cp resting.me 192.168.2.rev 并进行编辑

RHCE课程之Bind 操作_第2张图片将两个解析文件加入named组

Chown root:named resting.me

Chown root:named 192.168.2.rev

Ll /var/named/chroot/var/named/

clip_image010

将两个解析文件写入 /var/named中

Ln –s /var/named/chroot/var/named/resting.me /var/named/resting.me

Ln –s /var/named/chroot/var/named/192.168.2.rev /var/named/192.168.2.rev

clip_image012

Service named restart 后测试DNS!

————————————————————————————————

zone "resting.me"{

type slave;

file "slaves/resting.me";

masters {192.168.2.100;};

};

zone "2.168.192.in-addr.arpa"{

type slave;

file "slaves/192.168.2.rev";

masters {192.168.2.100;};

};

*// DNS的解析对象

Service named restart 后测试DNS!并在/var/named/chroot/var/named/slaves中查看是否有从主DNS同步过来的配置文件!

clip_image014

查看配置文件:

RHCE课程之Bind 操作_第3张图片

RHCE课程之Bind 操作_第4张图片