我有一個小辦公室網絡,並且遇到巨大的互聯網鏈接延遲。我們有一個簡單的網絡拓撲結構:配置爲運行Ubuntu 10.10服務器的路由器,2個網卡(一個連接到互聯網,另一個連接到辦公網絡)和一臺連接20臺計算機的交換機。我在路由器上收集了一個巨大的tcpdump日誌,我想繪製一個直方圖,其RTT時間爲,全部爲 TCP流,以嘗試找出此延遲問題的最佳解決方案。那麼,有人可以告訴我如何使用wireshark或其他工具來做到這一點嗎?使用wireshark或其他工具繪製RTT直方圖
6
A
回答
11
Wireshark的或tshark的可以給你TCP RTT爲每個接收到使用tcp.analysis.ack_rtt其測量捕獲一個TCP包和用於該數據包的ACK之間的時間增量ACK分組。
你必須要小心,這是大部分的ACK包會從您的辦公用機員在確認從互聯網上接收的數據包,這樣你就可以測量RTT路由器之間看到來自互聯網的數據包,看到來自你的辦公機器的確認。
要測量您的互聯網RTT,您需要查找來自互聯網的ACK(確認從您的網絡發送的數據)。假設你的辦公用機有一個像192.168.1.x的IP地址,你已經登錄你的路由器的LAN端口上的所有數據,你可以使用顯示過濾器,像這樣:
tcp.analysis.ack_rtt and ip.dst==192.168.1.255/24
要轉儲的RTT成。用於分析的csv,你可以像這樣使用tshark命令;
tshark -r router.pcap -Y "tcp.analysis.ack_rtt and ip.dst==192.168.1.255/24" -e tcp.analysis.ack_rtt -T fields -E separator=, -E quote=d > rtt.csv
- -r選項告訴tshark的從.pcap文件讀取
- -Y選項指定顯示過濾器使用(-R而不-2已被棄用)
- 的-e選項指定輸出
- 了-t選項字段中指定的輸出格式
你ç在運行此命令之前,使用mergecap實用程序將所有pcap文件合併到一個文件中。將此輸出轉換爲直方圖應該很簡單!
-1
You can use tshark statistics to create a table of all tcp conversations: $ tshark -r test.pcap -q -z conv,tcp ================================================================================ TCP Conversations Filter: | | | Total | | Frames Bytes | | Frames Bytes | | Frames Bytes | 192.168.108.2:2720 147.234.1.253:21 28 2306 18 1047 46 3353 147.234.1.253:58999 192.168.108.2:2721 3 170 2 122 5 292 192.168.108.2:2718 147.137.21.94:139 0 0 3 186 3 186 192.168.108.2:2717 147.137.21.94:445 0 0 3 186 3 186 ================================================================================ Or use this little script: for file in `ls -1 *.pcap` do tshark -r $file -q -z conv,tcp > $file.txt done
1
這裏的5分鐘perlscript通過rupello的回答啓發:
#!/usr/bin/perl
# For a live histogram of rtt latencies, save this file as /tmp/x.pl and chmod +x /tmp/x.pl, then run:
# tshark -i br1 -R "tcp.analysis.ack_rtt and ip.dst==192.168.1.0/24" -e tcp.analysis.ack_rtt -T fields -E separator=, -E quote=d | /tmp/x.pl
# Don't forget to update the interface "br1" and "and ip.dst==..." bits as appropriate.
@t[$m=0]=20;
@t[++$m]=10;
@t[++$m]=5;
@t[++$m]=2;
@t[++$m]=1;
@t[++$m]=0.9;
@t[++$m]=0.8;
@t[++$m]=0.7;
@t[++$m]=0.6;
@t[++$m]=0.5;
@t[++$m]=0.4;
@t[++$m]=0.3;
@t[++$m]=0.2;
@t[++$m]=0.1;
@t[++$m]=0.05;
@t[++$m]=0.04;
@t[++$m]=0.03;
@t[++$m]=0.02;
@t[++$m]=0.01;
@t[++$m]=0.005;
@t[++$m]=0.001;
@t[++$m]=0;
@h[0]=0;
while (<>) {
s/\"//g; $n=$_; chomp($n);
for ($i=$m;$i>=0;$i--) { if ($n<=$t[$i]) { $h[$i]++; $i=-1; }; };
if ($i==-1) { $h[0]++; };
print "\033c";
for (0..$m) { printf "%6s %6s %8s\n",$t[$_],sprintf("%3.2f",$h[$_]/$o*100),$h[$_]; };
}
假如把它放在你的smokeping圖和...實用的「的統計瑞士軍刀」這一直激勵着待機...
tshark的新版本似乎更好地使用「tshark」前面的「stdbuf -i0 -o0 -e0」。
PS有誰知道wireshark是否內置了DNS和ICMP rtt stats或者如何輕鬆獲取這些內容?
相關問題
- 1. 如何繪製其他兩個直方圖條總和的直方圖?
- 2. 繪製直方圖
- 3. 繪製直方圖
- 4. 繪製直方圖
- 5. 用python繪製直方圖
- 6. 使用Pylab繪製直方圖
- 7. 使用pyplot繪製直方圖
- 8. 使用集羣繪製直方圖
- 9. 使用python和quickdraw繪製直方圖
- 10. 使用熊貓繪製直方圖python
- 11. 使用gnuplot繪製詞頻直方圖
- 12. 使用bar3繪製3D直方圖
- 13. 使用Python繪製直方圖
- 14. 使用matplot.lib繪製直方圖
- 15. 繪製圖形直方圖
- 16. 用Paint.net鉛筆工具繪製直線
- 17. 繪製二分圖的工具或庫?
- 18. 如何僅使用awt或其他繪圖機制部分繪製字符?
- 19. Can Flot(或任何其他JQuery圖表庫)繪製方程嗎?
- 20. 使用Wireshark或ngrep保存FLV視頻 - 或其他任何
- 21. CCScrollLayer或其他方法,使圖庫視圖垂直滾動
- 22. 繪製一種直方圖
- 23. 繪製直方圖條件
- 24. 如何使用clang或其他工具生成數據流圖?
- 25. 使用在線工具或matlab繪製圖形
- 26. 繪製直方圖或散點圖與當前的直方圖的matplotlib
- 27. 用點代替直方圖繪製直方圖
- 28. 在直方圖上繪製直線
- 29. 繪製垂直直方圖C#
- 30. 在直方圖中使用qplot()繪製垂直峯值線R
我沒有看到這個問題的相關性。 – MaxVT