2017-06-15 29 views
0

我已經使用c代碼緩存了從dig命令收到的響應,並且我想使用權限列表直接調用以查找ip,避免了dns查找的一部分,但我不知道如何執行此操作。如何調用權威服務器的ip響應?

;; AUTHORITY SECTION: 
gogole.com.  172748 IN NS ns2.google.com. 
gogole.com.  172748 IN NS ns3.google.com. 
gogole.com.  172748 IN NS ns1.google.com. 
gogole.com.  172748 IN NS ns4.google.com. 

;; ADDITIONAL SECTION: 
ns2.google.com.  104506 IN A 216.239.34.10 
ns1.google.com.  345589 IN A 216.239.32.10 
ns3.google.com.  104506 IN A 216.239.36.10 
ns4.google.com.  104506 IN A 216.239.38.10 

例如,這是爲谷歌,我想詢問ns1.google.com下次有IP。誰能幫我 ?謝謝。

回答

0

Linux的命令的語法在它的手冊頁

man dig 

這會告訴你:

A typical invocation of dig looks like: 

    dig @server name type 

where: 

server 
    is the name or IP address of the name server to query. 
    This can be an IPv4 address in dotted-decimal notation 
    or an IPv6 address in colon-delimited notation (...) 

所以,一旦你的權威名稱服務器的名稱或IP地址,您需要查詢,例如ns1.google.com如您的示例所示,您只需將@ns1.google.com添加到您的dig命令行即可獲得該服務器的響應。

舉例來說,像這樣的:

dig @ns1.google.com google.com A 

這是有用的檢查TTL由該DNS記錄區的所有者設置,並解決DNS緩存出現了問題。

相關問題