example.com.zone.external //external view正向区域文件
$TTL 3H
@ IN SOA ns1.example.com. root.example.com. (
2013051501 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.example.com.
ns1 IN A 202.100.1.110
88.168.192.zone //internal view的反向区域文件
$TTL 3H
@ IN SOA ns1.example.com. root.example.com. (
2013051501 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.example.com.
110 IN PTR ns1.example.com.
1.100.202.zone //external view的反向区域文件
$TTL 3H
@ IN SOA ns1.example.com. root.example.com. (
2013051501 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.example.com.
110 IN PTR ns1.example.com.
4.配置检查
named-checkconf /etc/named.conf
named-checkzone example.com /var/named/example.com.zone.internal
named-checkzone example.com /var/named/example.com.zone.external
named-checkzone 88.168.192.in-addr.arpa 88.168.192.zone
named-checkzone 1.100.202.in-addr.arpa 1.100.202.zone
5.启动服务
service named start
6.打开防火墙
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT //注意UDP一定也要打开
7.注册系统服务
chkconfig –level 35 named on
8.修改本机DNS配置 //注意不要直接修改/etc/resolver
vi /etc/sysconfig/network-script/ifcfg-eth0
DNS1=127.0.0.1
9.重启network服务
service network restart
测试
C:\>nslookup
Default Server: ns1.example.com
Address: 192.168.88.110
> example.com
Server: ns1.example.com
Address: 192.168.88.110
Name: example.com
> 192.168.88.110
Server: ns1.example.com
Address: 192.168.88.110
Name: ns1.example.com
Address: 192.168.88.110