7.[root@linuxidc named]# cat linuxidc.rev //反向区域
$TTL 86400
@ IN SOA linuxidc.com. root.linuxidc.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS linuxidc.com.
40 IN PTR mail.linuxidc.com.
40 IN PTR
8.[root@linuxidc bind]# cat /etc/resolv.conf //设置域名为本机ip
nameserver 192.168.40.40
search linuxidc.com
9.[root@linuxidc bind]# cat /etc/hosts //查看本地hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.40.40 linuxidc.com linuxidc
10.[root@linuxidc bind]# cat /etc/sysconfig/network//查看本地hostname
NETWORKING=yes
HOSTNAME=linuxidc.com
11.测试nslookup
[root@linuxidc bind]# service named restart
Stopping named: . [ OK ]
Starting named: [ OK ]
[root@linuxidc bind]# nslookup
>
Server: 192.168.40.40
Address: 192.168.40.40#53
** server can't find : REFUSED
> //出现这个原因为/etc/named.conf
allow-query { 0.0.0.0; } 如果没加/0就会出现上面的拒绝信息或者为any也是可以的。
[root@linuxidc bind]# service named restart//修改好之后重启named服务
Stopping named: . [ OK ]
Starting named: [ OK ]
[root@linuxidc bind]# nslookup//查看DNS正向区域
>
Server: 192.168.40.40
Address: 192.168.40.40#53
Name:
Address: 192.168.40.40
//成功查询哈哈!
[root@linuxidc bind]# nslookup//查看DNS反向区域
> 192.168.40.40
Server: 192.168.40.40
Address: 192.168.40.40#53
40.40.168.192.in-addr.arpa name =
40.40.168.192.in-addr.arpa name = mail.linuxidc.com.
//成功查询。
[root@linuxidc bind]# nslookup
> set type=MX
> mail.linuxidc.com
Server: 192.168.40.40
Address: 192.168.40.40#53
mail.linuxidc.com mail exchanger = 10 mail.linuxidc.com.linuxidc.com.
> //邮件交换成功