1. 在系统安装过程中,将DNS服务选项选中,系统中将会安装好Bind安装包。
-------------------------------------------------------------------------------------------------------------------------------------
2. 系统安装完成后,用:rpm –qa | grep bind 命令检验Bind的安装情况,正常情况下会有如下安装包:
- ypbind-1.19-8.el5
- bind-9.3.6-16.P1.el5
- bind-chroot-9.3.6-16.P1.el5
- bind-libs-9.3.6-16.P1.el5
- bind-utils-9.3.6-16.P1.el5
-------------------------------------------------------------------------------------------------------------------------------------
3. 看到如上安装包时,named服务是不会运行的,此时还要安装caching-nameserver-9.3.6-16.el5.i386.rpm (安装文件在附件中)
安装方法:
- #yum install caching-nameserver
提示安装完成后,查看,正常情况会有如下安装包:
- # rpm -qa | grep caching
caching-nameserver-9.3.6-16.P1.el5
安装成功
-------------------------------------------------------------------------------------------------------------------------------------
4. 启动named 服务:
- #service named start
-------------------------------------------------------------------------------------------------------------------------------------
5. 查看系统进程:
- # ps -aux | grep named
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
named 11615 0.5 0.3 38316 2980 ? Ssl 16:48 0:00 /usr/sbin/named -u named -c /etc/named.caching-nameserver.conf -t /var/named/chroot
root 11625 0.0 0.0 3928 668 pts/2 R+ 16:49 0:00 grep named
-------------------------------------------------------------------------------------------------------------------------------------
6. named 启动成功后,在/etc/目录下 named.caching-nameserver.conf 和 named.rfc1912.zones 两个文件
(这两个为链接文件,链接目的地址这/var/named/chroot/etc)
- #vi /var/named/chroot/etc/named.caching-nameserver.conf
- //
- // named.caching-nameserver.conf
- //
- // Provided by Red Hat caching-nameserver package to configure the
- // ISC BIND named(8) DNS server as a caching only nameserver
- // (as a localhost DNS resolver only).
- //
- // See /usr/share/doc/bind*/sample/ for example named configuration files.
- //
- // DO NOT EDIT THIS FILE - use system-config-bind or an editor
- // to create named.conf - edits to this file will be lost on
- // caching-nameserver package upgrade.
- //
- options {
- listen-on port 53 { 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";
- query-source port 53;
- query-source-v6 port 53;
- allow-query { any; };
- };
- logging {
- channel default_debug {
- file "data/named.run";
- severity dynamic;
- };
- };
- view localhost_resolver {
- match-clients { any; };
- match-destinations { any; };
- recursion yes;
- include "/etc/named.rfc1912.zones";
- };
-------------------------------------------------------------------------------------------------------------------------------------
- vi /var/named/chroot/etc/named.rfc1912.zones
- // named.rfc1912.zones:
- //
- // Provided by Red Hat caching-nameserver package
- //
- // ISC BIND named zone configuration for zones recommended by
- // RFC 1912 section 4.1 : localhost TLDs and address zones
- //
- // See /usr/share/doc/bind*/sample/ for example named configuration files.
- //
- 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 "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 {
- type master;
- file "named.zero";
- allow-update { none; };
- };
- zone "ihaveu.com" IN {
- type master;
- file "ihaveu.com";
- allow-update {none;};
- };
- zone "10.168.192.in-addr.arpa" IN {
- type master;
- file "ihaveu.arpa";
- allow-update {none;};
- };
7.
ihaveu.com 文件如下所示:(可以拷贝localname.zone里面的内容然后添加)
- $TTL 86400
- @ IN SOA localhost root (
- 42; serial (d.adams)
- 3H; refresh
- 15M; retry
- 1W; expiry
- 1D); minimum
- dns. IN NS dns.ihaveu.com.
- dns IN A 192.168.10.201
name.rapa文件如下所示:
- $ORIGIN 152.241.218.in-addr.arpa.
- @ IN SOA localhost root (
- 2008040801
- 86400
- 10800
- 604800
- 86400 )
- IN NS dns.ihaveu.com
- 201 IN PTR dns.ihaveu.com
( 注:201是本机IP的最后一段,如IP为192.168.10.201,那么此处就为“201” )
-------------------------------------------------------------------------------------------------------------------------------------
8. 重启named服务后,即可正常运行
- # service named restart
-------------------------------------------------------------------------------------------------------------------------------------
9. 测试
- #nslookup
- > server 192.168.10.201
- Default server: 192.168.10.201
- Address: 192.168.10.201#53
- > dns.ihaveu.com
- Server: 192.168.10.201
- Address: 192.168.10.201#53
- >
出现对方域名为解析成功