[root@localhost ~]# rpm -qa |grep bind
bind-utils-9.6.2-5.P2.fc12.i686
samba-winbind-clients-3.4.2-47.fc12.i686
bind-libs-9.6.2-5.P2.fc12.i686
bind-chroot-9.6.2-5.P2.fc12.i686
PackageKit-device-rebind-0.5.4-0.1.20091029git.fc12.i686
bind-devel-9.6.2-5.P2.fc12.i686
bindfs-1.8.3-3.fc12.i686
bind-sdb-9.6.2-5.P2.fc12.i686
ypbind-1.20.4-20.fc12.i686
bind-dyndb-ldap-0.1.0-0.5.a1.fc12.i686
bind-9.6.2-5.P2.fc12.i686
rpcbind-0.2.0-4.fc12.i686
bind-to-tinydns-0.4.3-6.fc12.i686
|
[root@localhost ~]# yum install bind*
|
[root@localhost ~]# vim /etc/named.conf
添加的内容如下
zone "swz.cn." IN {
type master;
file "swz.cn.zone";//正向解析(域名-->ip地址)文件的名字,名字任意取
allow-update { none;};
};
zone "40.168.192.in-addr.arpa." IN {
type master;
file "192.168.40.zone";//反向解析(ip地址--->域名)文件的名字,名字任意取
allow-update { none;};
};
|
[root@localhost ~]# cd /var/named/
[root@localhost named]# cp named.localhost swz.cn.zone //以named.localhost作为正向解析文件的模板,文件的名字同主配置文件中正向解析文件的名字
[root@localhost named]# cp named.localhost 192.168.40.zone //以named.loopback作为反向解析文件的模板,文件的名字同配置文件中反向解析文件的名字
|
[root@localhost named]# vim swz.cn.zone
修改的内容如下
$TTL 1D
@ IN SOA www.swz.cn. root.www.swz.cn. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS 192.168.40.83
www IN A 192.168.40.83 //swz.cn域里的主机名1==>www.swz.cn
fedora IN A 192.168.40.83 //swz.cn域里的主机名2==>fedora.swz.cn
|
[root@localhost named]# vim 192.168.40.zone
修改的内容如下
$TTL 1D
@ IN SOA www.swz.cn. root.www.swz.cn. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS 192.168.40.83
83 IN PTR fedora.swz.cn. //83:pc机ip地址的最后一位
83 IN PTR www.swz.cn. //83:pc机ip地址的最后一位
|
[root@localhost named]# chmod 777 swz.cn.zone
[root@localhost named]# chmod 777 192.168.40.zone
|
[root@localhost named]# vim /etc/resolv.conf
修改内容如下
# Generated by NetworkManager
#nameserver 61.128.128.68
nameserver 192.168.40.83 //添加的部分本机的ip地址
nameserver 61.154.22.41
|
[root@localhost named]# setup --进入图形界面设置,在防火墙规则里允许dns
|
[root@localhost named]# service named restart
|
[root@localhost named]# nslookup --使用nslooku工具进行验证
> www.swz.cn
Server: 192.168.40.83
Address: 192.168.40.83#53
Name: www.swz.cn
Address: 192.168.40.83
> fedora.swz.cn
Server: 192.168.40.83
Address: 192.168.40.83#53
Name: fedora.swz.cn
Address: 192.168.40.83
> 192.168.40.83
Server: 192.168.40.83
Address: 192.168.40.83#53
83.40.168.192.in-addr.arpa name = www.swz.cn.
83.40.168.192.in-addr.arpa name = fedora.swz.cn.
>
|
[root@localhost named]# service named restart
停止 named: [确定]
启动 named: [确定]
[root@localhost named]# tail /var/log/messages
Nov 25 10:50:46 localhost named-sdb[4351]: zone 40.168.192.in-addr.arpa/IN: loaded serial 0
Nov 25 10:50:46 localhost named-sdb[4351]: zone 1.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: NS '1.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' has no address records (A or AAAA)
Nov 25 10:50:46 localhost named-sdb[4351]: zone 1.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: loaded serial 0
Nov 25 10:50:46 localhost named-sdb[4351]: zone swz.cn/IN: NS '192.168.40.83.swz.cn' has no address records (A or AAAA)
Nov 25 10:50:46 localhost named-sdb[4351]: zone swz.cn/IN: loaded serial 0
Nov 25 10:50:46 localhost named-sdb[4351]: zone localhost.localdomain/IN: loaded serial 0
Nov 25 10:50:46 localhost named-sdb[4351]: zone localhost/IN: loaded serial 0
Nov 25 10:50:46 localhost named-sdb[4351]: running
Nov 25 10:50:46 localhost named-sdb[4351]: zone swz.cn/IN: sending notifies (serial 0)
Nov 25 10:50:46 localhost named-sdb[4351]: zone 40.168.192.in-addr.arpa/IN: sending notifies (serial 0)
[root@localhost named]#
|