Tcpdump is everyday tool used by system and network administrator. We generally look simple use cases like host, port and protocol filter for tcpdump
. In this tutorial we will look how to filter host, port and protocol in tcpdump. But keep in mind that tcpdump will requires administrator or root privileges. We can use root
account or sudo
command in order to gain root privileges.
Tcpdump是系统和网络管理员使用的日常工具。 我们通常看起来很简单的用例,例如tcpdump
主机,端口和协议过滤器。 在本教程中,我们将研究如何在tcpdump中过滤主机,端口和协议。 但是请记住,tcpdump将需要管理员或root特权。 我们可以使用root
帐户或sudo
命令来获得root特权。
指定主机名 (Specify Host Name)
Tcpdump can resolve host names like regular tools. We can specify the host name but the host name should be resolvable. In this example we will capture traffic from poftut.com
. We will use host
option like below.
Tcpdump可以像常规工具一样解析主机名。 我们可以指定主机名,但是主机名应该是可解析的。 在此示例中,我们将捕获来自poftut.com
流量。 我们将使用如下所示的host
选项。
$ tcpdump host poftut.com
指定IP地址 (Specify IP Address)
IP address of the target can be provided to the tcpdump like below. In this example we will capture packets from 192.168.122.10
可以将目标的IP地址提供给tcpdump,如下所示。 在此示例中,我们将从192.168.122.10
捕获数据包
$ tcpdump host 192.168.122.10
![Specify IP Address](https://i-blog.csdnimg.cn/blog_migrate/4a343118a21cc125741922c7e60e6349.png)
指定端口(Specify Port)
We can specify the port number with port
option. This will capture all traffic related port number from target and our local system. In thi