Set up internal and external zone for 'named'




Step 1

[root@~]# vi /etc/named.conf acl internal { 192.168.0.0/16; }; view "internal" { match-clients { internal; }; zone "abc.com" { type master; file "/var/named/internal/abc.com.zone"; }; }; view "external" { match-clients { any; }; zone "abc.com" { type master; file "/var/named/external/abc.com.zone"; }; };

Add this lines into the named config file
You may need relocate the default zone into "External" vien if you got the error during start up.




Step 2

mkdir /var/named/chroot/var/named/internal
mkdir /var/named/chroot/var/named/external
cd /var/named
ln -s /var/named/chroot/var/named/internal
ln -s /var/named/chroot/var/named/external

Make directory to store the internal and external zone files.

[root@~]# vi /var/named/internal/abc.com.zone $ttl 400 abc.com. IN SOA ns1.abc.com. root.abc.com. ( 1 1800 3600 1800 1801 ) IN NS ns1.abc.com. IN MX 10 mail.abc.com. abc.com. IN A 192.168.1.123 www IN A 192.168.1.123 mail IN A 192.168.1.123 ns1 IN A 192.168.1.123

Edit the internal zone file "/var/named/internal/abc.com" for private IP 192.168.x.x

[root@~]# vi /var/named/external/abc.com.zone $ttl 400 abc.com. IN SOA ns1.abc.com. root.abc.com. ( 1 1800 3600 1800 1801 ) IN NS ns1.abc.com. IN MX 10 mail.abc.com. abc.com. IN A 202.123.123.123 www IN A 202.123.123.123 mail IN A 202.123.123.123 ns1 IN A 202.123.123.123

Edit the external zone file "/var/named/internal/abc.com" for public IP 202.123.123.123




Step 3

[root@~]# /etc/init.d/named restart

Restart named service.

[root@~]# dig @202.123.123.123 yahoo.com

Test DNS from external network from other external server.

C:\nslookup
server 192.168.1.123
yahoo.com

Test DNS from internal network from client window PC.

[root@~]# less /var/log/named.log

01-Mar-2009 04:05:11.212 queries: client 127.0.0.1#44420: view external: query: abc.com IN MX +
01-Mar-2009 04:05:11.212 queries: client 192.168.1.10#44421: view internal: query: abc.com IN MX +

View the log like as this format.
P.S. Applied the log section first in /etc/named.conf


Server is hosted by Alanstudio
Linux Operating System

Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.