如何知道谁在ping我?

管理员
管理员 2022-3-24

被ping主机采用tcpdump监听

tcpdump -i eth0 icmp and icmp[icmptype]=icmp-echo -n

其他主机发起ping后,可以再被ping主机上看到谁在ping


备注:

1、centos安装tcpdump

yum install tcpdump

2、抓http包

tcpdump -XvvennSs 0 -i eth0 tcp[20:2]=0x4745 or tcp[20:2]=0x4854 -w /tmp/capture.pcap

3、通过网卡eth1来监听端口80发出去的host包到192.168.109.8的报文

tcpdump -i eth1 port 80 and dst host "192.168.109.8"

4、任意网卡目标是192.168.109.*的 80端口数据

/usr/local/sbin/tcpdump -i any  port 80 and dst host "192.168.109.*" -w /tmp/capture.pcap

加上源地址IP

tcpdump -i any -p -s 0 port 80 and dst host "192.168.109.*" and src host "10.70.32.**" -w /tmp/capture.pcap

5、监听特定主机

tcpdump  host 18.16.202.169

6、特定来源

tcpdump src host 18.16.202.169

7、特定目标地址

tcpdump dst host 18.16.202.169

8、监听特定端口

tcpdump port 8083 -vv

9、监听tcp协议,并加数据包写入abc.cap

tcpdump tcp port 8083 -w  ./abc.cap

10、其他示例说明

tcpdump tcp -i eth1 -t -s 0 -c 100 and dst port ! 22 and src net 192.168.1.0/24 -w ./target.cap

参数说明:

tcp: ip icmp arp rarp 和 tcp、udp、icmp这些选项等都要放到第一个参数的位置,用来过滤数据报的类型
-i eth1 : 只抓经过接口eth1的包
-t : 不显示时间戳
-s 0 : 抓取数据包时默认抓取长度为68字节。加上-S 0 后可以抓到完整的数据包
-c 100 : 只抓取100个数据包
dst port ! 22 : 不抓取目标端口是22的数据包
src net 192.168.1.0/24 : 数据包的源网络地址为192.168.1.0/24
-w ./target.cap : 保存成cap文件,方便用ethereal(即wireshark)分析


回帖
  • 消灭零回复

微信二维码

微信二维码

微信扫码添加微信好友