我有一个基于 KVM Linux 的虚拟机,因为主机的网络性能以 1GB/s 完美运行(在内部网络中),并且使用 iperf 工具显示网络在主机中完美运行,但客户机的网络性能很慢,因为 iperf 结果很奇怪,因为它不是 100MB/s 也不是 1GB/s,它的范围在 350 到 500MB/s 之间,最大值,这是使用 iperf 命令的结果(iperf -c servername -P 15)
[ ID] Interval Transfer Bandwidth
[ 17] 0.0-10.0 sec 68.6 MBytes 57.5 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.0 sec 18.6 MBytes 15.5 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 5] 0.0-10.0 sec 61.9 MBytes 51.9 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 11] 0.0-10.0 sec 16.0 MBytes 13.4 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 10] 0.0-10.0 sec 24.3 MBytes 20.4 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 15] 0.0-10.0 sec 20.2 MBytes 16.9 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 12] 0.0-10.0 sec 30.2 MBytes 25.3 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 36.2 MBytes 30.3 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 8] 0.0-10.0 sec 23.6 MBytes 19.8 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 9] 0.0-10.0 sec 24.2 MBytes 20.3 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 14] 0.0-10.0 sec 31.0 MBytes 25.9 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 7] 0.0-10.0 sec 16.6 MBytes 13.9 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 6] 0.0-10.0 sec 18.8 MBytes 15.7 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 13] 0.0-10.0 sec 13.3 MBytes 11.2 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 16] 0.0-10.0 sec 29.6 MBytes 24.8 Mbits/sec
[SUM] 0.0-10.0 sec 433 MBytes 363 Mbits/sec
我测试了不同的网络模型,最好的结果是使用 virtio 模型,有谁能帮我获得网络的全部性能并达到 1 GB/s
答案1
尝试停止 iptables 并再次运行测试,我已经看到错误配置的“mingle table”会对您的 kvm 客户机产生类似的影响。
/etc/init.d/iptables off