- 論壇徽章:
- 0
|
舉凡是看到的資料都是這么說的...
假如client需要知道某個(gè)域名的ip的時(shí)候,首先會查自己的dns cache,如果cache里有,那么就不需要去查詢所規(guī)定的dns服務(wù)器,而且在查到該域名對應(yīng)的ip之后,會馬上存到自己的dns cache里...
我不知道nslookup這個(gè)工具是不是會一定會查詢,還是跟IE一樣的要先查cache...,也許是我對nslookup的理解有問題...
我做了個(gè)實(shí)驗(yàn)...這里舉例說明:
目標(biāo): 查詢www.chinaunix.net的ip
平臺: windows2000
工具: nslookup,windump
注意:在進(jìn)行實(shí)驗(yàn)前,先ipconfig/flushdns已經(jīng)清掉了本地的dns cache
1 首先開一個(gè)cmd窗口,然后用windump listen udp53端口的數(shù)據(jù)(因是交換式網(wǎng)絡(luò),只能listen到自己機(jī)器接口上的dns query/answer)
2 再開一個(gè)cmd窗口,然后用nslookup
- C:\Documents and Settings\Administrator>;nslookup
- Default Server: ns1.cn-railway.net
- Address: 211.98.4.1
- >; www.chinaunix.net
- Server: ns1.cn-railway.net
- Address: 211.98.4.1
- Non-authoritative answer:
- Name: www.chinaunix.net
- Address: 61.135.136.122
- >; www.chinaunix.net
- Server: ns1.cn-railway.net
- Address: 211.98.4.1
復(fù)制代碼
再看我抓的包:
- C:\Documents and Settings\Administrator>;windump -n udp port 53
- windump: listening on \Device\NPF_{D33AFA9D-A7A8-4B0D-80BE-EF679BCB9BBB}
- 12:27:20.069808 IP 192.168.37.166.2326 >; 211.98.4.1.53: 1+ PTR? 1.4.98.211.in-a
- ddr.arpa. (41)
- 12:27:20.099498 IP 211.98.4.1.53 >; 192.168.37.166.2326: 1* 1/1/1 PTR[|domain] (
- DF)
- 12:27:26.760405 IP 192.168.37.166.2327 >; 211.98.4.1.53: 2+ A? www.chinaunix.net
- . (35)
- 12:27:26.789353 IP 211.98.4.1.53 >; 192.168.37.166.2327: 2 1/2/0 A 61.135.136.12
- 2 (100) (DF)
- 12:27:31.714224 IP 192.168.37.166.2328 >; 211.98.4.1.53: 3+ A? www.chinaunix.net
- . (35)
- 12:27:31.742295 IP 211.98.4.1.53 >; 192.168.37.166.2328: 3 1/2/0 A 61.135.136.12
- 2 (100) (DF)
- 12:27:42.172844 IP 192.168.37.166.2329 >; 211.98.4.1.53: 4+ A? www.chinaunix.net
- . (35)
- 12:27:42.201470 IP 211.98.4.1.53 >; 192.168.37.166.2329: 4 1/2/0 A 61.135.136.12
- 2 (100) (DF)
復(fù)制代碼
可以看到在每次查詢的時(shí)候,都會直接詢問dns服務(wù)器,而沒有查本機(jī)有沒有cache,假如有cache,那么我應(yīng)該在第二次輸入www.chinaunix.net的時(shí)候不會發(fā)出請求給dns server才對,而且,我很快的輸入,所以不存在cache過期的問題...
由此,我推斷,nslookup不會查本機(jī)的dns cache,不知道各位有什么高見,請指點(diǎn),謝謝...主要是我不知道我的這種想法對不對...請指點(diǎn)... |
|