3
Linux常用命令-109:tcpdump
source link: https://xugaoxiang.com/2022/09/28/linux-cmds-109-tcpdump/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
tcpdump
命令的作用是监听网络流量,是 Linux
系统中常用的数据抓包软件,能够记录所有经过服务器的数据包信息,命令需要 root
权限。
语法格式: tcpdump [参数]
常用参数:
# 监听指定网口的数据包
sudo tcpdump -i enp0s25
# 监听指定主机的数据包,可以使用 ip 地址,也可以域名
sudo tcpdump host 192.168.1.140
# 根据源端口进行过滤
sudo tcpdump src port 8080
# 根据目标端口进行过滤
sudo tcpdump dst port 8080
# 同时过滤多个端口
sudo tcpdump port 80 or port 8080
# 多个条件的组合,使用 and 关键字,其它的还有 not 和 or
sudo tcpdump src 192.168.1.140 and dst port 3306
# 有时候需要保存抓包结果,交由其它工具分析,如 wireshark
sudo tcpdump icmp -w icmp.pcap
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK