当前位置:网站首页>请求DNS查找的host命令示例
请求DNS查找的host命令示例
2022-08-06 03:23:00 【yuyuyuliang00】
host命令是一个用于执行域名到IP地址转换的DNS查找的命令行工具。它页可以用于列出和验证各种类型DNS记录,诸如NS和MX,测试和验证ISP DNS服务器和互联网连接性,垃圾邮寄和将记录列入黑名单,探测和排错DNS服务器问题等。
我们将在这里用一些有用示例学习如何在Linux中使用host命令执行DNS查找。
以下描述了13个host命令的示例。
这是你能够运行的最简单的host命令,只要提供一个诸如baidu.com的域名来获取相关联的IP地址。
[[email protected] ~]$ host baidu.com
baidu.com has address 39.156.66.10
baidu.com has address 110.242.68.66
baidu.com mail is handled by 15 mx.n.shifen.com.
baidu.com mail is handled by 20 usmx01.baidu.com.
baidu.com mail is handled by 20 jpmx.baidu.com.
baidu.com mail is handled by 20 mx50.baidu.com.
baidu.com mail is handled by 10 mx.maillb.baidu.com.
baidu.com mail is handled by 20 mx1.baidu.com.查找域名服务器
使用-t选项查找域名服务器
[[email protected] ~]$ host -t ns baidu.com
baidu.com name server ns3.baidu.com.
baidu.com name server ns2.baidu.com.
baidu.com name server ns4.baidu.com.
baidu.com name server dns.baidu.com.
baidu.com name server ns7.baidu.com.查找域CNAME记录
要查找域CNAME,运行。
[[email protected] ~]$ host -t cname mail.baidu.com
mail.baidu.com is an alias for mail.maillb.baidu.com.查找域MX记录
为一个域查找MX记录
[[email protected] ~]$ host -n -t mx baidu.com
baidu.com mail is handled by 20 jpmx.baidu.com.
baidu.com mail is handled by 15 mx.n.shifen.com.
baidu.com mail is handled by 10 mx.maillb.baidu.com.
baidu.com mail is handled by 20 mx1.baidu.com.
baidu.com mail is handled by 20 usmx01.baidu.com.
baidu.com mail is handled by 20 mx50.baidu.com.查找域TXT记录
为一个域查找TXT记录
[[email protected] ~]$ host -t txt baidu.com
baidu.com descriptive text "v=spf1 include:spf1.baidu.com include:spf2.baidu.com include:spf3.baidu.com include:spf4.baidu.com a mx ptr -all"
baidu.com descriptive text "google-site-verification=GHb98-6msqyx_qqjGl5eRatD3QTHyVB6-xQ3gJB5UwM"
baidu.com descriptive text "_globalsign-domain-verification=qjb28W2jJSrWj04NHpB0CvgK9tle5JkOq-EcyWBgnE"查找域SOA记录
使用-C标记从对应那个区的所有列出的权威名称服务器,你可以使得host尝试显示指定区的SOA记录。
[[email protected] ~]$ host -C baidu.com
Nameserver 112.80.248.64:
baidu.com has SOA record dns.baidu.com. sa.baidu.com. 2012145588 300 300 2592000 7200
Nameserver 110.242.68.134:
baidu.com has SOA record dns.baidu.com. sa.baidu.com. 2012145588 300 300 2592000 7200
Nameserver 220.181.33.31:
baidu.com has SOA record dns.baidu.com. sa.baidu.com. 2012145588 300 300 2592000 7200
Nameserver 180.76.76.92:
baidu.com has SOA record dns.baidu.com. sa.baidu.com. 2012145588 300 300 2592000 7200
Nameserver 14.215.178.80:
baidu.com has SOA record dns.baidu.com. sa.baidu.com. 2012145588 300 300 2592000 7200查询特定名称服务器
要查询特定的域名服务器
[[email protected] ~]$ host baidu.com ns2.baidu.com
Using domain server:
Name: ns2.baidu.com
Address: 220.181.33.31#53
Aliases:
baidu.com has address 110.242.68.66
baidu.com has address 39.156.66.10
baidu.com mail is handled by 10 mx.maillb.baidu.com.
baidu.com mail is handled by 15 mx.n.shifen.com.
baidu.com mail is handled by 20 mx1.baidu.com.
baidu.com mail is handled by 20 jpmx.baidu.com.
baidu.com mail is handled by 20 mx50.baidu.com.
baidu.com mail is handled by 20 usmx01.baidu.com.查找域记录和区的所有信息
要查询类型ANY,使用-a选项,其等价于设置了-v选项。
[[email protected] ~]$ host -a baidu.com
Trying "baidu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14087
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;baidu.com. IN ANY
;; ANSWER SECTION:
baidu.com. 3600 IN HINFO "RFC8482" ""
Received 48 bytes from 100.100.2.136#53 in 0 ms获取域TTL信息
查找域TTL信息
[[email protected] ~]$ host -v -t a baidu.com
Trying "baidu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42180
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;baidu.com. IN A
;; ANSWER SECTION:
baidu.com. 510 IN A 110.242.68.66
baidu.com. 510 IN A 39.156.66.10
Received 59 bytes from 100.100.2.136#53 in 0 ms使用IPv4或IPv6
-4或-6选项使得host各自只使用IPv4或IPv6查询传输。
[[email protected] ~]$ host -4 baidu.com
baidu.com has address 39.156.66.10
baidu.com has address 110.242.68.66
baidu.com mail is handled by 20 mx50.baidu.com.
baidu.com mail is handled by 10 mx.maillb.baidu.com.
baidu.com mail is handled by 20 mx1.baidu.com.
baidu.com mail is handled by 15 mx.n.shifen.com.
baidu.com mail is handled by 20 jpmx.baidu.com.
baidu.com mail is handled by 20 usmx01.baidu.com.
[[email protected] ~]$ host -6 baidu.com
;; connection timed out; no servers could be reached为查询设置UDP重试次数
默认,UDP尝试次数是1,要更改它,使用-R标记。
[[email protected] ~]$ host -R 5 baidu.com
baidu.com has address 110.242.68.66
baidu.com has address 39.156.66.10
baidu.com mail is handled by 20 jpmx.baidu.com.
baidu.com mail is handled by 20 usmx01.baidu.com.
baidu.com mail is handled by 10 mx.maillb.baidu.com.
baidu.com mail is handled by 20 mx1.baidu.com.
baidu.com mail is handled by 15 mx.n.shifen.com.
baidu.com mail is handled by 20 mx50.baidu.com.设置查询的等待响应时间
使用-W选项,你可以设置host等待一个响应指定时间并且如果使用了-w标记,它使得host一直等待一个响应:
[[email protected] ~]$ host -T -W 10 baidu.com
baidu.com has address 39.156.66.10
baidu.com has address 110.242.68.66
baidu.com mail is handled by 20 mx50.baidu.com.
baidu.com mail is handled by 20 usmx01.baidu.com.
baidu.com mail is handled by 20 mx1.baidu.com.
baidu.com mail is handled by 10 mx.maillb.baidu.com.
baidu.com mail is handled by 20 jpmx.baidu.com.
baidu.com mail is handled by 15 mx.n.shifen.com.边栏推荐
猜你喜欢
随机推荐
pytest之assert断言的使用
2022 Alibaba Cloud server configuration selection strategy
The delivery language set in the Google Ads background, if English is set, does it mean that the user is using English?
leetcode 15. 三数之和
firewall 和ufw 笔记
Find the Nth node of the linked list
3D激光SLAM:LIO-SAM整体介绍与安装编译
Harbor offline synchronization
2022 使用Go语言构建现代 Web 应用程序实战内容课程
Failed to save image in R language ggplot2 loop
greenDAO of Android database framework
面试官:同学,冒泡太简单了,要不手写一个【快速排序】吧...
通行宝通过注册:年营收5.9亿拟募资5.6亿 腾讯云与上汽是股东
leetcode:1374. 生成每种字符都是奇数个的字符串
KGAT recommendation system
谷歌分析中的转化目标设置后,大概多久能显示在Google adwords后台?
网络安全辅助工具:免费MD5解密网站
预处理(C语言深度了解)
智能合约安全——随机数
sql server, two tables, the same field, the same amount of data (50 million), execute the same query, one table executes an index scan, scanning 50 million, which takes 2 minutes, the other table exec








