编辑: crazylinux 2007.03.23
这次我们来学习Linux首先我们需要安装bind我们架设DNS主域名服务器的地址是192.168.1.2 ,在主域名服务器中添加ltest.com,软件安装完后我们修改配置文件
[root@localhost ~]# vi /etc/named.conf
建立正向和反向区域文件
[root@localhost named]# cd /var/named/
[root@localhost named]# cp localhost.zone ltest.com.zone 后修改嘿嘿
把修改完后的ltest.com.zone cp对named.conf对区域文件测试
[root@localhost named]# named-checkzone ltest.com /var/named/ltest.com.zone
zone ltest.com/IN: loaded serial 42
OK
[root@localhost named]# named-checkzone 1.168.192.in-addr.arpa /var/named/192.168.1.rev
zone 1.168.192.in-addr.arpa/IN: loaded serial 42
OK
4地址指向自己
nameserver 192.168.1.2
search localdomain
5,测试主域名服务
[root@localhost named]# host ns1.ltest.com
ns1.ltest.com has address 192.168.1.2
[root@localhost named]# host ns2.ltest.com
ns2.ltest.com has address 192.168.1.3
[root@localhost named]# host host1.ltest.com
host1.ltest.com has address 192.168.1.174
[root@localhost named]# host -t mx ltest.com
ltest.com mail is handled by 5 mail.ltest.com.
[root@localhost named]# host 192.168.1.2
2.1.168.192.in-addr.arpa domain name pointer ns1.ltest.com.
[root@localhost named]# host 192.168.1.3
3.1.168.192.in-addr.arpa domain name pointer ns2.ltest.com.
[root@localhost named]# host 192.168.1.174
174.1.168.192.in-addr.arpa domain name pointer host1.ltest.com.
下面我们就来架设缓存域名服务器
软件包就OK
中做)
1,2,在从域名服务器的named.conf,内容如下
[root@localhost RPMS]# cat /etc/named.conf
//
// named.conf for Red Hat caching-nameserver
//
options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// 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 "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "ltest.com" IN {
type slave;
file "slaves/ltest.com.zone";
masters { 192.168.1.2 ; };
};
zone "1.168.192.in-addr.arpa" IN {
type slave;
file "slaves/192.168.1.rev";
masters { 192.168.1.2 ; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
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 {
type master;
file "named.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {