歡迎您光臨本站 註冊首頁

DNS伺服器轉發查詢問題

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

DNS伺服器轉發查詢問題

單位內部做了個dns伺服器,把單位的網站解析成內部IP地址,外部域名則轉發給電信的dns,但是現在發現轉發查詢有些問題。

以前這個dns是win 2003 server,工作正常,可以轉發,區域網內的電腦設置一個內部dns即可,現在該伺服器硬碟掛了,換了一台伺服器為ubuntu 系統,這是有關配置文件

lsg@dhcp:/etc/bind$ less named.conf.local


include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers

zone "." {
        type hint;
        file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
        type master;
        file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
        type master;
        file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
        type master;
        file "/etc/bind/db.255";
};
zone "ictedu.net.cn" {
        type master;
        file "/etc/bind/db.ictedu.net.cn";
        };


include "/etc/bind/named.conf.local";
named.conf (END)




lsg@dhcp:/etc/bind$ less named.conf.options

options {
        directory "/var/cache/bind";

        // 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 and later use an unprivileged
        // port by default.

        // query-source address * port 53;

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

        forwarders {
                61.177.7.1;
         };

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
};


現在如果只設置一個內部dns,則外部域名無法解析,該dns伺服器沒有把查詢轉發出去。可是該dns伺服器也只設置它本身為dns,卻可以轉發查詢,奇怪。什麼原因?如何解決?

lsg@dhcp:/etc/bind$ cat /etc/resolv.conf
nameserver 192.168.100.100
lsg@dhcp:/etc/bind$ nslookup
> sohu.com
Server:         192.168.100.100
Address:        192.168.100.100#53

Non-authoritative answer:
Name:   sohu.com
Address: 61.135.181.175
Name:   sohu.com
Address: 61.135.181.176
> exit

lsg@dhcp:/etc/bind$
《解決方案》

設置BIND為允許遞歸查詢:

recursion yes ;
allow-recursion {any;};

同時建議把這個轉發刪除:

forwarders {
      61.177.7.1;
      };

[ 本帖最後由 llzqq 於 2009-5-11 15:10 編輯 ]
《解決方案》

原帖由 llzqq 於 2009-5-11 15:08 發表 http://bbs2.chinaunix.net/images/common/back.gif
設置BIND為允許遞歸查詢:

recursion yes ;
allow-recursion {any;};

同時建議把這個轉發刪除:

forwarders {
      61.177.7.1;
      };

刪除了轉發,dns伺服器如何查詢不知道的域名?如何自動找其他的dns伺服器?
《解決方案》

關注!!

我也有同樣類似的問題,就是想讓一部分域名通過轉發解析,另一部分域名通過遞歸解析

而我現在情況是想讓DNS伺服器只對academy.oracle.com通過電信的DNS伺服器202.96.128.86進行轉發。

我原來的ZONE文件是abc.gov.cn,現在需要怎麼做才能實現這個功能?

只是在ZONE文件abc.gov.cn裡面加上下面的語句可以實現嗎?謝謝!

@ORIGIN abc.gov.cn
www IN A ***.***.***.***
// 以下為增加的語句
@
academy.oracle.com IN A 202.96.128.86

另外如果我想將academy.oracle.com作為一個域進行轉發,應該怎麼設置?能否詳細說明一下,謝謝!

[ 本帖最後由 sapo2000 於 2009-5-11 16:49 編輯 ]
《解決方案》

打開遞歸查詢后,DNS會自己去找域名的權威DNS,並從上面查詢域名解析,公網DNS都是這種模式。

不建議使用轉發,因為轉發模式依賴於forwarders,forwarders出問題就不能用了(或者forwarders限制了查詢頻率也會有問題)。
《解決方案》

原帖由 llzqq 於 2009-5-11 18:35 發表 http://bbs2.chinaunix.net/images/common/back.gif
打開遞歸查詢后,DNS會自己去找域名的權威DNS,並從上面查詢域名解析,公網DNS都是這種模式。

