BIND的安装与配置

BIND的安装与配置

1.操作系统centos

配置本机IP:

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

修改内容如下:

BOOTPROTO=static

IPADDR=192.168.89.31

NETMASK=255.255.255.0

GATEWAY=192.168.89.1

配置本机DNS

#vi /etc/resolv.conf

nameserver 192.168.89.31

2.环境安装

#yum �Cyinstall gcc

#yum �Cyinstall gcc-c++

#yum �Cyinstall make

#yum �Cyinstall openssl-devel

3.安装bind

#cd /usr/local/src

#wget ftp://ftp.isc.org/isc/bind9/9.8.1-P1/bind-9.8.1-P1.tar.gz
#tar �Czxvf bind-9.8.1-P1.tar.gz #
#cd bind-9.8.1-P1

#./configure --prefix=/usr/local/bind

#make

#make install

#cd /usr/local/bind/etc/

#/usr/local/bind/sbin/rndc-confgen> rndc.conf

此时可能会没有响应,解决方法:

#/usr/local/bind/sbin/rndc-confgen -r /dev/urandom > /usr/local/bind/etc/rndc.conf

#chmod 777 /usr/local/bind/var

#tail -10 rndc.conf |head -9 |sed s/#\ //g >named.conf

#cat rndc.conf | head -5 >rndc.key

4.配置BIND

#vinamed.conf

添加如下:

options {

               directory"/usr/local/bind/var";

               pid-file "named.pid";

               listen-on port 53 {any;};

               allow-query {any;};

};

        zone "cdn.com" in {

               type master;

               file "cdn.com.zone";

               allow-update {none;};

};

#cd /usr/local/bind/sbin/

#./named-checkconf

#cd /usr/local/bind/var/

#vi cdn.com.zone

添加如下:

$TTL     3600;

@    IN   SOA  ns.cdn.com.   admin.cdn.com.     (

        20111205;

        28800;

        7200;

        3600000;

        6400);

www  IN   A    172.16.0.17

#cd /usr/local/bind/sbin/

#./named-checkzone cdn.com/usr/local/bind/var/cdn.com.zone

#./named

5.测试解析

#/usr/local/bind/bin/dig www.cdn.com  

或者

#/usr/local/bind/bin/nslookup

>www.cdn.com

6.测试CNAME别名指向解析

    cdn.com.zone配置如下:

    $TTL            3600;

cdn.com.        IN     SOA     ns.cdn.com.    admin.cdn.com.      (

                           20111205;

                           28800;

                           7200;

                           3600000;

                           6400);

www.cdn.com.    IN     CNAME   www.abc.com.





你可能感兴趣的:(linux,bind,bind配置,bind安装)