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