小知识,大挑战!本文正在参与“程序员必备小知识”创作活动。
1. 配置文件
域名相关的两个配置文件
linux
/etc/hosts
: ip -> 域名/etc/resolv.conf
: 设置dns服务器ip地址/etc/host.conf
: 制定域名解析顺序(本地hosts文件,dns解析)
win
C:\Windows\System32\drivers\etc\hosts
: ip -> 域名- dns: 控制面板 -> 网络和共享中心 -> 以太网 -> 属性 -> ipv4 -> dns
2. DNS查询指令
常见的几个dns命令,如 host, nslookup, dig
2.1 host
host hhui.top
2.2 nslookup
nslookup hhui.top
# 输出
Server: UnKnown
Address: 10.224.10.8
Non-authoritative answer:
Name: hhui.top
Address: 47.98.136.120
2.3 dig
dig hhui.top
# 输出
; <<>> DiG 9.16.1-Ubuntu <<>> hhui.top
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45125
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: af1e8f58654ca181f69cb19c604f432998ce632d2be17ed5 (good)
;; QUESTION SECTION:
;hhui.top. IN A
;; ANSWER SECTION:
hhui.top. 503 IN A 47.98.136.120
;; Query time: 0 msec
;; SERVER: 10.224.10.8#53(10.224.10.8)
;; WHEN: Mon Mar 15 19:21:13 CST 2021
;; MSG SIZE rcvd: 81
II. 其他
1. 一灰灰Blog: liuyueyi.github.io/hexblog
一灰灰的个人博客,记录所有学习和工作中的博文,欢迎大家前去逛逛
2. 声明
尽信书则不如,以上内容,纯属一家之言,因个人能力有限,难免有疏漏和错误之处,如发现bug或者有更好的建议,欢迎批评指正,不吝感激
- 微博地址: 小灰灰Blog
- QQ: 一灰灰/3302797840