Tcpdump usage examples

In most cases you will need root permission to be able to capture packets on an interface. Using tcpdump (with root) to capture the packets and saving them to a file to analyze with Wireshark (using a regular account) is recommended over using Wireshark with a root account to capture packets on an "untrusted" interface. See theWireshark security advisories for reasons why.

========================================================================================================

See the list of interfaces on which tcpdump can listen:

tcpdump -D

Listen on interface eth0:

tcpdump -i eth0

Listen on any available interface (cannot be done in promiscuous mode. Requires Linux kernel 2.2 or greater):

tcpdump -i any

Be verbose while capturing packets:

tcpdump -v

Be more verbose while capturing packets:

tcpdump -vv

Be very verbose while capturing packets:

tcpdump -vvv

Be less verbose (than the default) while capturing packets:

tcpdump -q

Limit the capture to 100 packets:

tcpdump -c 100

Record the packet capture to a file called capture.cap:

tcpdump -w capture.cap

Record the packet capture to a file called capture.cap but display on-screen how many packets have been captured in real-time:

tcpdump -v -w capture.cap

Display the packets of a file called capture.cap:

tcpdump -r capture.cap

Display the packets using maximum detail of a file called capture.cap:

tcpdump -vvv -r capture.cap

Display IP addresses and port numbers instead of domain and service names when capturing packets:

tcpdump -n

Capture any packets where the destination host is 192.168.1.1. Display IP addresses and port numbers:

tcpdump -n dst host 192.168.1.1

Capture any packets where the source host is 192.168.1.1. Display IP addresses and port numbers:

tcpdump -n src host 192.168.1.1

Capture any packets where the source or destination host is 192.168.1.1. Display IP addresses and port numbers:

tcpdump -n host 192.168.1.1

Capture any packets where the destination network is 192.168.1.0/24. Display IP addresses and port numbers:

tcpdump -n dst net 192.168.1.0/24

Capture any packets where the source network is 192.168.1.0/24. Display IP addresses and port numbers:

tcpdump -n src net 192.168.1.0/24

Capture any packets where the source or destination network is 192.168.1.0/24. Display IP addresses and port numbers:

tcpdump -n net 192.168.1.0/24

Capture any packets where the destination port is 23. Display IP addresses and port numbers:

tcpdump -n dst port 23

Capture any packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:

tcpdump -n dst portrange 1-1023

Capture only TCP packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:

tcpdump -n tcp dst portrange 1-1023

Capture only UDP packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:

tcpdump -n udp dst portrange 1-1023

Capture any packets with destination IP 192.168.1.1 and destination port 23. Display IP addresses and port numbers:

tcpdump -n "dst host 192.168.1.1 and dst port 23"

Capture any packets with destination IP 192.168.1.1 and destination port 80 or 443. Display IP addresses and port numbers:

tcpdump -n "dst host 192.168.1.1 and (dst port 80 or dst port 443)"

Capture any ICMP packets:

tcpdump -v icmp

Capture any ARP packets:

tcpdump -v arp

Capture either ICMP or ARP packets:

tcpdump -v "icmp or arp"

Capture any packets that are broadcast or multicast:

tcpdump -n "broadcast or multicast"

Capture 500 bytes of data for each packet rather than the default of 68 bytes:

tcpdump -s 500

Capture all bytes of data within the packet:

tcpdump -s 0

Tcpdump usage examples

时间: 2024-11-05 13:39:57

Tcpdump usage examples的相关文章

Tcpdump使用常用9实例

以下将给出9个使用tcpdump的例子,以说明tcpdump的具体使用方法. 1.针对特定网口抓包(-i选项) 当我们不加任何选项执行tcpdump时,tcpdump将抓取通过所有网口的包:使用-i选项,我们可以在某个指定的网口抓包: linux:/tmp/lx # tcpdump -i eth0 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-t

guide dpdk

Welcome to DPDK Guide! Contents: Setting up DPDK Important Prerequisites Setting up repositories Red Hat Enterprise Linux Fedora Installing DPDK and related software Hugepages 2M Hugepages 1G Hugepages IOMMU Binding NIC drivers VFIO VFIO no-IOMMU UIO

【转】Unity3D研究院之通过C#使用Advanced CSharp Messenger(五十)

http://www.xuanyusong.com/archives/2165 Advanced CSharp Messenger 属于C#事件的一种. 维基百科中由详细的说明http://wiki.unity3d.com/index.php?title=Advanced_CSharp_Messenger 上周的一天刚巧有朋友问到我这一块的知识,那么我研究出来将它贴在博客中,帮助了他也帮助我自己!哇咔咔. Advanced CSharp Messenger的特点可以将游戏对象做为参数发送.到底A

AbstractQueuedSynchronizer源码分析

/* * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as expl

管理应用程序状态

管理应用程序状态 原文:Managing Application State作者:Steve Smith翻译:姚阿勇(Dr.Yao)校对:高嵩 在 ASP.NET Core 中,有多种途径可以对应用程序的状态进行管理,取决于检索状态的时机和方式.本文简要介绍几种可选的方式,并着重介绍为 ASP.NET Core 应用程序安装并配置会话状态支持. 查看或下载示例代码 应用程序状态的可选方式 应用程序状态 指的是用于描述应用程序当前状况的任意数据.包括全局的和用户特有的数据.之前版本的ASP.NET

change the walltime for currently running PBS job (qalter pbs)

qalter jobid -l walltime=X e.g.qalter 377470.manager -l walltime=2222:00:00qalter: Unauthorized Request  377470.manager NOTE: You cannot make any alterations to the executable portion of the script, nor can you make any changes after the job starts r

Linux -- dd 命令

11.2 `dd': Convert and copy a file================================== `dd' copies a file (from standard input to standard output, by default)with a changeable I/O block size, while optionally performingconversions on it.  Synopses: dd [OPERAND]...    

Golang官方依赖管理工具:dep

在这里声明一下,百度或者google看到的godep不是我这篇博文说的dep,那它们是什么关系呢?按照Peter Bourgon博文来说,它们的作者都有相同的人,但是一个是dep是官方版本,godep是第三方工具.我今天介绍的是dep,之前也有介绍过glide,有兴趣的可以到Golang依赖管理工具:glide从入门到精通使用看看. 现在还有一个疑问是为什么官方现在要支持依赖管理了呢?我个人认为有如下原因(勿喷,如果不同或者遗漏欢迎留言补充): 第三方依赖管理很多,虽然很好用,但是很少可以兼容的

高级C#信使(译) - Unity维基百科

高级C#信使 作者:Ilya Suzdalnitski 译自:http://wiki.unity3d.com/index.php/Advanced_CSharp_Messenger 描述 前言 MissingReferenceException的原因和解决方案 信使 用法 事件监听器 注册事件监听器 注销事件监听器 广播事件 清空信使 永久信使 杂项 打印所有消息 从其他信使过渡 代码 Callback.cs Messenger.cs 描述 这是C#的一个高级版本的消息系统.当加载了一个新的场景