说明
host命令用于查询DNS的工具,他可以将指定的主机名转换为IP地址
格式
host [option]
常用参数
- -a:显示详细的DNS信息
- -t:指定查询的域名信息类型,可以是“A”,“ALL”,“MX”,“NS”等
示例
1、DNS查询
[root@localhost ~]# host www.hi917.com
www.hi917.com has address 39.108.78.191
2、查询详细信息
[root@localhost ~]# host -a www.hi917.com
Trying "www.hi917.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10227
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.hi917.com. IN ANY
;; ANSWER SECTION:
www.hi917.com. 5 IN A 39.108.78.191
Received 47 bytes from 192.168.71.2#53 in 49 ms
3、按照类型进行查询
[root@localhost ~]# host -t MX hi917.com
hi917.com mail is handled by 10 mxbiz2.qq.com.
hi917.com mail is handled by 10 mxbiz1.qq.com.