国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Linux 網管 123 --- 第7章. 自訂的組態及管理內容 -2.DNS

2024-07-26 00:30:35
字體:
來源:轉載
供稿:網友

網域名稱伺服器 (DNS) 組態及管理
在我工作的很多地方,我們使用 linux 作為 DNS 伺服器。它表現的非常好。這一節將會指出使用 Red Hat
 發行版內含的標準 BIND 8.x 套件所提供這些服務的 DNS table 組態 
   注意: Red Hat 5.1 及更早的版本使用 BIND 4.x 套件,它的組態檔格式有一點點不同。 BIND 8.x 比 
   BIND 4.x 提供更多的功能,而且 4.x 已經不再發展了, 您可能需要考慮升級到最新版的 BIND 套件。
   先安裝 BIND RPM 套件 (查看 第10章,使用 Red Hat 套件管理程式 (RPM) 一節 有關使用 RPM 公用程式
   的細節),然後轉換您的組態成新的格式。 
幸運地,轉換原有的 BIND 4.x 組態檔以符合 BIND 8.x 很簡單 ! 就像是 BIND 位於文件檔的目錄下的一部份
 (例如, ``/usr/doc/bind-8.1.2/'' 相對於 BIND version 8.1.2),有一個檔叫做 ``named-bootconf.pl'' ,
 這是一個可執行的 Perl 程式。 假設您已經在系統上安裝好 Perl,您可以利用這個程式轉換您的組態檔。鍵入
 下列指令完成它 (以 root 身分): 
  cd /usr/doc/bind-8.1.2
./named-bootconf.pl < /etc/named.boot > /etc/named.conf
mv /etc/named.boot /etc/named.boot-obsolete
 


您現在應該會得到一個可以在 BIND 8.x 下使用的檔案 ``/etc/named.conf'' 。 原有的 DNS table 在新版的
BIND 下也可以使用, 因為 table 的格式還是一樣。
 

在 Linux 下組態 DNS 服務與下列步驟有關: 
要起始 DNS 服務, ``/etc/host.conf''這個檔案看起來應該像下面著個樣子: 
  # Lookup names via /etc/hosts first, then by DNS query
order hosts, bind
# We don't have machines with multiple addresses
multi on
# Check for IP address spoofing
nospoof on
# Warn us if someone attempts to spoof
alert on
 

加大的  spoof 偵測可以增加一點 DNS 搜尋的命中率(管可以忽略),所以如果您不擔心這個的話可以 
disable “nospool”及“alert” 項目。 

依需要編輯 ``/etc/hosts'' 檔。一般在這里不必改太多, 但為了增加效率可以增加您最常存取的主機 
(像是本地伺服器) 以避免過度使用 DNS 搜尋在他們身上。 

 ``/etc/named.conf'' 檔應該根據下面例組態指出 DNS table 

   (注意:下面的 IP 位址只是例,必須根據您自己的 class 位址更改!): 

options {
        // DNS tables are located in the /var/named directory
        directory "/var/named";

        // Forward any unresolved requests to our ISP's name server
        // (this is an example IP address only -- do not use!)
        forwarders {
                123.12.40.17;
        };

        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  PRevious versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
        // query-source address * port 53;
};

// Enable caching and load root server info
zone "named.root" {
        type hint;
        file "";
};

// All our DNS information is stored in /var/named/mydomain_name.db
// (eg. if mydomain.name = foobar.com then use foobar_com.db)
zone "mydomain.name" {
        type master;
        file "mydomain_name.db";
        allow-transfer { 123.12.41.40; };
};

// Reverse lookups for 123.12.41.*, .42.*, .43.*, .44.* class C's
// (these are example Class C's only -- do not use!)
zone "12.123.IN-ADDR.ARPA" {
        type master;
        file "123_12.rev";
        allow-transfer { 123.12.41.40; };
};

// Reverse lookups for 126.27.18.*, .19.*, .20.* class C's
// (these are example Class C's only -- do not use!)
zone "27.126.IN-ADDR.ARPA" {
        type master;
        file "126_27.rev";
        allow-transfer { 123.12.41.40; };
};
 

   小技巧: 注意上面的 allow-transfer 選項,它限制 DNS對於特定 IP 位址的 zone transfer。 舉例來說, 
   我們允許位於123.12.41.40 的主機(可能是我們網域上的一個次要 DNS伺服器)請求 zone transfer。如果您
   漏了這個選項,位於 Internet 的任何人都可以請求這個轉換。因為這些資訊常被存心不良的人運用,我強
   烈建議您除了到次要 DNS伺服器以外都限制 zone transfer,或使用 loopback address, ``127.0.0.1''作為替代。 

