====== 概要 ====== * 2つのコンピュータの間の通信速度を測定する方法です * より正確な測定のため、測定時はほかの通信が起こらないように注意してください * 測定する通信先のコンピュータのIPアドレス(あるいはホスト名)を xxx.xxx.xxx.xxx とします ====== pingを使う方法 ====== 概算になりますが、計測に必要なソフトを別に入れる必要がないのでお手軽です。 ただし誤差が非常に大きいので注意して使いましょう(場合によっては数倍ずれるので、オーダーだけ見ると良いと思います)。 pingコマンドのオプションは次のとおりです * -c ... データを送る回数 * -s ... データのサイズ(最大65507バイト)。ただし実際に送られるデータはこれにIPヘッダ20バイトとICMPヘッダ8バイトが加わる 実際に次のように測定します $ ping -c 10 -s 65507 xxx.xxx.xxx.xxx PING xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 65507(65535) bytes of data. 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=2 ttl=63 time=3.11 ms 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=3 ttl=63 time=3.07 ms 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=4 ttl=63 time=3.21 ms 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=5 ttl=63 time=3.17 ms 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=6 ttl=63 time=3.21 ms 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=7 ttl=63 time=3.18 ms 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=8 ttl=63 time=3.12 ms 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=9 ttl=63 time=3.21 ms 65515 bytes from xxx.xxx.xxx.xxx: icmp_seq=10 ttl=63 time=3.16 ms --- xxx.xxx.xxx.xxx ping statistics --- 10 packets transmitted, 9 received, 10% packet loss, time 9023ms rtt min/avg/max/mdev = 3.072/3.165/3.218/0.060 ms この場合は毎回65507+20+8=65535バイトのデータが送信されます。 一回の送受信に平均3.165ミリ秒かかっていて、1バイトは8ビットですから、この場合は通信速度として 65535 * 8 * 2 / 3.165 / 1000 = 約 331 Mbps が得られます。 ====== iperf3を使う方法 ====== より正確に2つのコンピュータの間の通信速度を測定できます。 データを送信する側(クライアント側。sender)、受信する側(サーバ側。receiver)の両方にiperf3をインストールします。 $ sudo apt intall iperf3 データを受信するコンピュータ(receiver)で、以下のコマンドを実行します $ iperf3 -s データを送信するコンピュータ(sender. IPアドレスが192.168.0.1とします)で、以下のコマンドを実行します $ iperf3 -c xxx.xxx.xxx.xxx Connecting to host xxx.xxx.xxx.xxx, port 5201 [ 5] local 192.168.0.1 port 37918 connected to xxx.xxx.xxx.xxx port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 1.10 GBytes 9.42 Gbits/sec 2 1.40 MBytes [ 5] 1.00-2.00 sec 1.10 GBytes 9.42 Gbits/sec 3 1.44 MBytes [ 5] 2.00-3.00 sec 1.10 GBytes 9.42 Gbits/sec 0 1.49 MBytes [ 5] 3.00-4.00 sec 1.10 GBytes 9.42 Gbits/sec 1 1.51 MBytes [ 5] 4.00-5.00 sec 1.09 GBytes 9.41 Gbits/sec 2 1.56 MBytes [ 5] 5.00-6.00 sec 1.10 GBytes 9.42 Gbits/sec 0 1.57 MBytes [ 5] 6.00-7.00 sec 1.10 GBytes 9.42 Gbits/sec 4 1.62 MBytes [ 5] 7.00-8.00 sec 1.10 GBytes 9.42 Gbits/sec 14 1000 KBytes [ 5] 8.00-9.00 sec 1.10 GBytes 9.42 Gbits/sec 0 1.49 MBytes [ 5] 9.00-10.00 sec 1.10 GBytes 9.42 Gbits/sec 5 1.62 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 11.0 GBytes 9.42 Gbits/sec 31 sender [ 5] 0.00-10.04 sec 11.0 GBytes 9.37 Gbits/sec receiver iperf Done. この場合、senderからデータを送る速さが9.42Gbps, receiverからデータが送り返されてくる速さが9.37Gbpsであることがわかります。 receiverのiperf3を終了するには Ctrl+c を入力します。