Linux下使用host、dig、nslookup查询DNS | 您所在的位置:网站首页 › 三亚至南昌机票 › Linux下使用host、dig、nslookup查询DNS |
一、安装软件包dig和nslookup需要安装相关软件包。 Centos:# yum install bind-utilsDebian:# apt-get update# apt-get install dnsutils另外查询前先要在/etc/resolv.conf设置好dns服务器IP。二、使用方法1、host命令host命令是一个简单的DNS查询工具。 一般格式:host 域名host -a 域名 常用选项:-a:相当于"-v -t any"。-t type:指定要查询的记录类型。默认查询A、AAAA、MX记录。-v:详细方式输出。 举例:# host www.163.comwww.163.com is an alias for www.163.com.lxdns.com.www.163.com.lxdns.com is an alias for 163.xdwscache.glb0.lxdns.com.163.xdwscache.glb0.lxdns.com has address 113.107.76.192、dig命令dig命令是一个功能强大的DNS查询命令。 一般格式:dig [@global-server] [domain] [q-type] [q-class] {q-opt} {d-opt} 参数说明:@global-server:默认是以/etc/resolv.conf作为DNS查询的主机,这里可以填入其它DNS主机IP。domain:要查询的域名。q-type:查询记录的类型,例如a、any、mx、ns、soa、hinfo、axfr、txt等,默认查询a。q-class:查询的类别,相当于nslookup中的set class。默认值为in(Internet)。q-opt:查询选项,可以有好几种方式,比如:-f file为通过批处理文件解析多个地址;-p port指定另一个端口(缺省的DNS端口为53),等等。d-opt:dig特有的选项。使用时要在参数前加上一个“+”号。 d-opt常用选项:+vc:使用TCP协议查询。+time=###:设置超时时间。+trace:从根域开始跟踪查询结果。 举例:1) # dig www.163.com ; DiG 9.8.4-rpz2+rl005.12-P1 www.163.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER |
CopyRight 2018-2019 实验室设备网 版权所有 |