1.设置网络参数:

vi /etc/sysconfig/network-scripts/ifcfg-eth0 

DEVICE="eth0"
HWADDR="00:0C:29:68:b1:0f"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO=static
IPADDR=192.168.10.95
NETMASK=255.255.255.0
GATEWAY=192.168.10.1
DNS1=202.106.0.20
DNS2=192.168.10.95

:wq


vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=ns.linunxyy.cn

:wq


vi /etc/selinux/config 

SELINUX=disabled

:wq


chkconfig NetworkManager off

chkconfig iptables off

chkconfig network on 

vi /etc/hosts

192.168.10.95   ns      ns.linuxyy.cn

:wq


reboot


2.安装bind软件:

vi /etc/yum.repos.d/rhel.repo

[local]

name=local

baseurl=file:///mnt/

enabled=1

gpgcheck=0

:wq



mount /dev/cdrom /mnt

yum -y install bind-*

rpm -qa |grep bind

rpm -ql bind

rpm -ql bind-utils


3.修改配置文件:

cd /var/named/chroot/etc/

cp /usr/share/doc/bind-9.7.3/sample/etc/named.conf ./

vi named.conf   ##修改如下,可以复制粘贴

options
{
        directory               "/var/named";           // "Working" directory
        dump-file               "data/cache_dump.db";
        statistics-file         "data/named_stats.txt";
        memstatistics-file      "data/named_mem_stats.txt";
        listen-on port 53       { 192.168.10.95; };
        query-source port 53;
        allow-query             { 192.168.10.0/24; };
        recursion yes;
};
logging 
{
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
zone "." IN {
                type hint;
                file "named.ca";
};

:wq

/etc/init.d/named restart

chkconfig named on

netstat -utpln |grep 53


4.测试:

windows/linux:


nslookup

server 192.168.10.95

www.baidu.com

www.sina.com

exit


查看查询日志:

 less /var/named/chroot/var/named/data/named.run