1. 程式人生 > >dig指定伺服器查詢域名解析時間

dig指定伺服器查詢域名解析時間

time=$(dig @8.8.8.8 baidu.com | grep Query | awk '{print $4}')
echo $time 

一 nslookup指定伺服器查詢域名解析時間

[email protected]:/data# dig @114.114.114.114 www.baidu.com

; <<>> DiG 9.9.2-P2 <<>> @114.114.114.114 www.baidu.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21147
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.baidu.com. IN A

;; ANSWER SECTION:
www.baidu.com. 562 IN CNAME www.a.shifen.com.
www.a.shifen.com. 34 IN A 61.135.169.121
www.a.shifen.com. 34 IN A 61.135.169.125

;; Query time: 14 msec ---- 毫秒
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Fri Dec 28 14:52:58 2018
;; MSG SIZE rcvd: 101

二 nslookup指定伺服器查詢域名解析時間

[email protected]:/data# time nslookup baidu.com 114.114.114.114
Server: 114.114.114.114
Address 1: 114.114.114.114

Name: baidu.com
Address 1: 220.181.57.216
Address 2: 123.125.115.110
real 0m 0.03s
user 0m 0.00s
sys 0m 0.00s

 

參考:

https://it.toolbox.com/question/response-time-for-nslookup-061610

google nslookup show query time