『尊米网』域名资讯平台

尊米首页 > 域名新闻 > 英文媒体报道 >

Linux: Create Your Own Domain Name Server (DNS)(3)


# dig @localhost +short MX example.com
10 mail.example.com.


# dig @localhost +short NS example.com
ns2.example.com.
ns1.example.com.


# dig @localhost +short mail.example.com
192.168.1.4


# dig @localhost +short ns1.example.com
192.168.1.2


# dig @localhost +short ns2.example.com
192.168.1.3


# dig @localhost +short -x 192.168.1.1
example.com.


# dig @localhost +short -x 192.168.1.2
ns1.example.com.


# dig @localhost +short -x 192.168.1.3
ns2.example.com.


# dig @localhost +short -x 192.168.1.4
mail.example.com.


Configuring the Slave Nameserver

Configuring the slave nameserver is fairly simple once you have your master nameserver set up correctly.


/var/named/chroot/etc/named.confDownload This File

options{
        directory       "/var/named/";
};
 
zone "example.com" IN {
        type    slave;
        masters { 192.168.1.2; };
        file    "slaves/example.com.zone";
};
As you can see all we did was set up our example.com zone as type slave and pointed to the master server and where we want to store the zone files (we don’t manually create them).



Now start the service and make sure it comes up on a reboot.

# service named start
# chkconfig named on



Soon you will see the zone file(s) created in /var/named/chroot/var/named/slaves/.
If they do not you can check your /var/log/messages file for errors.