我正在使用 iperf 在两台机器之间运行简单的带宽测试,我想知道为什么 ssh 隧道比主机的本机网络更快。
SSH隧道iperf3 -s
在 100.73.10.38(k8snode2) 上 执行
[hanweisen@k8snode2 ~]$ iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
在 100.73.10.37(k8snode1) 上创建 ssh 代理
[hanweisen@k8snode1 ~]$ ssh -NL :100.73.10.38:5201
[email protected]
SSH warning: Authorized users only. All activity may be monitored
and reported.
[email protected]'s password:
iperf3 -c 127.0.0.1 -p 10800 -b 1600M -i 1 -t 10 -l 300
然后在100.73.10.37上执行:
[hanweisen@k8snode1 ~]$ sudo iperf3 -c 127.0.0.1 -p 10800 -b 1600M -i 1 -t 10 -l 300
Connecting to host 127.0.0.1, port 10800
[ 4] local 127.0.0.1 port 53678 connected to 127.0.0.1 port 10800
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 121 MBytes 1.02 Gbits/sec 0 639 KBytes
[ 4] 1.00-2.00 sec 122 MBytes 1.03 Gbits/sec 0 639 KBytes
[ 4] 2.00-3.00 sec 117 MBytes 984 Mbits/sec 0 639 KBytes
[ 4] 3.00-4.00 sec 117 MBytes 978 Mbits/sec 0 639 KBytes
[ 4] 4.00-5.00 sec 114 MBytes 957 Mbits/sec 0 2.62 MBytes
[ 4] 5.00-6.00 sec 102 MBytes 853 Mbits/sec 0 2.62 MBytes
[ 4] 6.00-7.00 sec 104 MBytes 873 Mbits/sec 0 2.62 MBytes
[ 4] 7.00-8.00 sec 105 MBytes 879 Mbits/sec 0 2.62 MBytes
[ 4] 8.00-9.00 sec 106 MBytes 893 Mbits/sec 0 2.62 MBytes
[ 4] 9.00-10.00 sec 98.0 MBytes 822 Mbits/sec 0 2.62 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 1.08 GBytes 928 Mbits/sec 0 sender
[ 4] 0.00-10.00 sec 1.00 GBytes 859 Mbits/sec receiver
iperf Done.
服务器(100.73.10.38)上的结果是:
Accepted connection from 100.73.10.38, port 22468
[ 5] local 100.73.10.38 port 5201 connected to 100.73.10.38 port 22470
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 91.9 MBytes 771 Mbits/sec
[ 5] 1.00-2.00 sec 106 MBytes 893 Mbits/sec
[ 5] 2.00-3.00 sec 104 MBytes 873 Mbits/sec
[ 5] 3.00-4.00 sec 105 MBytes 881 Mbits/sec
[ 5] 4.00-5.00 sec 98.3 MBytes 825 Mbits/sec
[ 5] 5.00-6.00 sec 100 MBytes 842 Mbits/sec
[ 5] 6.00-7.00 sec 103 MBytes 863 Mbits/sec
[ 5] 7.00-8.00 sec 105 MBytes 879 Mbits/sec
[ 5] 8.00-9.00 sec 102 MBytes 852 Mbits/sec
[ 5] 9.00-10.00 sec 104 MBytes 870 Mbits/sec
[ 5] 10.00-10.06 sec 4.91 MBytes 729 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.06 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.06 sec 1.00 GBytes 854 Mbits/sec receiver
机器网络iperf3 -s
在 100.73.10.38(k8snode2) 上 执行
[hanweisen@k8snode2 ~]$ iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
iperf3 -c 100.73.10.38 -b 1600M -i 1 -t 10 -l 300
然后在100.73.10.37(k8snode1)上执行
[hanweisen@k8snode1 ~]$ iperf3 -c 100.73.10.38 -b 1600M -i 1 -t 10 -l 300
Connecting to host 100.73.10.38, port 5201
[ 4] local 100.73.10.37 port 37542 connected to 100.73.10.38 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 67.1 MBytes 563 Mbits/sec 0 42.4 KBytes
[ 4] 1.00-2.00 sec 70.0 MBytes 587 Mbits/sec 2 63.6 KBytes
[ 4] 2.00-3.00 sec 70.3 MBytes 590 Mbits/sec 0 69.3 KBytes
[ 4] 3.00-4.00 sec 69.2 MBytes 581 Mbits/sec 0 73.5 KBytes
[ 4] 4.00-5.00 sec 69.3 MBytes 582 Mbits/sec 0 73.5 KBytes
[ 4] 5.00-6.00 sec 69.5 MBytes 583 Mbits/sec 6 73.5 KBytes
[ 4] 6.00-7.00 sec 69.0 MBytes 579 Mbits/sec 2 73.5 KBytes
[ 4] 7.00-8.00 sec 68.0 MBytes 570 Mbits/sec 0 73.5 KBytes
[ 4] 8.00-9.00 sec 68.7 MBytes 576 Mbits/sec 0 73.5 KBytes
[ 4] 9.00-10.00 sec 70.0 MBytes 588 Mbits/sec 3 73.5 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 691 MBytes 580 Mbits/sec 13 sender
[ 4] 0.00-10.00 sec 686 MBytes 576 Mbits/sec receiver
iperf Done.
服务器(100.73.10.38)上的结果是:
Accepted connection from 100.73.10.37, port 37540
[ 5] local 100.73.10.38 port 5201 connected to 100.73.10.37 port 37542
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 62.1 MBytes 521 Mbits/sec
[ 5] 1.00-2.00 sec 63.1 MBytes 529 Mbits/sec
[ 5] 2.00-3.00 sec 73.6 MBytes 618 Mbits/sec
[ 5] 3.00-4.00 sec 74.1 MBytes 622 Mbits/sec
[ 5] 4.00-5.00 sec 52.5 MBytes 440 Mbits/sec
[ 5] 5.00-6.00 sec 79.0 MBytes 663 Mbits/sec
[ 5] 6.00-7.00 sec 74.1 MBytes 622 Mbits/sec
[ 5] 7.00-8.00 sec 57.3 MBytes 481 Mbits/sec
[ 5] 8.00-9.00 sec 68.7 MBytes 576 Mbits/sec
[ 5] 9.00-10.00 sec 78.5 MBytes 659 Mbits/sec
[ 5] 10.00-10.04 sec 3.22 MBytes 658 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.04 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.04 sec 686 MBytes 573 Mbits/sec receiver