現在您可以像在第三步驟組態``/etc/named.conf''檔一樣,設定位於 ``var/named/'' 目錄的  DNS table 。
第一次組態 DNS 資料庫檔是個大工程,并且超出本文討論圍。有一些線上及印刷品型式的指南應該參考。然而下
面有提供 一些例。 
位於 ``/var/named/mydomain_name.db'' 正向查詢檔的例列: 
  ; This is the Start of Authority (SOA) record.  Contains contact
; & other information about the name server.  The serial number
; must be changed whenever the file is updated (to inform secondary
; servers that zone information has changed).
    @ IN SOA mydomain.name.  postmaster.mydomain.name. (
        19990811        ; Serial number
        3600            ; 1 hour refresh
        300             ; 5 minutes retry
        172800          ; 2 days expiry
        43200 )         ; 12 hours minimum

; List the name servers in use.  Unresolved (entries in other zones)
; will go to our ISP's name server isp.domain.name.com
        IN NS           mydomain.name.
        IN NS           isp.domain.name.com.

; This is the mail-exchanger.  You can list more than one (if
; applicable), with the integer field indicating priority (lowest
; being a higher priority)
        IN MX           mail.mydomain.name.

; Provides optional information on the machine type & Operating system
; used for the server
        IN HINFO        Pentium/350     LINUX

; A list of machine names & addresses
    spock.mydomain.name.    IN A    123.12.41.40   ; OpenVMS Alpha
    mail.mydomain.name.     IN A    123.12.41.41   ; Linux (main server)
    kirk.mydomain.name.     IN A    123.12.41.42   ; Windows NT (blech!)

; Including any in our other class C's
    twixel.mydomain.name.   IN A    126.27.18.161  ; Linux test machine
    foxone.mydomain.name.   IN A    126.27.18.162  ; Linux devel. kernel

; Alias (canonical) names
    gopher      IN CNAME        mail.mydomain.name.
    ftp         IN CNAME        mail.mydomain.name.
    www         IN CNAME        mail.mydomain.name.
 


位於 ``/var/named/123_12.rev'' 反向查詢檔的例列: 
  ; This is the Start of Authority record.  Same as in forward lookup table.
    @ IN SOA mydomain.name.  postmaster.mydomain.name. (
        19990811        ; Serial number
        3600            ; 1 hour refresh
        300             ; 5 minutes retry
        172800          ; 2 days expiry
        43200 )         ; 12 hours minimum

; Name servers listed as in forward lookup table
        IN NS           mail.mydomain.name.
        IN NS           isp.domain.name.com.

; A list of machine names & addresses, in reverse.  We are mapping
; more than one class C here, so we need to list the class B portion
; as well.
    40.41       IN PTR    spock.mydomain.name.
    41.41       IN PTR    mail.mydomain.name.
    42.41       IN PTR    kirk.mydomain.name.

; As you can see, we can map our other class C's as long as they are
; under the 123.12.* class B addresses
    24.42       IN PTR    tsingtao.mydomain.name.
    250.42      IN PTR    redstripe.mydomain.name.
    24.43       IN PTR    kirin.mydomain.name.
    66.44       IN PTR    sapporo.mydomain.name.

; No alias (canonical) names should be listed in the reverse lookup
; file (for obvious reasons).
 


任何其他的 reverse 搜尋檔需要 map 位址,在不同的 class B (像是 126.27.*) 會被建立,并且會和上面
的反向查詢檔更相似。 

確定 named daemon 正在執行。這個 daemon 通常在系統開機時由``/etc/rc.d/init.d/named'' 這個檔案啟動。 
您也可以手動地啟動及停止這個 daemon ; 分別是鍵入 ``named start'' 及 ``named stop''。 

無論對 DNS table 做了什麼改變,應該鍵入 ``/etc/rc.d/init.d/named restart''重新啟動 DNS 伺服器。
您可以使用像是“nslookup”的工具去詢問機器以測試您所做的變更。更多有關如何組態 DNS 服務的資料可以
在位於 http://metalab.unc.edu/Linux/HOWTO/DNS-HOWTO-5.html的 ``DNS-HOWTO'' 指南上找到

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 崇州市| 磐安县| 宜兰县| 黄山市| 晋州市| 卢湾区| 肃北| 青海省| 芒康县| 湘阴县| 福鼎市| 巴青县| 安平县| 平定县| 上蔡县| 蓬莱市| 兴隆县| 阿拉善右旗| 缙云县| 井陉县| 玉环县| 福贡县| 哈密市| 岢岚县| 丰顺县| 丰原市| 合水县| 巴林左旗| 桐梓县| 疏勒县| 库车县| 岐山县| 平远县| 稷山县| 麟游县| 陈巴尔虎旗| 客服| 安福县| 梅州市| 平安县| 洛阳市|