tcpdump 命令使用

來源:互聯網
上載者:User

標籤:tcpdump 命令使用

1、抓取包含10.10.10.122的資料包 
# tcpdump -i eth0 -vnn host 10.10.10.122


 2、抓取包含10.10.10.0/24網段的資料包
 # tcpdump -i eth0 -vnn net 10.10.10.0/24


 3、抓取包含連接埠22的資料包
 # tcpdump -i eth0 -vnn port 22 


4、抓取udp協議的資料包
 # tcpdump -i eth0 -vnn  udp


 5、抓取icmp協議的資料包
 # tcpdump -i eth0 -vnn icmp
 6、抓取arp協議的資料包
 # tcpdump -i eth0 -vnn arp


 7、抓取ip協議的資料包
 # tcpdump -i eth0 -vnn ip


 8、抓取源ip是10.10.10.122資料包。
 # tcpdump -i eth0 -vnn src host 10.10.10.122


 9、抓取目的ip是10.10.10.122資料包
 # tcpdump -i eth0 -vnn dst host 10.10.10.122


 10、抓取源連接埠是22的資料包
 # tcpdump -i eth0 -vnn src port 22


 11、抓取源ip是10.10.10.253且目的ip是22的資料包
 # tcpdump -i eth0 -vnn src host 10.10.10.253 and dst port 22
                  
 12、抓取源ip是10.10.10.122或者包含連接埠是22的資料包
 # tcpdump -i eth0 -vnn src host 10.10.10.122 or port 22


 13、抓取源ip是10.10.10.122且連接埠不是22的資料包
 [[email protected] ftp]# tcpdump -i eth0 -vnn src host 10.10.10.122 and not port 22
 
14、抓取源ip是10.10.10.2且目的連接埠是22,或源ip是10.10.10.65且目的連接埠是80的資料包。
 # tcpdump -i eth0 -vnn \( src host 10.10.10.2 and dst port 22 \) or   \( src host 10.10.10.65 and dst port 80 \)


 15、抓取源ip是10.10.10.59且目的連接埠是22,或源ip是10.10.10.68且目的連接埠是80的資料包。
 [[email protected] ~]# tcpdump -i  eth0 -vnn ‘src host 10.10.10.59 and dst port 22‘ or  ‘ src host 10.10.10.68 and dst port 80 ‘


 16、把抓取的資料包記錄存到/tmp/fill檔案中,當抓取100個資料包後就退出程式。
 # tcpdump –i eth0 -vnn -w  /tmp/fil1 -c 100


 17、從/tmp/fill記錄中讀取tcp協議的資料包
 # tcpdump –i eth0 -vnn -r  /tmp/fil1 tcp


 18、從/tmp/fill記錄中讀取包含10.10.10.58的資料包
 # tcpdump –i eth0 -vnn -r  /tmp/fil1 host  10.10.10.58

本文出自 “我是一隻小小鳥” 部落格,請務必保留此出處http://2242558.blog.51cto.com/2232558/1545317

tcpdump 命令使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.