2009年10月16日 星期五

CentOS設定DNS管網域

基本設定請參
CentOS安裝dns (forward only)

新增一個zone
  • #vi /etc/named.rfc1912.conf
    • zone "ne94.kirnel.com" IN {
    •         type master;
    •         file "ne94.zone";
    •         allow-update { none; };
    • };
建立ne94.zone檔案的內容
  • #cd /var/named/chroot/var/named/
  • #cp localhost.zone ne94.zone
  • #vi ne94.zone
    • $TTL    86400
    • @               IN SOA  @       root (
    •                                         2009101601              ; serial (d. adams) --->序號
    •                                         3H              ; refresh
    •                                         15M             ; retry
    •                                         1W              ; expiry
    •                                         1D )            ; minimum

    •                 IN NS           @
    •                 IN A            127.0.0.1
    •                 IN AAAA         ::1
    • www          IN A            123.123.123.123 --->新增設定
    • w3              IN CNAME        www --->新增設定
變更 ne94.zone的權限
  • #chown root.named ne94.zone
    • -rw-r----- 1 root  named  195  7月 30 08:56 localhost.zone
    • -rw-r----- 1 root  named  427  7月 30 08:56 named.zero
    • -rw-r----- 1 root  root   247 10月 15 16:14 ne94.zone
測試
  • # dig @140.137.217.94 w3.ne94.kirnel.com --->回應正確
    • ;; ANSWER SECTION:
    • w3.ne94.kirnel.com.     86400   IN      CNAME   www.ne94.kirnel.com.
    • www.ne94.kirnel.com.    86400   IN      A       123.123.123.123

    • ;; AUTHORITY SECTION:
    • ne94.kirnel.com.        86400   IN      NS      ne94.kirnel.com.

    • ;; ADDITIONAL SECTION:
    • ne94.kirnel.com.        86400   IN      A       127.0.0.1
    • ne94.kirnel.com.        86400   IN      AAAA    ::1

    • ;; Query time: 1 msec
    • ;; SERVER: 140.137.217.94#53(140.137.217.94)
    • ;; WHEN: Thu Oct 15 16:22:12 2009
    • ;; MSG SIZE  rcvd: 128

沒有留言:

張貼留言