dig、host、nslookup
dig命令
di [-t RR_TYPE] name [@SERVER] [query options] #正向解析
用于测试dns系统,因此其不会查询hosts文件
[query options]:
+[no]trace:跟踪解析过程
+[no]recurse:进行递归解析
dig -x IP [@SERVER] #反向解析
模拟完全区域传送:
dig -t axfr DOMAIN [@server]
示例:
dig -t A www.hello.cn @192.168.181.131
dig -x 191.168.181.131
dig -t A www.hello.cn +trace
dig -t axfr magedu.com @172.16.100.67
host命令:
host [-t RR_TYPE] name SERVER_IP
[root@localhost named]# host -t A www.hello.cn
www.hello.cn has address 192.168.181.131
[root@localhost named]# host -t A 192.168.181.131
131.181.168.192.in-addr.arpa domain name pointer mail.hello.cn.
131.181.168.192.in-addr.arpa domain name pointer ns.hello.cn.
131.181.168.192.in-addr.arpa domain name pointer www.hello.cn.
[root@localhost named]# host -t A 192.168.181.131 192.168.181.131
Using domain server:
Name: 192.168.181.131
Address: 192.168.181.131#53
Aliases:
131.181.168.192.in-addr.arpa domain name pointer www.hello.cn.
131.181.168.192.in-addr.arpa domain name pointer mail.hello.cn.
131.181.168.192.in-addr.arpa domain name pointer ns.hello.cn.
nslookup命令:
nslookup [-options] [name] [server]
交互式模式
nslookup>
server IP:以指定的ip为dns服务器进行查询;
set q=RR_TYPE:要查询的资源记录类型;
name:要查询的名称
示例:
[root@localhost named]# nslookup
-->> server
Default server: 127.0.0.1
Address: 127.0.0.1#53
Default server: ::1
Address: ::1#53
->> server 192.168.181.131
Default server: 192.168.181.131
Address: 192.168.181.131#53
->> set q=A
->> www.hello.cn
Server: 192.168.181.131
Address: 192.168.181.131#53
Name: www.hello.cn
Address: 192.168.181.131
->> 192.168.181.131
Server: 192.168.181.131
Address: 192.168.181.131#53
131.181.168.192.in-addr.arpa name = www.hello.cn.
131.181.168.192.in-addr.arpa name = ns.hello.cn.
131.181.168.192.in-addr.arpa name = mail.hello.cn.
->>
rndc命令:named服务控制命令
rndc status
rndc reload 与systemctl reload named 作用一致