CentOS5.5 下配置DNS

來源:互聯網
上載者:User

標籤:配置   伺服器   dns   

1.配置網卡IP地址

#ifconfig   eth0   192.168.186.188


2.關閉防火牆

#iptables -F


3.安裝軟體   

所需要的軟體:bind和caching-name

#rpm  -ivh  bind-9.3.6-4.P1.el5

#rpm  -ivh  caching-nameserver-9.3.6-4.P1.el5


4.修改named.conf 設定檔

修改named.caching-nameserver.conf

#cp /etc/named.caching-nameserver.conf  /etc/named.conf 

#vi /etc/named.conf

將所有的localhoat都修改為any


5.修改地區檔案

vi  /etc/named.rfc1912.zones 


zone "huanjie.com" IN {

        type master;

        file "huanjie.com.hosts";

        allow-update { none; };

};

zone "22.64.10.in-addr.arpa" IN {

        type master;

        file "huanjie.com.rev";

        allow-update { none; };

};


6.建立正向設定檔

#cd /usr/share/doc/bind-9.7.0/sample/var/named

#cp  -p   named.localhost    /var/named/

#cd /var/named

#cp   named.localhost   huanjie.com.hosts

#vi  huanjie.com.hosts

內容如下:

$TTL 1D

@       IN SOA  @ rname.invalid. (

                                        0       ; serial

                                        1D      ; refresh

                                        1H      ; retry

                                        1W      ; expire

                                        3H )    ; minimum

               NS       server2.huanjie.com.

server2        IN   A   192.168.186.188

www            IN   A   192.168.186.188

ftp            IN   A   192.168.186.188


7.建立反向設定檔

#cp   huanjie.com.hosts   huanjie.com.rev

#vi   huanjie.com.rev

  

$TTL 1D

@       IN SOA  @ rname.invalid. (

                                        0       ; serial

                                        1D      ; refresh

                                        1H      ; retry

                                        1W      ; expire

                                        3H )    ; minimum

        NS      server2.huanjie.com.


188  IN  PTR   server2.huanjie.com.

188  IN  PTR   www.huanjie.com.

188  IN  PTR   ftp.huanjie.com.


8.更改所有者(很多學習者容易忽略的地方,請注意)

#cd /var/named

#chown named:named  huanjie.com.hosts

#chown named:named  huanjie.com.rev


9.啟動DNS服務

#service  named restart


10.更改dns伺服器IP為本地

#vi /etc/resolv.conf

servername=192.168.186.188


11.測試是否成功

#nslookup   server2.huanjie.com

#nslookup   192.168.186.188


注意事項:

1.named-checkconf   設定檔路徑     -------檢測設定檔是否有語法錯誤 

  如:named-checkconf   /var/named/chroot/named.conf

2.named-checkzone   網域名稱  地區檔案路徑    -------檢測地區文見是否有語法錯誤

  如:named-checkzone    huanjie.com   /var/named/chroot/named.conf

3.如果重啟速度慢,則可以使用rndc reload 快速載入


本文出自 “抹紅塵終成傷” 部落格,請務必保留此出處http://weihuanjie.blog.51cto.com/3709233/1433479

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.