---
title: "[利器] 使用tcpdump和Wireshark分析网络数据包"
author: "bert82503"
date: "2014-10-25T14:20:29Z"
tags: []
categories: ["互联网"]
slug: "tcpdump-wireshark"
draft: false
lastmod: "2014-11-05T00:08:37Z"
id: 2147865
url: "https://bert82503.iteye.com/blog/2147865"
---

要想快速使用Wireshark分析请求数据包，可参考其本地文档《[Wireshark过滤器语法与引用]() *HELP-Manual Pages-Wireshark Filter*》和《[一站式学习Wireshark](https://community.emc.com/thread/194901?start=0&tstart=0)》系列文章。

 

如何使用tcpdump在Linux服务器下抓取网络数据包

【示例】

1\. 抓取8080端口上的所有网络数据包

sudo tcpdump -i eth0 -n port 8080 -w keepalive-http.txt

2\. 抓取80端口和特定源或目标地址的所有网络数据包

sudo tcpdump -i eth0 -n port 80 and host xxx.xxx.xxx.xxx -w keepalive-http.txt

 

\[参考] [A tcpdump Primer](http://danielmiessler.com/study/tcpdump/#common)

 

【示例】Wireshark过滤器的使用

1\. 过滤一次请求完整的数据包  
ip.addr==xxx.xxx.xxx.xxx && tcp.port==xxx

 

\[参考]

1. [WireShark 过滤语法](http://johnson4303.blog.163.com/blog/static/102397216200981811351855/)

2. [wireshark过滤语法总结](http://blog.csdn.net/cumirror/article/details/7054496)

 

 

玩的开心！^\_^