LAMP平台下构建Postfix邮件服务器(2)

[root@www ~] yum install bind-* -y //-y表示默认确定安装,不加-y后面会有交互式的提示

安装缓存包,用于创建 named.conf 主配置文件
[root@www ~] cd /var/named/chroot/etc/
[root@www etc]# rpm -ivh /mnt/Server/caching-nameserver-9.3.6-16.P1.el5.i386.rpm
Preparing...                ########################################### [100%]
   1:caching-nameserver     ########################################### [100%]
[root@www etc]# ll
总计 16
-rw-r--r-- 1 root root   405 05-10 21:03 localtime
-rw-r----- 1 root named 1230 2010-12-03 named.caching-nameserver.conf
-rw-r----- 1 root named  955 2010-12-03 named.rfc1912.zones
-rw-r----- 1 root named  113 05-15 15:50 rndc.key
[root@www etc]# cp -p named.caching-nameserver.conf named.conf  //-p表示复制文件的属性
[root@www etc]# vi named.conf


options {
        directory       "/var/named";
};
zone "linuxidc.com" IN {
        type master;
        file "linuxidc.zone";
};
zone "10.168.192.in-addr.arpa" in {
        type master;
        file "linuxidc.zero";
};

[root@www etc]# named-checkconf named.conf   //检查配置文件有没有语法错误,如果没有任何输出结果表示没有错误
[root@www etc]#                              //在此没有输出结果
[root@www etc]# cd ../var/named/
[root@www named]# ll
总计 36
drwxrwx--- 2 named named 4096 2004-08-26 data
-rw-r----- 1 root  named  198 2010-12-03 localdomain.zone
-rw-r----- 1 root  named  195 2010-12-03 localhost.zone
-rw-r----- 1 root  named  427 2010-12-03 named.broadcast
-rw-r----- 1 root  named 1892 2010-12-03 named.ca
-rw-r----- 1 root  named  424 2010-12-03 named.ip6.local
-rw-r----- 1 root  named  426 2010-12-03 named.local
-rw-r----- 1 root  named  427 2010-12-03 named.zero
drwxrwx--- 2 named named 4096 2004-07-27 slaves
[root@www named]# cp -p localhost.zone linuxidc.zone //创建区域数据库文件
[root@www named]# vi linuxidc.zone
$TTL    86400
@               IN SOA  linuxidc.com.       root.linuxidc.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

@               IN NS          
www             IN A            192.168.10.170
mail            IN A            192.168.10.170
                IN MX 10        mail.linuxidc.com.
*               IN A            192.168.10.170
pop3            IN CNAME        mail
smtp            IN CNAME        mail
:wq  //保存退出

[root@www named]# cp -p linuxidc.zone linuxidc.zero //创建反向解析文件
[root@www named]# vi linuxidc.zero
$TTL    86400
@               IN SOA  linuxidc.com.       root.linuxidc.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

IN NS          
170             IN PTR         
170             IN PTR          mail.linuxidc.com.
:wq  //保存退出

[root@www ~]# cd /var/named/chroot/var/named/
[root@www ~]# named-checkzone linuxidc.com linuxidc.zone
zone linuxidc.com/IN: loaded serial 42
OK
[root@www named]#           //  named-checkzone通过检查句法的正确性来检查区带(zone)文件的正确性。named-checkzone如果没有检查到错误,会返回一个简单的“OK”字

符。  

[root@www ~]# vi /etc/resolv.conf
nameserver 192.168.10.170  //修改DNS指向自己

[root@www etc]# nslookup 192.168.10.170   //验证反向解析
Server:         192.168.10.170
Address:        192.168.10.170#53

170.10.168.192.in-addr.arpa     name =
170.10.168.192.in-addr.arpa     name = mail.linuxidc.com.

[root@www etc]# nslookup mail.linuxidc.com  
Server:         192.168.10.170
Address:        192.168.10.170#53

Name:   mail.linuxidc.com
Address: 192.168.10.170

[root@www etc]#
[root@www etc]# chkconfig named on     //添加为随系统启动
[root@www etc]# chkconfig --add named  //添加到系统服务列表
[root@www etc]# rndc reload
server reload successful

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

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