亚洲欧美精品沙发,日韩在线精品视频,亚洲Av每日更新在线观看,亚洲国产另类一区在线5

<pre id="hdphd"></pre>

  • <div id="hdphd"><small id="hdphd"></small></div>
      學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 > tcpdump命令的使用方法

      tcpdump命令的使用方法

      時(shí)間: 春健736 分享

      tcpdump命令的使用方法

        在Linux的命令行里邊我們需要借助tcpdump命令進(jìn)行抓包,下面小編與大家分享一下tcpdump命令的使用方法,希望對(duì)大家有所幫助

        tcpdump命令的使用方法

        實(shí)用命令實(shí)例

        默認(rèn)啟動(dòng)

        tcpdump

        普通情況下,直接啟動(dòng)tcpdump將監(jiān)視第一個(gè)網(wǎng)絡(luò)接口上所有流過(guò)的數(shù)據(jù)包。

        監(jiān)視指定網(wǎng)絡(luò)接口的數(shù)據(jù)包

        tcpdump -i eth1

        如果不指定網(wǎng)卡,默認(rèn)tcpdump只會(huì)監(jiān)視第一個(gè)網(wǎng)絡(luò)接口,一般是eth0,下面的例子都沒(méi)有指定網(wǎng)絡(luò)接口。

        監(jiān)視指定主機(jī)的數(shù)據(jù)包

        打印所有進(jìn)入或離開(kāi)sundown的數(shù)據(jù)包.

        tcpdump host sundown

        也可以指定ip,例如截獲所有210.27.48.1 的主機(jī)收到的和發(fā)出的所有的數(shù)據(jù)包

        tcpdump host 210.27.48.1

        打印helios 與 hot 或者與 ace 之間通信的數(shù)據(jù)包

        tcpdump host helios and \( hot or ace \)

        截獲主機(jī)210.27.48.1 和主機(jī)210.27.48.2 或210.27.48.3的通信

        tcpdump host 210.27.48.1 and \ (210.27.48.2 or 210.27.48.3 \)

        打印ace與任何其他主機(jī)之間通信的IP 數(shù)據(jù)包, 但不包括與helios之間的數(shù)據(jù)包.

        tcpdump ip host ace and not helios

        如果想要獲取主機(jī)210.27.48.1除了和主機(jī)210.27.48.2之外所有主機(jī)通信的ip包,使用命令:

        tcpdump ip host 210.27.48.1 and ! 210.27.48.2

        截獲主機(jī)hostname發(fā)送的所有數(shù)據(jù)

        tcpdump -i eth0 src host hostname

        監(jiān)視所有送到主機(jī)hostname的數(shù)據(jù)包

        tcpdump -i eth0 dst host hostname

        監(jiān)視指定主機(jī)和端口的數(shù)據(jù)包

        如果想要獲取主機(jī)210.27.48.1接收或發(fā)出的telnet包,使用如下命令

        tcpdump tcp port 23 and host 210.27.48.1

        對(duì)本機(jī)的udp 123 端口進(jìn)行監(jiān)視 123 為ntp的服務(wù)端口

        tcpdump udp port 123

        監(jiān)視指定網(wǎng)絡(luò)的數(shù)據(jù)包

        打印本地主機(jī)與Berkeley網(wǎng)絡(luò)上的主機(jī)之間的所有通信數(shù)據(jù)包(nt: ucb-ether, 此處可理解為'Berkeley網(wǎng)絡(luò)'的網(wǎng)絡(luò)地址,此表達(dá)式最原始的含義可表達(dá)為: 打印網(wǎng)絡(luò)地址為ucb-ether的所有數(shù)據(jù)包)

        tcpdump net ucb-ether

        打印所有通過(guò)網(wǎng)關(guān)snup的ftp數(shù)據(jù)包(注意, 表達(dá)式被單引號(hào)括起來(lái)了, 這可以防止shell對(duì)其中的括號(hào)進(jìn)行錯(cuò)誤解析)

        tcpdump 'gateway snup and (port ftp or ftp-data)'

        打印所有源地址或目標(biāo)地址是本地主機(jī)的IP數(shù)據(jù)包

        (如果本地網(wǎng)絡(luò)通過(guò)網(wǎng)關(guān)連到了另一網(wǎng)絡(luò), 則另一網(wǎng)絡(luò)并不能算作本地網(wǎng)絡(luò).(nt: 此句翻譯曲折,需補(bǔ)充).localnet 實(shí)際使用時(shí)要真正替換成本地網(wǎng)絡(luò)的名字)

        tcpdump ip and not net localnet

      892697