CentOs DNS功能的实现
首先配置好linux的网络连接!
1、安装相关的套件 www.zhishiwu.com
[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 "ethnicity.com"(正解)
{
type master;
file "named.ethnicity";
};
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.ethnicity
[root@localhost named]# cp localhost.zone 192.168.1.zone
[root@localhost named]# vi named.ethnicity
$TTL 86400
@ IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS @
IN MX 192 mail.ethnicity.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.ethnicity.com
192 IN PTR mail.ethnicity.com
193 IN PTR im.ethnicity.com
[root@localhost named]# /etc/init.d/named restart
4、配置验证环境(在linux本身进行测试)
[root@localhost named]# vi /etc/resolv.conf
; generated by /sbin/dhclient-script
search ethnicity.com
nameserver 192.168.1.192
5、验证
[root@localhost named]# nslookup
> ftp.ethnicity.com
Server: 192.168.1.192
Address: 192.168.1.192#53
Name: ftp.ethnicity.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.ethnicity.com.1.168.192.in-addr.arpa.
> mail.ethnicity.com
Server: 192.168.1.192
Address: 192.168.1.192#53
Name: mail.ethnicity.com
Address: 192.168.1.192
> www.nyist.net
Server: 192.168.1.192
Address: 192.168.1.192#53
Non-authoritative answer:
Name: www.nyist.net
Address: 202.102.240.88
> www.google.com
Server: 192.168.1.192
Address: 192.168.1.192#53
Non-authoritative answer:
www.google.com 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.ethnicity.com(验证MX徽记:用于邮件服务器的域名定义)
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_5.3 <<>> -t MX mail.ethnicity.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.ethnicity.com. IN MX
;; AUTHORITY SECTION:
ethnicity.com. 86400 IN SOA ethnicity.com. root.ethnicity.com. 42 10800 900 604800 86400
;; Query time: 3 msec
;; SERVER: 192.168.1.192#53(192.168.1.192)
;; WHEN: Tue Feb 8 20:07:16 2011
;; MSG SIZE rcvd: 77
成功!
最后名词解释
SOA 指示该区的权威
(以学院的DNS为例,学院的主页202.102.240.88 学院的主DNS服务器为202.102.240.65 )
NS 列出该区的一个名字服务器(这个DNS服务器的名字)
A 域名到ip地址的映射(正解)
PTR ip地址到域名的映射(反解)
CNAME 设置别名
MX 与邮件服务有关的徽记