redhat 5的DNS配置与redhat 4有很多不同
须安装三个软件:
bind caching-nameserver bind-chroot
redhat5安装caching nameserver后会在/var/named/chroot/etc下产生一个
named.rfc1912.zones 为原始配置文件
cp /var/named/chroot/etc/named.rfc1912.zones
/var/named/chroot/etc/named.conf
配置named.conf
选项,必须,不然会提示找不到文件
options{
directory "/var/named/";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
};
include "/etc/rndc.key";
在named.conf增加:
zone "example.com" IN {
type master;
file "example.com.zone";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0.arpa";
allow-update { none; };
};
复制,做为正解
cp /var/named/chroot/var/named/localhost.zone
/var/named/chroot/var/named/example.com.zone
正解的内容如下(example.com.zone):
$TTL 86400
example.com. IN SOA dns.example.com. root.example.com (
42 ; serial (d.
adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
example.com. IN NS dns.example.com.
dns IN A 192.168.0.124
[url]www.example.com[/url] . IN A 192.168.0.124
mail.example.com. IN A 192.168.0.125
mail2.example.com. IN A 192.168.0.126
bbs IN CNAME www
example.com. IN MX 10 mail.example.com.
example.com. IN MX 11 mail2.example.com.
复制,做为反解
cp /var/named/chroot/var/named/named.local
/var/named/chroot/var/named/192.168.0.arpa
反解的内容如下(192.168.0.arpa):
$TTL 86400
0.168.192.in-addr.arpa. IN SOA dns.example.com.
root.example.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
0.168.192.in-addr.arpa. IN NS dns.example.com.
124.0.168.192.in-addr.arpa. IN PTR dns.example.com.
124 IN PTR [url]www.example.com[/url] .
125 IN PTR mail.example.com.
126 IN PTR mail2.example.com.
[root@localhost /]# /etc/init.d/named stop
停止 named: [确定]
[root@localhost /]# /etc/init.d/named start
启动 named: [确定]
我把iptables停了
service iptables stop
设置dns // (必须)
vi /etc/resolv.conf
search example.com.
nameserver 192.168.0.2
配置网卡
vi /etc/sysconfig/network-scripts/ifcfg-eth0
重新启动网卡
service network restart
使用nslookup 进行检验