ping和host,dig,nslookup是两种不同类型的处理DNS的方式
Trouble-shooting case
ping,首先会查询本地的/etc/hosts文件,然后才会查询DNS服务器,这样做有啥好处?效率高。
host,dig,nslookup三个命令是一样的,不会查询本地的/etc/hosts文件,如果查询DNS服务器没有结果,那么直接返回无结果,此时,即使本地有配置/etc/hosts文件也是没有用的。
dig 显示域名的高级数据(功能强大,操作简洁)
#dig 163.com
#dig 163.com -t MX(查询163的邮件服务器)
host 查询主机使用的域名(简单易用,输出简洁)
#host 163.com
#host -t MX 163.com
nslookup 查询域名与地址的对应(LINUX/UNIX平台可用dig命令代替)
#nslookup
>set type=mx
>163.com
>exit
Trouble-shooting case
while true; do curl -s -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} Size: %{size_download} \n" -H 'Host: www.decathlon.fr' <http://www.decathlon.fr'> http://cnprfront.epay-net.org;done
dns: %{time_namelookup}
while true; do curl -s -o /dev/null -w "Connect: %{time_connect} DNS: %{time_namelookup} TTFB: %{time_starttransfer} Total time: %{time_total} Size: %{size_download} \n" -H 'Host:
www.cnprfront.epay-net.org' <
http://www.cnprfront.epay-net.org'>
http://cnprfront.epay-net.org;done
Long respond time from CUBE API to Epay
fzou@cnpradm01:~$ while true; do curl -s -o /dev/null -w "Connect: %{time_connect} DNS: %{time_namelookup} TTFB: %{time_starttransfer} Total time: %{time_total} Size: %{size_download} \n" -H 'Host:
cnprfront.epay-net.org'
http://cnprfront.epay-net.org;done Connect: 0.008 DNS: 0.006 TTFB: 0.011 Total time: 0.011 Size: 426
Connect: 0.002 DNS: 0.002 TTFB: 0.004 Total time: 0.004 Size: 426
Connect: 0.003 DNS: 0.002 TTFB: 0.008 Total time: 0.008 Size: 426
Connect: 5.005 DNS: 5.005 TTFB: 5.010 Total time: 5.010 Size: 426
Connect: 0.003 DNS: 0.002 TTFB: 0.006 Total time: 0.006 Size: 426
Connect: 0.002 DNS: 0.002 TTFB: 0.004 Total time: 0.004 Size: 426
Connect: 0.003 DNS: 0.002 TTFB: 0.008 Total time: 0.008 Size: 426
Connect: 5.005 DNS: 5.005 TTFB: 5.010 Total time: 5.010 Size: 426
Connect: 0.003 DNS: 0.002 TTFB: 0.006 Total time: 0.006 Size: 426
Connect: 0.002 DNS: 0.002 TTFB: 0.004 Total time: 0.004 Size: 426
Connect: 0.003 DNS: 0.002 TTFB: 0.008 Total time: 0.008 Size: 426
Connect: 5.005 DNS: 5.005 TTFB: 5.009 Total time: 5.009 Size: 426
Connect: 0.004 DNS: 0.002 TTFB: 0.006 Total time: 0.006 Size: 426
Connect: 0.002 DNS: 0.002 TTFB: 0.004 Total time: 0.004 Size: 426
Connect: 0.003 DNS: 0.002 TTFB: 0.008 Total time: 0.008 Size: 426
Connect: 5.005 DNS: 5.005 TTFB: 5.009 Total time: 5.009 Size: 426
Connect: 0.004 DNS: 0.002 TTFB: 0.007 Total time: 0.007 Size: 426
Connect: 0.002 DNS: 0.002 TTFB: 0.004 Total time: 0.004 Size: 426
Connect: 0.003 DNS: 0.002 TTFB: 0.008 Total time: 0.008 Size: 426
\ntimelookup: %{time_namelookup}\ntime_connect: %{time_connect}\ntime_appconnect: %{time_appconnect}\ntime_pretransfer: %{time_pretransfer}\ntime_redirect: %{time_redirect}\ntime_starttransfer: %{time_starttransfer}\n----------\ntime_total: %{time_total}\n\n
curl " http://cnprfront.epay-net.org/easypay-server-mvc/api/payments?clientName=CUBECN&orderAmount=0.0&channelType=WEB&oneClick=-1&privateCustomer=-1&professionalCustomer=-1&forLoyaltyCustomer=-1&forNotLoyaltyCustomer=-1?ularDelivery=-1&paymentOnDelivery=-1" -H "Pragma: no-cache" -H "Accept-Encoding: gzip, deflate, sdch" -H "Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Cache-Control: no-cache" -H "Cookie: JSESSIONID=89ED8D62D30A1CEA8BCEED04E8B074AF.frt004" -H "Connection: keep-alive" --compressed -IL -w "@curl_display.txt"
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26477398/viewspace-2125409/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26477398/viewspace-2125409/