---
title: "tcpdump抓包 wireshark(ethereal)分析"
author: "lanmh"
date: "2011-08-29T08:50:20Z"
tags: []
categories: ["互联网"]
slug: "tcpdump-wireshark-ethereal"
draft: false
lastmod: "2011-08-29T08:50:20Z"
id: 1160044
url: "https://lanmh.iteye.com/blog/1160044"
---

tcpdump 的抓包保存到文件的命令参数是-w xxx.cap  
抓eth1的包   
tcpdump -i eth1 -w /tmp/xxx.cap   
抓 192.168.1.123的包   
tcpdump -i eth1 host 192.168.1.123 -w /tmp/xxx.cap   
抓192.168.1.123的80端口的包   
tcpdump -i eth1 host 192.168.1.123 and port 80 -w /tmp/xxx.cap   
抓192.168.1.123的icmp的包   
tcpdump -i eth1 host 192.168.1.123 and icmp -w /tmp/xxx.cap   
抓192.168.1.123的80端口和110和25以外的其他端口的包   
tcpdump -i eth1 host 192.168.1.123 and ! port 80 and ! port 25 and ! port 110 -w /tmp/xxx.cap   
抓vlan 1的包   
tcpdump -i eth1 port 80 and vlan 1 -w /tmp/xxx.cap   
抓pppoe的密码   
tcpdump -i eth1 pppoes -w /tmp/xxx.cap   
以100m大小分割保存文件， 超过100m另开一个文件 -C 100m   
抓10000个包后退出 -c 10000   
后台抓包， 控制台退出也不会影响：   
nohup tcpdump -i eth1 port 110 -w /tmp/xxx.cap &   
抓下来的文件可以直接用ethereal 或者wireshark打开。 wireshark就是新版的ethereal，程序换名了