当前位置: 首页 > 图文教程 > 服务器 > Linux服务器 > Linux操作系统下配置DNS服务器的方法介绍

Linux服务器
apache urlrewrite防盗链功能配置
实战 LAMP 服务器配置 完整篇
tomcat 5.5连接池配置,如何让工程为默认工程
搭建一个大型网站架构的实验环境(Squid缓存服务器篇)
Windows 配置Apache以便在浏览器中运行Python script的CGI模式
Apache 网站速度更快
ubuntu lighttpd+webpy (fastcgi)配置方法
linux 入侵常用命令汇编
Linux 快速定位web路径方法
winxp apache用php建本地虚拟主机的方法
Apache 多站点虚拟主机配置方法
redhat Server release 5.2 安装配置简明教程
Ubuntu Linux系统下轻松架设nginx+php服务器应用
Linux Apache+Proftpd构建虚拟主机时要注意的几个安全问题
Linux 服务器同步 Rsync同步服务器文件
APACHE 多站点配置方法
基于Apache的支持.NET2.0的Web服务器搭建
Ubuntu 下配置Rsync服务的方法
利用rsync自动备份 完全配置方法 增加了ip限制
Linux 每天自动备份mysql数据库的方法

Linux服务器 中的 Linux操作系统下配置DNS服务器的方法介绍


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-18   浏览: 75 ::
收藏到网摘: n/a

有两台邮件服务器分别为192.168.1.1(windows下主机名为b.test.cn)和192.168.1.3(linux下主机名为a.test.com)。

在linux下配置DNS服务器,下面是配置过程中设置过的一些文件,

/etc/hosts文件的具体内容如下:

#Donotremovethefollowingline,orvariousprograms

#thatrequirenetworkfunctionalitywillfail.

127.0.0.1localhost.localdomainlocalhostfc4

192.168.1.3a.test.coma

192.168.1.1b.test.cnb

/etc/host.conf文件:

orderhosts,bind

表示先用hosts文件做解析,在用DNS解析

/etc/resolv.conf文件:

;generatedbyNetworkManager,donotedit!

searchtest.com

nameserver127.0.0.1

searchtest.cn

nameserver192.168.1.1

nameserver61.144.56.100

/etc/named.conf文件:

//

//named.confforRedHatcaching-nameserver

//

options{

directory"/var/named";

dump-file"/var/named/data/cache_dump.db";

statistics-file"/var/named/data/named_stats.txt";

/*

*Ifthereisafirewallbetweenyouandnameserversyouwant

*totalkto,youmightneedtouncommentthequery-source

*directivebelow.PreviousversionsofBINDalwaysasked

*questionsusingport53,butBIND8.1usesanunprivileged

*portbydefault.

*/

//query-sourceaddress*port53;

};

//

//acachingonlynameserverconfig

//

controls{

inet127.0.0.1allow{localhost;}keys{rndckey;};

};

zone"."IN{

typehint;

file"named.ca";

};

zone"test.com"IN{

typemaster;

file"test.com";

allow-update{none;};

};

zone"1.168.192.in-addr.arpa"IN{

typemaster;

file"192.168.1.rev";

allow-update{none;};

};

zone"test.cn"IN{

typemaster;

file"test.cn";

allow-update{none;};

};

zone"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"IN{

typemaster;

file"named.ip6.local";

allow-update{none;};

};

zone"255.in-addr.arpa"IN{

typemaster;

file"named.broadcast";

allow-update{none;};

};

zone"0.in-addr.arpa"IN{

typemaster;

file"named.zero";

allow-update{none;};

};

include"/etc/rndc.key";

在/var/name/test.com文件下:

$TTL86400

@INSOAa.test.com.root.a.test.com(

42;serial(d.adams)

3H;refresh

15M;retry

1W;expiry

1D);minimum

INNSa.test.com.

INMX10mail.test.com.

aINA192.168.1.3

mailINA192.168.1.3

//其中root.a.test.com的含义是管理员的邮箱

/var/name/test.cn文件下:

$TTL86400

@INSOAb.test.cn.root.a.test.com(

42;serial(d.adams)

3H;refresh

15M;retry

1W;expiry

1D);minimum

INNSb.test.cn.

INMX10mail.test.cn.

bINA192.168.1.1

mailINA192.168.1.1

/var/name/192.168.1.rev文件下:

$TTL86400

@INSOA1.168.192.in-addr.arpa.root.test.com.(

1997022700;Serial

28800;Refresh

14400;Retry

3600000;Expire

86400);Minimum

INNSa.test.com.

INNSb.test.cn.

INMX10mail.test.com.

INMX10mail.test.cn.

3INPTRa.test.com.

3INPTRmail.test.com.

1INPTRb.test.cn.

1INPTRmail.test.cn.

然后用/etc/init.d/namedrestart重启DNS服务,在重启过程中,我曾经出现过好几次的错误,按照出错的提示,会提示是named.conf文件第几行出错的。或者提示在那些包含文件例如test.cn这些文件里面的问题,然后一个一个排除。

最后还有一些nslookup的命令比较有用:

setall用于显示使用nslookup工具这台机器上的DNS服务器的一些信息

settype=any会显示完整信息包括域中邮件服务器和主从DNS服务器的名字和IP地址

server192.168.0.1更换查询的DNS服务器地址。