tcpdump 识别成dns_dns tcpdump

查看本机dns服务器配置

root@php56:/home/tb# cat /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

nameserver 10.70.1.38

nameserver 10.70.1.39

root@php56:/home/tb#

利用host命令执行操作

root@php56:/home/tb# host -t A WWW.BAIDU.COM

www.baidu.com is an alias for www.a.shifen.com.

www.a.shifen.com has address 14.215.177.39

www.a.shifen.com has address 14.215.177.38

root@php56:/home/tb#

抓包命令及结果

root@php56:/home/tb# tcpdump -i enp0s3 -nt -s 500 port domain

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on enp0s3, link-type EN10MB (Ethernet), capture size 500 bytes

IP 10.70.30.60.35117 > 10.70.1.38.53: 13616+ A? WWW.BAIDU.COM. (31)

IP 10.70.1.38.53 > 10.70.30.60.35117: 13616 3/0/0 CNAME www.a.shifen.com., A 14.215.177.39, A 14.215.177.38 (90)

简短解释

tcpdump 以 ip地址.端口号标识通信的某一端

以">"表示数据传输方向

10.70.1.38是本机首选dns服务器,可见53是dns服务器端口

13616为查询标识,对应response的13616

13616后的+号代表是递归(注意和迭代区分)

A?表示使用A类型的查询方式

最后的31为dns查询报文的长度

3/0/0 分别代表3个应答资源记录,0个授权记录和0个额外信息记录,最后的90为响应字节长度

More:tcpdump -x选项(可以看到dns每个字节)

root@php56:/home/tb# tcpdump -i enp0s3 -ntx -s 500 port domain

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on enp0s3, link-type EN10MB (Ethernet), capture size 500 bytes

IP 10.70.30.60.50417 > 10.70.1.38.53: 52136+ A? WWW.BAIDU.COM. (31)

0x0000: 4500 003b cf8e 0000 4011 7736 0a46 1e3c

0x0010: 0a46 0126 c4f1 0035 0027 3426 cba8 0100

0x0020: 0001 0000 0000 0000 0357 5757 0542 4149

0x0030: 4455 0343 4f4d 0000 0100 01

IP 10.70.1.38.53 > 10.70.30.60.50417: 52136 3/0/0 CNAME www.a.shifen.com., A 220.181.38.150, A 220.181.38.149 (90)

0x0000: 4500 0076 0000 4000 3f11 078a 0a46 0126

0x0010: 0a46 1e3c 0035 c4f1 0062 4ef4 cba8 8180

0x0020: 0001 0003 0000 0000 0377 7777 0562 6169

0x0030: 6475 0363 6f6d 0000 0100 01c0 0c00 0500

0x0040: 0100 0003 b400 0f03 7777 7701 6106 7368

0x0050: 6966 656e c016 c02b 0001 0001 0000 0030

0x0060: 0004 dcb5 2696 c02b 0001 0001 0000 0030

0x0070: 0004 dcb5 2695

参考字段说明

b68715804be78f5812bea37d603df335.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值