背景:
因特殊原因,需要查看centos 7 操作系统,dns缓存列表,百度了一圈,有些说linux默认不会缓存dns信息,有些说要,但是没找到查看的方法,自己做了个实验,验证了centos 7 不会缓存dns信息,每次访问域名都需要向dns服务器请求地址解析

操作步骤:
1、服务器开启tcpdump抓包功能
[root@system1 ~]# tcpdump -i eno16777736 "udp port 53"

2、服务器做ping测试
[root@system1 ~]# ping -I eno16777736 www.zol.com.cn -c 1
PING u955.v.qingcdn.com (114.80.216.198) from 192.168.171.128 eno16777736: 56(84) bytes of data.
64 bytes from 114.80.216.198: icmp_seq=1 ttl=128 time=5.25 ms

--- u955.v.qingcdn.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 5.253/5.253/5.253/0.000 ms
[root@system1 ~]# ping -I eno16777736 www.zol.com.cn -c 1
PING u955.v.qingcdn.com (114.80.216.196) from 192.168.171.128 eno16777736: 56(84) bytes of data.
64 bytes from 114.80.216.196: icmp_seq=1 ttl=128 time=5.69 ms

--- u955.v.qingcdn.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 5.692/5.692/5.692/0.000 ms
[root@system1 ~]#

3、查看抓包信息

10:08:32.647218 IP 192.168.171.128.45330 > public1.114dns.com.domain: 30571+ A? www.zol.com.cn. (32)
10:08:32.657063 IP public1.114dns.com.domain > 192.168.171.128.45330: 30571 8/0/0 CNAME www.zol.com.cn.qingcdn.com., CNAME u955.v.qingcdn.com., A 114.80.216.198, A 114.80.216.196, A 114.80.216.200, A 114.80.216.202, A 114.80.216.197, A 114.80.216.199 (189)
10:08:32.666872 IP 192.168.171.128.41217 > public1.114dns.com.domain: 44536+ PTR? 198.216.80.114.in-addr.arpa. (45)
10:08:32.677666 IP public1.114dns.com.domain > 192.168.171.128.41217: 44536 ServFail 0/0/0 (45)
10:08:32.678625 IP 192.168.171.128.41142 > public1.114dns.com.domain: 44536+ PTR? 198.216.80.114.in-addr.arpa. (45)
10:08:32.689177 IP public1.114dns.com.domain > 192.168.171.128.41142: 44536 ServFail 0/0/0 (45)

10:08:54.464894 IP 192.168.171.128.47843 > public1.114dns.com.domain: 27011+ A? www.zol.com.cn. (32)
10:08:54.477800 IP public1.114dns.com.domain > 192.168.171.128.47843: 27011 8/0/0 CNAME www.zol.com.cn.qingcdn.com., CNAME u955.v.qingcdn.com., A 114.80.216.196, A 114.80.216.200, A 114.80.216.202, A 114.80.216.197, A 114.80.216.199, A 114.80.216.198 (189)
10:08:54.485732 IP 192.168.171.128.55674 > public1.114dns.com.domain: 43348+ PTR? 196.216.80.114.in-addr.arpa. (45)
10:08:54.512428 IP public1.114dns.com.domain > 192.168.171.128.55674: 43348 ServFail 0/0/0 (45)
10:08:54.513187 IP 192.168.171.128.51465 > public1.114dns.com.domain: 43348+ PTR? 196.216.80.114.in-addr.arpa. (45)
10:08:54.521921 IP public1.114dns.com.domain > 192.168.171.128.51465: 43348 ServFail 0/0/0 (45)

4、结论
测试发现没ping 一次,centos7都会向dns服务器请求一次dns解析