2011年11月21日 星期一

建置自管中文網域的 DNS 伺服器

TWNIC 在 2011 年正式在台灣全面推廣中文網域名稱申請與使用, 本文介紹網路工程師如何幫公司建置一部能管理中文網域的 DNS 伺服器, 以下為完整建置步驟 :

1. 申請中文網域名稱
   請參考 PCHOME 買網址 網站

2. 設定自管 DNS 伺服器 (以 PCHOME 為例)

   A. 進入 "管理我的網址" 網頁, 如下圖 :



   B. 輸入自管 DNS 伺服器的名稱與 IP 位址, 必須要二筆, 可相同名稱與 IP 位址,
      如下圖 :

   

3. 安裝 DNS 伺服器 (以 Ubuntu 10.04 為例)

   登入 Ubuntu Server 系統, 執行以下安裝命令 :

   $ sudo apt-get install bind9

4. 取得中文網域的 Punycode

  到 Punycode 轉碼 網頁, 輸入你的中文網域名稱, 取得 Punycode, 如下圖 :


5. 設定 DNS 管理你的中文網域

   A. 設定管理的中文網域名稱 (以 "大福" 為例) 及 zone 檔案, 命令如下 :

   $ sudo nano /etc/bind/named.conf.local
   // Do any local configuration here
   //

   // Consider adding the 1918 zones here, if they are not used in your
   // organization
   //include "/etc/bind/zones.rfc1918";

   zone "xn--pss076e.tw." {
      type master;
      file "/etc/bind/db.dafu.tw";
   };

   B. 設定 SOA, A, CNAME 等記錄

   $ sudo nano /etc/bind/db.dafu.tw
     $TTL  604800
     @   IN   SOA   KVMFS.xn--pss076e.tw. admin.gmail.com. (
            1     ; Serial
            604800     ; Refresh
            86400       ; Retry
            2419200    ; Expire
            604800 )    ; Negative Cache TTL
     ;
     @       IN     NS     KVMFS.xn--pss076e.tw.
     @       IN     A      140.137.214.45
     KVMFS      IN     A      140.137.214.45
     www  IN CNAME KVMFS.xn--pss076e.tw.

6. 重新啟動 DNS 伺服器

$ sudo /etc/init.d/bind9 restart

7. 重設本機的 DNS IP 位址

$ sudo nano /etc/resolv.conf
nameserver 140.137.214.45

8. 測試自管 DNS 伺服器

$ nslookup
> server
Default server: 140.137.214.45
Address: 140.137.214.45#53
> set type=any
> xn--pss076e.tw.
Server:        140.137.214.45
Address:    140.137.214.45#53

xn--pss076e.tw
    origin = KVMFS.xn--pss076e.tw
    mail addr = admin.gmail.com.
    serial = 1
    refresh = 604800
    retry = 86400
    expire = 2419200
    minimum = 604800
xn--pss076e.tw    nameserver = KVMFS.xn--pss076e.tw.
Name:    xn--pss076e.tw
Address: 140.137.214.45
> exit

9. 使用 Hinet 的 DNS 伺服器, 查詢你的中文網域資訊

$ nslookup
> server 168.95.1.1
Default server: 168.95.1.1
Address: 168.95.1.1#53
> set type=any
> xn--pss076e.tw
Server:        168.95.1.1
Address:    168.95.1.1#53

Non-authoritative answer:
Name:    xn--pss076e.tw
Address: 140.137.214.45
xn--pss076e.tw
    origin = KVMFS.xn--pss076e.tw
    mail addr = admin.gmail.com.xn--pss076e.tw
    serial = 1
    refresh = 604800
    retry = 86400
    expire = 2419200
    minimum = 604800
xn--pss076e.tw    nameserver = KVMFS.xn--pss076e.tw.

Authoritative answers can be found from:
xn--pss076e.tw    nameserver = KVMFS.xn--pss076e.tw.
> exit

參考網站
1. 全新推出「國際標準中文域名註冊與解析服務」!!

沒有留言:

張貼留言