RHEL5 简易DNS配置
RHEL5 DNS服务相关信息
Type: System V-managed service
• Packages: bind, bind-utils, blnd-chroot
• Daemons:/lusr/sbin/named,/lusr/sbin/rndc
• Script: /ete/init. d/named
• Ports: 53 (domain), 953(rndc)
• Configuration: (Under /var/named/chroot/) /etc/
named.conf,/var/named/*,/etc/rnde.key
• Related:caching-nameserver,openssl
1、安装DNS服务所需包
[root@redhat home]# rpm -qa |grep bind
bind-libs-9.3.3-7.el5
bind-devel-9.3.3-7.el5
bind-utils-9.3.3-7.el5
bind-9.3.3-7.el5
bind-sdb-9.3.3-7.el5
bind-libbind-devel-9.3.3-7.el5
ypbind-1.19-7.el5
bind-chroot-9.3.3-7.el5
[root@redhat home]# rpm -qa |grep caching-nameserver
caching-nameserver-9.3.3-7.el5
2.启动DNS服务 [root@redhat ~]# /etc/init.d/named start
[root@redhat ~]# chkconfig --level 345 named
关闭防火墙 [root@redhat ~]# /etc/init.d/iptables stop
将SElinux设为Permissive [root@redhat ~]# setenforce 0
3.[root@redhat ~]# cd /var/named/chroot/etc/
[root@redhat etc]# cp named.caching-nameserver.conf named.conf
[root@redhat etc]# chgrp named named.conf
[root@redhat etc]# vi named.conf
options {
listen-on port 53 { 172.18.30.86; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
query-source port 53;
query-source-v6 port 53;
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
include "/etc/named.rfc1912.zones";
"named.conf" 36L, 1109C
添加自己DNS域名[root@redhat etc]# vim named.rfc1912.zones
zone "em.com" IN {
type master;
file "em.com.db";
};
注意上面的em.com.db这是一个存放DNS各种记录的区域文件,一会需要自己在/var/named/chroot/var/named/里面新建。
4.配置区域文件[root@redhat etc]# cd /var/named/chroot/var/named
[root@redhat named]# cp localhost.zone em.com.db
[root@redhat named]# chgrp named em.com.db
[root@redhat named]# vim em.com.db
$TTL 86400
@ IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS redhat.em.com
redhat IN A 172.18.30.86
dns.em.com IN A 172.18.30.86
5.重启bind服务,使用nslookup检测dns。
#nslookup em.com