Linux使用tcpdump命令抓包保存pcap文件wireshark分析
[root@ok Desktop]# yum search tcpdump
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.yun-idc.com
======================================================================= N/S Matched: tcpdump ========================================================================
tcpdump.x86_64 : A network traffic monitoring tool Name and summary matches only, use "search all" for everything.
[root@ok Desktop]# which tcpdump
/usr/sbin/tcpdump
[root@ok Desktop]# tcpdump -h
tcpdump version 4.1-PRE-CVS_2015_07_23
libpcap version 1.4.
Usage: tcpdump [-aAdDefhIJKlLnNOpqRStuUvxX] [ -B size ] [ -c count ]
[ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
[ -i interface ] [ -j tstamptype ] [ -M secret ]
[ -P in|out|inout ]
[ -r file ] [ -s snaplen ] [ -T type ] [ -w file ]
[ -W filecount ] [ -y datalinktype ] [ -z command ]
[ -Z user ] [ expression ]
[root@ok Desktop]# yum search wireshark
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.yun-idc.com
================================================ N/S Matched: wireshark ================================================
wireshark-devel.i686 : Development headers and libraries for wireshark
wireshark-devel.x86_64 : Development headers and libraries for wireshark
wireshark-gnome.x86_64 : Gnome desktop integration for wireshark and wireshark-usermode
wireshark.i686 : Network traffic analyzer
wireshark.x86_64 : Network traffic analyzer Name and summary matches only, use "search all" for everything.
安装:
[root@ok Desktop]# yum install wireshark* -y
[root@ok Desktop]# which wireshark
/usr/sbin/wireshark
[root@ok Desktop]# rpm -qa|grep wireshark
wireshark-devel-1.8.10-17.el6.x86_64
wireshark-1.8.10-17.el6.x86_64
wireshark-gnome-1.8.10-17.el6.x86_64
保存tcpdump抓包结果
[root@bass Desktop]# tcpdump -i eth0 -w dump.pcap
-i #是指定要抓取的网卡
-w #指定结果保存的位置
[root@bass Desktop]# tcpdump -i eth0 -w dump.pcap -v
tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size bytes
^C189 packets captured
packets received by filter
packets dropped by kernel
-v#主要是为了得到Got 15这个数,当想要停止的时候,按下ctrl + c
[root@bass Desktop]# ll -h dump.pcap
-rw-r--r--. tcpdump tcpdump 18K Aug : dump.pcap
在wireshark中打开:
[root@bass Desktop]# wireshark dump.pcap #linux下查看

我们用tcpdump抓包的时候,默认是显示这样的:

上图中标出三快区域,红色框内,是用来显示简单的数据包信息,我们用tcpdump抓包如时候,默认情况是显示成这样的;深蓝框内,是用来显示选中的数据包的详细信息,是按照TCP/IP四层结构显示的,第一行是数据链路层的信息,第二行是网络层信息(IP协议),第三行是传输层信息(TCP协议),第四层是应用层信息(HTTP协议),可以展开第一行用来观察具体的内容;最后一个区域淡蓝色框中,是用来显示此数据包的真实面目。(下图列清楚)

------------------------------------------------------------------------------------------------------------------------------------------------------
sh-4.1# tcpdump -i eth0 -c -w 20gebao -v
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size bytes
packets captured
packets received by filter
packets dropped by kernel
使用-c参数指定要监听到的数据包数量

Linux使用tcpdump命令抓包保存pcap文件wireshark分析的更多相关文章
- Linux使用tcpdump命令抓包并使用wireshark分析
Linux使用tcpdump命令抓包并使用wireshark分析 介绍 有时分析客户端和服务器网络交互的问题时,为了查找问题,需要分别在客户端和服务器上抓包,我们的客户端一般是windows上的,抓包 ...
- (转)Linux系统-tcpdump常用抓包命令
序言 单独总结tcpdump抓包的常用命令 主要语法 过滤主机/IP: tcpdump -i eth1 host 172.16.7.206 抓取所有经过网卡1,目的IP为172.16.7.206的网络 ...
- Linux系统-tcpdump常用抓包命令
主要语法 过滤主机/IP: tcpdump -i eth1 host 172.16.7.206 抓取所有经过网卡1,目的IP为172.16.7.206的网络数据 过滤端口: tcpdump -i e ...
- tcpdump命令抓包参数
在 Linux 命令行中使用 tcpdump 抓包 通过实例学习tcpdump命令 聊聊 tcpdump 与 Wireshark 抓包分析 tcpdump常用参数 -n 显示IP地址和端口号 -v 显 ...
- Tcpdump命令抓包详细分析
1 起因 前段时间,一直在调线上的一个问题:线上应用接受POST请求,请求body中的参数获取不全,存在丢失的状况.这个问题是偶发性的,大概发生的几率为5%-10%左右,这个概率已经相当高了.在排查问 ...
- tcpdump后台抓包并输出给wireshark
# 先进到/tmp 目录执行,方便Filezila 传输 # 开启抓包 nohup tcpdump -i eth0 -s0 -nnA 'port 22' -w dump22.pcap & [1 ...
- linux tcpdump命令抓包
tcpdump host 210.27.48.1 and \ (210.27.48.2 or 210.27.48.3 \) 截获主机210.27.48.1 和主机210.27.48.2 或210.27 ...
- 【转载】linux下的usb抓包方法
1 linux下的usb抓包方法 1.配置内核使能usb monitor: make menuconfig Device Drivers --> ...
- linux下的usb抓包方法
1 linux下的usb抓包方法1.配置内核使能usb monitor: make menuconfig Device Drivers --> ...
随机推荐
- what linux java cpu 100% ?
1.用top找到最耗资源的进程id [ bin]# toptop - 16:56:14 up 119 days, 6:17, 7 users, load average: 2.04, 2.07, 2. ...
- 文件流StreamReader和StreamWriter的使用
using (StreamReader sr = new StreamReader(@"C:\Users\shuai\Desktop\文件流读取.txt", Encoding.De ...
- Linux VPS新硬盘分区与挂载教程
通过fdisk -l我们可以看到/dev/xvdb(此名称因系统而异)容量有23.6G,而且没有分区,接下来我们对它进行分区和挂载 (红色字为需要输入的部分,黑色字为系统显示部分) 1.fdisk - ...
- AppSettingManager
public class AppSettingManager { public static bool Update(string key, string value) { try { var con ...
- 反射中 GetCustomAttributes
public abstract object[] GetCustomAttributes(bool inherit); 这是GetCustomAttributes方法的一个重载,参数为bool类型返回 ...
- Linux(Ubuntu)下面SecureCRT 完全破解
转载声明:本文来自http://www.boll.me/archives/680 相关说明: 上篇发了个Linux(Ubuntu) 下 SecureCRT 7 30天循环破解在启动的时候会多输入一次确 ...
- artEditor增加表单提交功能
摘要: artEditor.js是一款移动端的富文本编辑器,支持图片上传,后面会增加表情.小视频等功能.最近有朋友反馈artEditor是否支持表单提交,当然是支持的,在未开发该功能之前,你可以像下面 ...
- POJ 3274 Gold Balanced Lineup
Gold Balanced Lineup Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10924 Accepted: 3244 ...
- dedecms首页调用的简介一直修改不了是自动文章摘要在作怪
一位美女问:dedecms首页调用的简介一直修改不了,ytkah让她到具体的文章修改,然后再重新生成一下首页.她说还是不行.那就奇了怪了,点击到具体的文章页面是显示已经修改好了,为什么首页还是原来的呢 ...
- UITableView 委托方法总结
http://blog.sina.com.cn/s/blog_7b9d64af01019x3t.html 总结: UITableViewDelegate row: heightForRow hea ...