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
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26477398/viewspace-2122425/ ,如需转载,请注明出处,否则将追究法律责任。