使用命令:
tcpdump -i eth1 -s 0 -C 2 -w jh.cap
-I eth1: 是指定网卡,
2 : 是2兆一个文件;
Jh.cap : 是文件名. 后面会跟一个数字自动加1
linux:
tcpdump host 10.164.192.135 –s 5000 -w log // -s 5000 很重要
例:
isap-1-10:~ # tcpdump host 10.71.155.102 -s 0 -w xxx.cap
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 7 packets captured
14 packets received by filter
0 packets dropped by kernel
tcpdump -i eth2 -s 0 -w 04141401.cap host 10.103.2.174 and port 8886
例
isap-1-10:~ # tcpdump -i eth0 -s 0 -w yyy.cap
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 218 packets captured
436 packets received by filter
0 packets dropped by kernel
isap-1-10:~ # tcpdump -i eth0 -s 0 -w yyy.cap port 8803
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 0 packets captured
0 packets received by filter
0 packets dropped by kernel
eth2 是 10.103.2.174 的”网卡名”, 使用 ifconfig 查看
表示抓含有地址为10.164.192.135的包
tcpdump -i eth0 -s 1500 -w a.dmp 这个语句机会可以在任何情况下使用。简单解释一下,-i eth0是在eth0接口上监听,-s 1500是一个很重要的参数,它指抓取的数据包的前1500个字节,否则你可能只能看到数据包的前68个字节,因为tcpdump的默认抓取长度是68,-w a.dmp是表示把抓取的数据写入a.dmp中。抓取介绍后,Ctl+C,你可以看到a.dmp已经生成。然后用sftp传到本机使用Ethereal解析。