dns配置步骤
时间:2006-04-20 来源:gridpc
<!--[if !supportLists]-->1. <!--[endif]-->设置主机名为node1
<!--[if !supportLists]-->2. <!--[endif]-->Vi /etc/hosts加入
192.168.0.1 node1
3.chkconfig –list|grep named
4.chkconfig –level 35 named on
下面的文件可以在/var/named/下拷贝产生。
test.com文件内容:
$TTL 86400
@ IN SOA node1.test.com. root.localhost. (
1997022701 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS node1.test.com.
node1 IN A 192.168.0.1
www IN CNAME node1.test.com.
<!--[if !supportEmptyParas]--> <!--[endif]-->
0.168.192文件的内容:
$TTL 86400
@ IN SOA node1.test.com. root.localhost. (
1997022701 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS node1.test.com.
1 IN PTR node1.test.com.
<!--[if !supportEmptyParas]--> <!--[endif]-->
named.local文件的内容:
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
<!--[if !supportEmptyParas]--> <!--[endif]-->
named.conf文件的内容:(在/etc/下)
// generated by named-bootconf.pl
<!--[if !supportEmptyParas]--> <!--[endif]-->
options {
directory "/var/named";
// query-source address * port 53;
};
<!--[if !supportEmptyParas]--> <!--[endif]-->
//
// a caching only nameserver config
//
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.ca";
};
<!--[if !supportEmptyParas]--> <!--[endif]-->
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
<!--[if !supportEmptyParas]--> <!--[endif]-->
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "0.168.192";
};
zone "test.com" IN {
type master;
file "test.com";
};
include "/etc/rndc.key";
<!--[if !supportEmptyParas]--> <!--[endif]-->
resolv.conf文件的内容:
domain test.com
nameserver 192.168.0.1
search test.com
<!--[if !supportEmptyParas]--> <!--[endif]-->
nsswitch.conf文件中的改动:hosts:dns files
<!--[if !supportEmptyParas]--> <!--[endif]-->
5.#service named start
6.测试
#nslookup
>www.test.com
>192.168.0.1
>127.0.0.1
#ping www.test.com
#ping node1.test.com
#ping node1
#ping www.node1.test.com
#ping 192.168.0.1