Chinaunix

标题: dns配置步骤 [打印本页]

作者: gridpc    时间: 2006-04-20 10:04
标题: dns配置步骤
1. 设置主机名为node1
2. 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.

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.

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.

named.conf文件的内容:(在/etc/下)
// generated by named-bootconf.pl

options {
    directory "/var/named";
   
    // query-source address * port 53;
};

//
// a caching only nameserver config
//
controls {
    inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
    type hint;
    file "named.ca";
};

zone "localhost" IN {
    type master;
    file "localhost.zone";
    allow-update { none; };
};

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";

resolv.conf文件的内容
domain test.com
nameserver 192.168.0.1
search test.com

nsswitch.conf文件中的改动:hosts:dns files

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


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/6901/showart_102333.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2