1. 程式人生 > >TCP Traffic Analyzer

TCP Traffic Analyzer

server 根據 sent cap been rtt 取數 字節 flags

TCP Traffic Analyzer 工具
yahoo 發布的一款開源網絡分析工具,可以分析網絡應用在服務器端與客戶端之間的運行狀態
Yconalyzer保持與tcpdump兼容,兩者生成的抓取文件能夠彼此識別和分析。Yconalyzer支持tcpdump的所有過濾條件,並適用於TCP協議之上的所有網絡協議,如HTTP、SMTP、POP、IMAP等等。


能做的幾點
1、持續時間超過(或者小於)某閾值(或在某個區間內)的TCP連接數。
2、嘗試次數超過N次才成功的TCP連接數。
3、TCP連接持續時間和吞吐量的分布情況。
4、數據包超過N字節的TCP連接分布情況。 -Y
5、持續時間在特定閾值內的IP地址和端口分布情況。 -D 區間開始值


Yconalyzer會根據不同的選項顯示出不同的分析結果


下載、安裝
yum install *pcap* 基於pcap庫
wget http://nchc.dl.sourceforge.net/project/yconalyzer/yconalyzer-1.0.4.tar.bz2
tar -xvf yconalyzer-1.0.4.tar.bz2
./configure </dir>
gmake && gmake install

命令參數:使用時必帶參數 -p 端口號


等價的命令:
tcpdump -w http.pcap ‘(tcp port 80)&&((tcp[tcpflags] & (tcp-syn|tcp-fin|tcp-rst)) != 0)‘

yconalyzer -w http.pcap -p 80


-d: Debug on (default off) 實時輸出
-c: 打印嘗試次數超過指定次數才成功的連接 Print connections that took >= num_attempts to establish
-R: 原始格式輸出分布 Raw format output. Useful for scripts
-r: 從文件讀取數據而不是從接口實時讀 Data is read from file instead of live interface
-w: 數據保存到文件中 Data is written to a file.
-i: 接口 Interface name (default is ethernet interface)
-n: 顯示多少個區間 Number of buckets for getting the distribution. Default 20
-s: 區間大小 Bucket size (connection life time). Default 20ms
-t: 抓包運行時間 ms Run time in seconds (default 60)

-X: 只顯示服務器端發送的數據小於 N bytes 的連接.
-Y: 只顯示服務器端發送的數據大於 N bytes 的連接

-x: 只顯示客戶端發送的數據小於 N bytes 的連接
-y: 只顯示客戶端發送的數據大於 N bytes 的連接

僅僅指定 -x 或 -X 也可以
Only one of -x or -X can be specified
-T: Attempt to estimate round trip time 預估每個連接的 RTT,
Estimates may be wrong if the command is run on the server side. See man page.

-D: 打印出指定區間中的IP及端口號,從文件讀取時有效。 Print connection filters for the bucket starting with this value


-p: 要監控的端口號,必須指定。 port number you want to monitor. Must be specified

-I: 在指定時間之前不抓取數據,指定時間之後才抓取連接 Consider pkts newer than this time. Specify in HH:MM:SS or YYYY-MM-DD.HH:MM:SS format
-P 以吞吐量區間輸出分布(KB/s) for sorting the output by throughput
-C 以客戶端發送大小為區間輸出分布(KB) for sorting the output by number of bytes sent by client
-S 以服務器端發送大小為區間輸出分布(KB) for sorting the output by number of bytes sent by server


Total Connections (terminated by FIN) 完整流從開始到結束,
連接總數 (通過 FIN 標記終止的)

客戶端平均發送bytes
Avg Client Data

服務器端平均發送bytes
Avg Server Data

所有連接平均持續時間
Avg conn duration

平均 RTT
Avg Round Trip Time

SYN 總數 求證過
Total number of SYNs

Connections terminated by RESET
連接被 RESET 重置的數量

Number of SYNs taken to establish connections
拿 SYN 建立連接的數量

Number of unique connections dropped by the server
通過服務器丟棄的唯一連接 的數量

Number of SYNs from incomplete connections
不完整的連接的 SYN 的數量

Number of established connections in progress:0 (0 may have been discarded by the client)
正在建立連接的數量 (可能由客戶端丟棄的)

Number of connections in closing state
closing 狀態下的連接數量

Distribution of SYNs to establsh connections (nSYNs:nConns): 1:46,
嘗試次數跟已建立連接 的分布情況 : 嘗試次數:已建立的連接

TCP Traffic Analyzer