38. netstat(8)
• -s を付けた場合はネットワークスタック統計
• ネットワーク統計をプロトコル別に分類して表示する
Ip:
1450008 total packets received
3 with invalid addresses
0 forwarded
[…]
Tcp:
23488 active connections openings
8 passive connection openings
[…]
TcpExt:
120 ICMP packets dropped because they were out-of-window
4344 TCP sockets finished time wait in fast timer
40. nicstat(1)
• スループットや使用率などのネットワークインターフェイス統
計を表示
• %Util 期間中の使用率の最大値
• Sat インターフェイスの飽和統計
% sudo nicstat -z 1
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
18:37:57 lo 0.02 0.02 0.19 0.19 123.6 123.6 0.00 0.00
18:37:57 wlp2s0 2.17 0.32 2.74 1.84 808.4 175.9 0.00 0.00
41. ping(8)
• ICMPエコー要求を送ってネットワークの接続をテストする
• RTT に加え、統計の集計値が含まれる
• ICMPパケットは優先度が低いので、レイテンシに注意
% ping www.google.com
PING www.google.com (172.217.26.36) 56(84) bytes of data.
64 bytes from nrt12s17-in-f36.1e100.net (172.217.26.36): icmp_seq=1 ttl=55 time=15.8 ms
64 bytes from nrt12s17-in-f36.1e100.net (172.217.26.36): icmp_seq=2 ttl=55 time=16.2 ms
64 bytes from nrt12s17-in-f36.1e100.net (172.217.26.36): icmp_seq=3 ttl=55 time=24.8 ms
64 bytes from nrt12s17-in-f36.1e100.net (172.217.26.36): icmp_seq=4 ttl=55 time=15.1 ms
64 bytes from nrt12s17-in-f36.1e100.net (172.217.26.36): icmp_seq=5 ttl=55 time=21.6 ms
64 bytes from nrt12s17-in-f36.1e100.net (172.217.26.36): icmp_seq=6 ttl=55 time=25.8 ms
^C
--- www.google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 15.162/19.944/25.817/4.375 ms
42. traceroute(8)
• 指定したホストに対するルートを調べる
% traceroute www.google.com
traceroute to www.google.com (172.217.31.164), 30 hops max, 60 byte packets
1 aterm.me (192.168.10.1) 77.320 ms 159.403 ms 117.325 ms
2 176.net061211191.t-com.ne.jp (61.211.191.176) 192.350 ms 316.488 ms 238.805 ms
3 162.net061211191.t-com.ne.jp (61.211.191.162) 275.939 ms 344.494 ms 380.810 ms
4 53.net061211191.t-com.ne.jp (61.211.191.53) 382.333 ms 418.206 ms 423.343 ms
5 69.net061211190.t-com.ne.jp (61.211.190.69) 109.348 ms 282.339 ms 425.259 ms
6 p206.net219124151.tnc.ne.jp (219.124.151.206) 414.095 ms 17.621 ms 18.138 ms
7 108.170.242.97 (108.170.242.97) 11.908 ms * 32.036 ms
8 209.85.248.113 (209.85.248.113) 42.113 ms 209.85.253.109 (209.85.253.109) 35.424 ms
209.85.248.113 (209.85.248.113) 37.160 ms
9 nrt12s22-in-f4.1e100.net (172.217.31.164) 33.363 ms 38.463 ms 40.075 ms
43. perf(1)
• perf を使えば、例えば tcp 接続を介してデータをやり取りする
部分のスタックトレースを表示できる
% sudo perf probe –add=‘tcp_sendmsg’
% sudo perf record -e probe:tcp_sendmsg -aR sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.807 MB perf.data (3 samples) ]
% sudo perf report -G --stdio
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 3 of event 'probe:tcp_sendmsg'
# Event count (approx.): 3
#
# Overhead Command Shared Object Symbol
# ........ ............... ................. ...............
#
100.00% Chrome_IOThread [kernel.kallsyms] [k] tcp_sendmsg