案例4 視圖 viwer
拓撲圖:
1.查看幫助
[root@host2 ~]# vim /usr/share/doc/bind-9.8.2/sample/etc/named.conf
[root@host~]# cd /var/named/chroot/etc
2.[root@host2 etc]# vim named.conf
添加視圖:
36 view "lan-view"
37 {
38 zone "." IN {
39 type hint;
40 file "named.ca";
41 };
42 zone "ab.com" {
43 type master;
44 file "ab.com.lan";
45 };
46 include "/etc/named.rfc1912.zones";
47 };
48
49 view "internet-view"
50 {
51 zone "." IN {
52 type hint;
53 file "named.ca";
54 };
55 zone "ab.com" {
56 type master;
57 file "ab.com.internet";
58 };
59 };
60 //include "/etc/named.root.key";
61
3.
[root@host2 chroot]# cd var/named/
[root@host2 named]# cp -p named.localhost ab.com.lan
[root@host2 named]# vim ab.com.lan
$TTL 1D
@INSOAns.ab.com.rname.invalid. (
2;serial
1D;refresh
1H;retry
1W;expire
3H ); minimum
@INNSns.ab.com.
nsINA192.168.10.10
wwwINA192.168.10.50
[root@host2 named]# cp -p named.localhost ab.com.internet
[root@ host2 named]# vim ab.com.internet
$TTL 1D
@INSOAns.ab.com.rname.invalid. (
1;serial
1D;refresh
1H;retry
1W;expire
3H ); minimum
@INNSns.ab.com.
nsINA192.168.10.10
wwwINA61.1.1.1
4.
查看幫助
[root@ host2~]# man named.conf
ACL match
9 acl lan-user { 192.168.10.0/24; };
10 acl internet-user { any; };
編輯主配置文檔named.conf :
[root@ host2 etc]# vim named.conf
Match-clients{ lan-user; };
zone ”.” IN {
type hint;
file “named.ca”;
};
zone "ab.com" {
type master;
file "ab.com.lan";
};
Include “/etc/named.rfc1912.zones”;
};
View“internet-view”
{match-clients { internet-user; };
zone "." IN {
typehint;
file "named.ca";
};
Zone “abc.com” {
Typemaster;
5.內網測試:
用windows server 2003:
C:\Documents and Settings\Administrator>nslookup www.ab.com
DNS request timed out.
timeout was 2 seconds.
*** Can't find server name for address 192.168.10.10: Timed out
Server: UnKnown
Address: 192.168.10.10
Name: www.ab.com
Address: 192.168.10.10
6.防火牆配置
[H3C]int eth0/0
[H3C-Ethernet0/0]ip add 192.168.10.1 24
[H3C-Ethernet0/0]int eth0/4
[H3C-Ethernet0/4]ip add 61.1.1.1 24
[H3C]firewall zone trust
[H3C-zone-trust]add int eth0/0
The interface has been added to trust security zone.
[H3C-zone-trust]add int eth0/4
[H3C-zone-trust]dis ip routing-table
Routing Table: public net
Destination/Mask Protocol Pre Cost Nexthop Interface
61.1.1.0/24 DIRECT 0 0 61.1.1.1 Ethernet0/4
61.1.1.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
192.168.10.0/24 DIRECT 0 0 192.168.10.1 Ethernet0/0
192.168.10.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
DNAT語句:
[H3C-Ethernet0/4]nat server protocol udp global 61.1.1.1 53 inside 192.168.10.10 53
7.用外網(61.1.1.0網段)的一臺windows server 2003虛擬機測試:
C:\Documents and Settings\Administrator>nslookup www.ab.com
DNS request timed out.
timeout was 2 seconds.
*** Can't find server name for address 192.168.10.10: Timed out
Server: UnKnown
Address: 192.168.10.10
Name: www.ab.com
Address: 61.1.1.1