基于CentOS的DNS功能的实现

[root@localhost ~]# yum -y install bind bind-chroot

2、配置实验的环境

[root@localhost ~]# cd /var/named/chroot


[root@localhost chroot]#  cp -rv /usr/share/doc/bind-9.3.6/sample/ etc/ var/

[root@localhost chroot]#  cp -rv /usr/share/doc/bind-9.3.6/sample/etc/* etc/

[root@localhost chroot]#  cp -rv /usr/share/doc/bind-9.3.6/sample/var/* var/3、配置相关文档[root@localhost ~]#cd /var/named/chroot/etc[root@localhost etc]# cp named.conf named.conf.bak

[root@localhost etc]# vi named.conf

options

{

directory "/var/named"; // the default

forwarders{202.102.240.65;};(托管)

};

zone "linuxidc.com"(正解)

{

type master;

file "named.linuxidc";

};

zone "1.168.192.in-addr.arpa"(反解)

{

type master;

file "192.168.1.zone";

};

[root@localhost ~]# cd  /var/named/chroot/var/named

[root@localhost named]# cp localhost.zone named.linuxidc

[root@localhost named]# cp localhost.zone 192.168.1.zone[root@localhost named]# vi named.linuxidc

$TTL    86400

@               IN SOA  @       root (

42              ; serial (d. adams)

3H              ; refresh

15M             ; retry

1W              ; expiry

1D )            ; minimum

IN NS           @

IN MX         192     mail.linuxidc.com.

ftp             IN A          192.168.1.192

mail            IN A          192.168.1.192

im              IN A          192.168.1.193

c1              IN A          192.168.1.12

c1              IN A          192.168.1.13


[root@localhost named]# vi 192.168.1.zone

$TTL    86400

@               IN SOA  @       root (

42              ; serial (d. adams)

3H              ; refresh

15M             ; retry

1W              ; expiry

1D )            ; minimum

IN NS           @

192             IN PTR          ftp.linuxidc.com

192             IN PTR          mail.linuxidc.com

193             IN PTR          im.linuxidc.com

[root@localhost named]# /etc/init.d/named restart4、配置验证环境(在linux本身进行测试)[root@localhost named]# vi /etc/resolv.conf

; generated by /sbin/dhclient-script

search linuxidc.com

nameserver 192.168.1.192

5、验证


[root@localhost named]# nslookup

> ftp.linuxidc.com

Server:         192.168.1.192

Address:        192.168.1.192#53

Name:   ftp.linuxidc.com

Address: 192.168.1.192

> 192.168.1.193

Server:         192.168.1.192

Address:        192.168.1.192#53

193.1.168.192.in-addr.arpa     name = im.linuxidc.com.1.168.192.in-addr.arpa.

> mail.linuxidc.com

Server:         192.168.1.192

Address:        192.168.1.192#53

Name:   mail.linuxidc.com

Address: 192.168.1.192

>

Server:         192.168.1.192

Address:        192.168.1.192#53

Non-authoritative answer:

Name:  

Address: 202.102.240.88

>

Server:         192.168.1.192

Address:        192.168.1.192#53

Non-authoritative answer:

  canonical name = www-g-com-chn.l.google.com.

Name:   www-g-com-chn.l.google.com

Address: 66.249.89.104

> exit


[root@localhost ~]# dig -t MX mail.linuxidc.com(验证MX徽记:用于邮件服务器的域名定义)

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_5.3 <<>> -t MX mail.linuxidc.com

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8264

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:

;mail.linuxidc.com.            IN      MX

;; AUTHORITY SECTION:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ppzwp.html