域名行业新闻 域名应用/周边 抢注/争议报道 成功交易报道 拍卖叫价新闻 域名时事评析 域名商家动态 域名人物档案
返回首页

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

时间:2007-12-03 03:39   来源:Linux Today
@ SOA example.com. ( ; example.com is the primary server for this zone webmaster ; contact email is webmaster@example.com 2007112800 ; Serial ID in reverse date format 21600 ; Refresh interval for sla
@               SOA     example.com. (          ; example.com is the primary server for this zone
                        webmaster               ; contact email is webmaster@example.com
                        2007112800              ; Serial ID in reverse date format
                        21600                   ; Refresh interval for slave servers
                        1800                    ; Retry interval for slave servers
                        604800                  ; Expire limit for cached info on slave servers
                        900 )                   ; Minimum Cache TTL in zone records
Here we have the SOA (Start of Authority) section of the zone file. This is where we define various information and time limits (in seconds). One thing to note here is the Serial ID which is basically just an integer that let’s the slave servers know whether this file has changed or not. 2007112800 would be the first revision on 11/28/2007 whereas 2008010101 would be the second revision on 01/01/2008
@               NS      ns1                     ; ns1.example.com is a nameserver for example.com
@               NS      ns2                     ; ns2.example.com is a nameserver for example.com
Here we define the authoritative nameservers for this domain. A non-authoritative nameserver (or dns response) would be from your ISP’s dns for example.
@               MX      10 mail.example.com.    ; mail.example.com is the mail server for this zone
The MX (Mail Exchange) record defines this domain/zone’s email server (mail.example.com in this case).
@               A       192.168.1.1             ; example.com's ip address is 1.192.168.1.1
ns1             A       192.168.1.2             ; ns1.example.com's ip address is 192.168.1.2
ns2             A       192.168.1.3             ; ns2.example.com's ip address is 192.168.1.3
mail            A       192.168.1.4             ; mail.example.com's ip address is 192.168.1.4
An A (Address) record defines the domain or subdomain’s IP address. As you might have noticed already the @ stands for the zone file’s domain (example.com in this case). Additionally, if you do not end your name with a period (.) then it will append the domain to it. For example, ns1 becomes ns1.example.com whereas ns1.example.com would become ns1.example.com.example.com.
www             CNAME   example.com.            ; www.example.com is the same as example.com
A CNAME (Canonical Name) directly associates one name with another. Therefore www.example.com is the same as example.com.



/var/named/chroot/var/named/1.168.192.in-addr.arpa.zoneDownload This File

$TTL 86400
@               SOA     example.com. ( webmaster 2007112800 21600 1800 604800 900 )
Up until this point it is the same as our other zone file just with less whitespace and commenting.
                IN      NS      ns1.example.com.
You are required to enter at least one nameserver.
1       IN      PTR     example.com.
2       IN      PTR     ns1.example.com.
3       IN      PTR     ns2.example.com.
4       IN      PTR     mail.example.com.
We use PTR (pointer) records to define the domain names for each of our known ip addresses on 192.168.1.*. For example, 192.168.1.4 will now resolve as mail.example.com



Let’s start the server and then make sure it comes up after a reboot.

# service named start
# chkconfig named on

If you got an error while starting named go back and make sure you have a semi-colon in all the right spots in your named.conf



Now let’s test our nameserver to make sure it is working correctly.

# dig @localhost +short A example.com
192.168.1.1

责任编辑:米尊 

顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------


推荐内容
  • Domain name disputes

    Disputes involving domain names happen everyday, including ones involving .vn dom...

赞助商广告