不建議使用轉發,因為轉發模式依賴於forwarders,forwarders出問題就不能用了(或者forwarders限制了查詢頻率也 ...

轉發查詢都是利用的本地dns,是否速度方面會快一些?

遞歸的是如何查找默認的權威dns的?應該也設置了吧,是否可以把本地電信的dns加進去?
《解決方案》

原帖由 arbor 於 2009-5-12 11:19 發表 http://bbs2.chinaunix.net/images/common/back.gif


轉發查詢都是利用的本地dns,是否速度方面會快一些?

遞歸的是如何查找默認的權威dns的?應該也設置了吧,是否可以把本地電信的dns加進去?

解析結果會緩存在本地DNS上,所有速度並不是問題。

打開遞歸查詢后,當查詢www.abc.com時,解析過程可簡化為:

1.接到查詢www.abc.com後會向根域DNS(「.」)伺服器發送誰是com.的權威DNS
2.向com.的權威DNS請求誰是abc.com.的權威DNS
3.向abc.com.的權威DNS解析www.abc.com的結果
4.緩存www.abc.com的解析結果。
《解決方案》

原帖由 llzqq 於 2009-5-11 15:08 發表 http://bbs2.chinaunix.net/images/common/back.gif
設置BIND為允許遞歸查詢:

recursion yes ;
allow-recursion {any;};

同時建議把這個轉發刪除:

forwarders {
      61.177.7.1;
      };

多謝!設置遞歸成功,問題只能算解決了80%,因為轉發為什麼不成功還沒有解決,奇怪,沒有看出來轉發設置哪裡有錯啊
《解決方案》

如果你指定本地的一個或多個伺服器作為轉發器,那麼你的名字伺服器將會把所有的發往外部的查詢都先送往轉發器,這就意味著由轉發器來處理所有本地產生的發往外部的查詢。

轉發的時候,這個伺服器發送的是遞歸查詢,而在非轉髮狀態下,它發送的都是非遞歸的查詢。大部分公網的域名伺服器應該都是不響應遞歸查詢的。

可以嘗試使用nslookup的debug選項來看看問題到底出在哪裡:

nslookup
> set debug
> www.bsdplus.cn
伺服器:  cns-nh.online.sh.cn
Address:  124.74.213.68

------------
Got answer:
    HEADER:
        opcode = QUERY, id = 2, rcode = NOERROR
        header flags:  response, want recursion, recursion avail.
        questions = 1,  answers = 1,  authority records = 5,  additional = 0

    QUESTIONS:
        www.bsdplus.cn, type = A, class = IN
    ANSWERS:
    ->  www.bsdplus.cn
        internet address = 209.190.24.3
        ttl = 86400 (1 day)
    AUTHORITY RECORDS:
    ->  bsdplus.cn
        nameserver = ns1.byet.org
        ttl = 86400 (1 day)
    ->  bsdplus.cn
        nameserver = ns2.byet.org
        ttl = 86400 (1 day)
    ->  bsdplus.cn
        nameserver = ns3.byet.org
        ttl = 86400 (1 day)
    ->  bsdplus.cn
        nameserver = ns4.byet.org
        ttl = 86400 (1 day)
    ->  bsdplus.cn
        nameserver = ns5.byet.org
        ttl = 86400 (1 day)

------------
非權威應答:
------------
Got answer:
    HEADER:
        opcode = QUERY, id = 3, rcode = NOERROR
        header flags:  response, want recursion, recursion avail.
        questions = 1,  answers = 0,  authority records = 1,  additional = 0

    QUESTIONS:
        www.bsdplus.cn, type = AAAA, class = IN
    AUTHORITY RECORDS:
    ->  bsdplus.cn
        ttl = 86400 (1 day)
        primary name server = ns1.0fees.net
        responsible mail addr = support.bsdplus.cn
        serial  = 2006112402
        refresh = 28800 (8 hours)
        retry   = 7200 (2 hours)
        expire  = 604800 (7 days)
        default TTL = 86400 (1 day)

------------
名稱:    www.bsdplus.cn
Address:  209.190.24.3

>

[ 本帖最後由 alan0203 於 2009-5-14 13:15 編輯 ]

[火星人 ] DNS伺服器轉發查詢問題已經有609次圍觀

http://coctec.com/docs/service/show-post-22701.html