您的位置:首页 > 其它

使用bind配置DNS实验

2013-07-09 20:10 375 查看
使用bind配置DNS实验 作者:lichangzai收藏

我要投稿
使用bind配置DNS实验一、实验环境:Red Hat Enterprise Linux Server release 5.6主机名 www.2cto.com IP系统版本Host rolehotel01192.168.2.111OEL5.6serverhotel02192.168.2.112OEL5.6clienthotel03192.168.2.113OEL5.6client….. www.2cto.com 配置说明:NDS服务器放在了hotel01(master)节点上,对hotel01、hotel02、hotel03节点的主机名进行解析。二、安装配置DNS1. 安装bind、caching-nameserver软件包--因使用的是未注册的OEL版本,所以yum不能在线安装bind软件--安装下面bind包,如果缺少可以在安装盘上查找并安装[root@hotel01 ~]# rpm -qa|grep bindbind-utils-9.3.6-16.P1.el5ypbind-1.19-12.el5bind-chroot-9.3.6-16.P1.el5bind-9.3.6-16.P1.el5bind-libs-9.3.6-16.P1.el5bind-libbind-devel-9.3.6-16.P1.el5bind-devel-9.3.6-16.P1.el5bind-libs-9.3.6-16.P1.el5[root@hotel01 ~]# rpm -qa|grep caching-nameservercaching-nameserver-9.3.6-16.P1.el52. 修改bind配置文件BIND的配置文件name.conf还有区域文件都在/var/named/chroot/目录下配置文件named.conf在/var/named/chroot/etc/下,区域配置文件在/var/named/chroot/var/named/下1) 修改配置文件named.conf[root@hotel01 ~]# cd /var/named/chroot/etc[root@hotel01 etc]# cp -p named.caching-nameserver.conf named.conf[root@hotel01 etc]# vi named.confoptions { listen-on port 53 { any; }; --把127.0.0.1改成any 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"; // Those options should be used carefully because they disable port // randomization // query-source port 53; // query-source-v6 port 53; allow-query { any; }; allow-query-cache { any; };};logging { channel default_debug { file "data/named.run"; severity dynamic; };};view localhost_resolver { match-clients { any; }; --把localhost改成any match-destinations { any; }; --把localhost改成any recursion yes; include "/etc/named.rfc1912.zones";};2) 修改配置文件named.rfc1912.zones,在文件中添加以下内容[root@hotel01 etc]# pwd/var/named/chroot/etc[root@hotel01 etc]# vi named.rfc1912.zoneszone "licz.com" IN { //这是自己设置的域名 type master; file "licz.com.zone"; allow-update { none; };};zone "2.168.192.in-addr.arpa" IN { //这是反向配置文件 type master; file "2.168.192.in-addr.zone"; allow-update { none; };};3) 创建leonarding.com.zone和2.168.192.in-addr.zon 区域文件[root@hotel01 etc]# cd /var/named[root@hotel01 named]# cp -p localdomain.zone chroot/var/named/licz.com.zone[root@hotel01 named]# cp -p named.local chroot/var/named/2.168.192.zone--修改leonarding.com.zone和2.168.192.in-addr.zon 区域文件[root@hotel01 named]# cd /var/named/chroot/var/named[root@hotel01 named]# vi licz.com.zone$TTL 86400@ IN SOA localhost root ( 42 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS localhost//添加下面的正向文件内容hotel01 IN A 192.168.2.111hotel02 IN A 192.168.2.112hotel03 IN A 192.168.2.113[root@hotel01 named]# vi 2.168.192.in-addr.zone$TTL 86400@ IN SOA localhost. root.localhost. ( 1997022700 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum IN NS localhost.//添加下面的反向向文件内容111 IN PTR hotel01.licz.com112 IN PTR hotel02.licz.com113 IN PTR hotel03.licz.com4) 修改各节点/etc/resolv.conf文件[root@hotel01 named]# vi /etc/resolv.confnameserver 192.168.2.111[root@hotel02 named]# vi /etc/resolv.confnameserver 192.168.2.111[root@hotel03 named]# vi /etc/resolv.confnameserver 192.168.2.1113. 验证测试[root@hotel01 etc]# nslookup> hotel01.licz.comServer: 192.168.2.111Address: 192.168.2.111#53Name: hotel01.licz.comAddress: 192.168.2.111> hotel02.licz.comServer: 192.168.2.111Address: 192.168.2.111#53Name: hotel02.licz.comAddress: 192.168.2.112> hotel03.licz.comServer: 192.168.2.111Address: 192.168.2.111#53Name: hotel03.licz.comAddress: 192.168.2.113[root@hotel01 named]# ping hotel03.licz.comPING hotel03.licz.com (192.168.2.113) 56(84) bytes of data.64 bytes from hotel03 (192.168.2.113): icmp_seq=1 ttl=64 time=10.8 ms64 bytes from hotel03 (192.168.2.113): icmp_seq=2 ttl=64 time=0.360 ms64 bytes from hotel03 (192.168.2.113): icmp_seq=3 ttl=64 time=0.332 ms64 bytes from hotel03 (192.168.2.113): icmp_seq=4 ttl=64 time=0.299 ms64 bytes from hotel03 (192.168.2.113): icmp_seq=5 ttl=64 time=0.306 ms

文章出处: http://www.2cto.com/os/201303/193654.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: