2009年10月16日 星期五

CentOS安裝dns (forward-only)

1.bind的必需套件
  • bind
  • caching-nameserver (只負責forwarding的dns套件)
  • bind-chroot (change root directory)
  • bind-utils (dig..等工具)
  • system-config-bind(圖形介面設定工作)
    2.檢查並安裝
    • #rpm -qa bind*
    • #rpm -qa system-config-bind
    • #yum -y install bind system-config-bind --->安裝缺少的套件
    3.bind的設定檔/etc/named.conf
    • #ls -al /etc/named.caching-nameserver.conf
      • lrwxrwxrwx 1 root named 52 10月 15 14:41 /etc/named.caching-nameserver.conf -> /var/named/chroot//etc/named.caching-nameserver.conf
      • 真實的設定檔己經被chroot到粗體字的目錄下
    • #cd /var/named/chroot/etc/
    • #cp named.caching-nameserver.conf  named.conf
    • #ls -l --->發現named.conf權限不正確
      • -rw-r----- 1 root named 1195  7月 30 08:56 named.caching-nameserver.conf
        -rw-r----- 1 root root  1195 10月 15 14:57 named.conf
    • #chown root.named named.conf
    • #service named restart
    4.測試
    • #dig www.ibm.com @127.0.0.1 --->測試本機的dns是否有回應
      •  ;; Query time: 1994 msec
        ;; SERVER: 127.0.0.1#53(127.0.0.1)
        ;; WHEN: Thu Oct 15 15:09:00 2009
        ;; MSG SIZE  rcvd: 178
    • #vi named.conf --->提供dns服務給anyone
      • options {
      •         listen-on port 53 { any; };
      •         listen-on-v6 port 53 { ::1; };
      •  allow-query     { any; };
      • view localhost_resolver {
                match-clients      { any; };
                match-destinations { any; };
                recursion yes;
                include "/etc/named.rfc1912.zones";
        };

         

    沒有留言:

    張貼留言