2009年12月6日星期日

BIND中设置CNAME

语法:
别名(nickname) IN CNAME 主机名(hostname)

举例:
bash-3.2# dig www.google.com

; <<>> DiG 9.6.0-APPLE-P2 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29907 ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.google.com. IN A ;; ANSWER SECTION: www.google.com. 481429 IN CNAME www.l.google.com.
www.l.google.com. 34 IN A 64.233.189.147
www.l.google.com. 34 IN A 64.233.189.103
www.l.google.com. 34 IN A 64.233.189.104
www.l.google.com. 34 IN A 64.233.189.99

;; Query time: 22 msec
;; SERVER: 202.96.134.33#53(202.96.134.33)
;; WHEN: Sun Dec 6 19:36:53 2009
;; MSG SIZE rcvd: 116

我们访问www.google.com时真正访问的是www.l.google.com,www.google.com是www.l.google.com的别名。www.google.com. 481429 IN CNAME www.l.google.com.是一条CNAME纪录。

bash-3.2# nslookup www.google.com
Server: 202.96.134.33
Address: 202.96.134.33#53

Non-authoritative answer:
www.google.com canonical name = www.l.google.com.
Name: www.l.google.com
Address: 64.233.189.147
Name: www.l.google.com
Address: 64.233.189.104
Name: www.l.google.com
Address: 64.233.189.103
Name: www.l.google.com
Address: 64.233.189.99

www.google.com canonical name = www.l.google.com.是说
www.google.com的正规名(即实际主机名)为www.l.google.com。注意别名和canonical name指代不同。

以上是本人对cname、别名(Alias)的理解。

标签:


评论: 发表评论

订阅 博文评论 [Atom]





<< 主页

This page is powered by Blogger. Isn't yours?

订阅 博文 [Atom]