『iperf3 』服务器连接速度测试(2023/02/16 最新版)

2024-03-27 13:50

本文主要是介绍『iperf3 』服务器连接速度测试(2023/02/16 最新版),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

  • 一、简介
    • 1.1 我的测速需求
    • 1.2 iperf
  • 二、安装iperf
    • 2.1 windows中下载与构建
    • 2.2 Ubuntu中下载与构建
  • 三、测速
    • 3.1 连接速度测试
    • 3.2 服务器网速测试

一、简介

1.1 我的测速需求

我目前有2个需求:

  1. 测试服务器的上传、下载速度;
  2. 测试与服务器的连接网速。

一般来说,服务器的带宽在购买服务器时就确定了(购买按流量计费的服务器除外),但额定带宽与实际带宽往往有一些出入。

而服务器与本地主机连接的带宽通常取决于两者中带宽较小的那个;但我有一个国外的服务器,连接的网速还与物理距离等多种因素有关。

第一个需求,可以使用speedtest等来实现,不是文章主要内容,放在文末吧。

1.2 iperf

iperf 是一种用于主动测量 IP 网络上可实现的最大带宽的工具。它支持调整与时序、协议和缓冲区相关的各种参数。对于每个测试,它都会报告测得的吞吐量/比特率、丢失和其他参数。最新版本称为iperf3

The iperf series of tools perform active measurements to determine the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, protocols, and buffers. For each test it reports the measured throughput, loss, and other parameters.

最新release版本是2023年2月发布的3.13。

github项目地址:https://github.com/esnet/iperf

官网:https://software.es.net/iperf/#
在这里插入图片描述

二、安装iperf

官网只有源码的压缩包,需要下载下来,自己构建,很简单的。

在测试的两台主机分别安装iperf即可。最好安装一样的版本,安装最新iperf3即可。

2.1 windows中下载与构建

在这个仓库下载windows版:https://github.com/ar51an/iperf3-win-builds/releases

下载完后,解压即可,不用安装。
在这里插入图片描述
当然你也可以下载源码,自己构建。

2.2 Ubuntu中下载与构建

(1)下载文件,是个压缩包

 wget  https://downloads.es.net/pub/iperf/iperf-3-current.tar.gz

(没有wget自己apt安装一下,压缩包不要可以删了)

(2)解压文件

按照这个命令格式来就行,不一样复制我的是吧,可能名称啥的不一样。

 tar -zxvf iperf-3-current.tar.gz

(3)进入解压后的文件夹

cd /root/iperf-3.13

(4)运行配置:

./configure

(5)编译

make

(6) 安装

make install

*(7) 删除不要的文件

 cd.. &&rm iperf-3-current.tar.gz && rm -r iperf-3.13

三、测速

3.1 连接速度测试

iperf使用tcp的5201端口,如果打开了防火墙,放行此端口就可以了。

root@cquptlei:~# ufw allow 5201/tcp
Rule added
Rule added (v6)

在服务器的管理后台也看一下,比如:腾讯云
在这里插入图片描述


测速过程为:

一个作为server,一个作为client。

  1. 服务器开始监听(ubuntu中直接运行下列命令):
iperf3 -s
  1. 本地主机连接测速(windows进入iperf文件目录下在使用下面命令,或者你把目录添加到环境变量也行)
iperf3 -c 服务器ip

一般来说,只能是服务器做server,因为本地电脑一般没有公网ip

示例1: 腾讯云服务器连接速度测试
服务器:

root@CQUPTLEI:~# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from x.x.x.x, port 1088
[  5] local 10.0.8.5 port 5201 connected to x.x.x.x port 1089
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  4.00 MBytes  33.6 Mbits/sec                  
[  5]   1.00-2.00   sec  5.25 MBytes  44.0 Mbits/sec                  
[  5]   2.00-3.00   sec  5.25 MBytes  44.0 Mbits/sec                  
[  5]   3.00-4.00   sec  2.18 MBytes  18.2 Mbits/sec                  
[  5]   4.00-5.00   sec  4.95 MBytes  41.5 Mbits/sec                  
[  5]   5.00-6.00   sec   990 KBytes  8.11 Mbits/sec                  
[  5]   6.00-7.00   sec  1.19 MBytes  9.94 Mbits/sec                  
[  5]   7.00-8.00   sec  1.64 MBytes  13.8 Mbits/sec                  
[  5]   8.00-9.00   sec  2.10 MBytes  17.6 Mbits/sec                  
[  5]   9.00-10.00  sec  2.53 MBytes  21.2 Mbits/sec                  
[  5]  10.00-10.04  sec   111 KBytes  24.5 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.04  sec  30.2 MBytes  25.2 Mbits/sec                  receiver

本地电脑:

D:\iperf>iperf3 -c x.x.x.x
Connecting to host x.x.x.x, port 5201
[  4] local x.x.x.x port 7057 connected to x.x.x.x port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  4.25 MBytes  35.6 Mbits/sec
[  4]   1.00-2.00   sec  5.25 MBytes  44.0 Mbits/sec
[  4]   2.00-3.00   sec  5.25 MBytes  44.1 Mbits/sec
[  4]   3.00-4.00   sec  2.12 MBytes  17.8 Mbits/sec
[  4]   4.00-5.00   sec  5.00 MBytes  42.0 Mbits/sec
[  4]   5.00-6.00   sec   896 KBytes  7.34 Mbits/sec
[  4]   6.00-7.00   sec  1.25 MBytes  10.5 Mbits/sec
[  4]   7.00-8.00   sec  1.62 MBytes  13.6 Mbits/sec
[  4]   8.00-9.00   sec  2.12 MBytes  17.8 Mbits/sec
[  4]   9.00-10.00  sec  2.50 MBytes  21.0 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.00  sec  30.2 MBytes  25.4 Mbits/sec                  sender
[  4]   0.00-10.00  sec  30.2 MBytes  25.3 Mbits/sec                  receiveriperf Done.

示例2: 美国服务器连接速度测试
在这里插入图片描述

可以看到连接速度很低(我的服务器带宽是1G),主要原因是延迟和bgp。

3.2 服务器网速测试

现在测试服务器本身的上传和下载速度。

比如美国的服务器,它本身的带宽很高,但是与我的电脑连接速度可能很慢,甚至被block。

使用speedtest测速即可。

官网:speedtest.net

安装命令行工具:

sudo apt-get install curl
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest

使用:

speedtest

或者列出最近的测试服务器:

speedtest -L

如:

Closest servers:ID  Name                           Location             Country
==============================================================================33893  Airlink Internet Inc           Los Angeles, CA      United States52470  Host Sailor Ltd                Los Angeles, CA      United States14236  Frontier                       Los Angeles, CA      United States12191  Nitel                          Los Angeles, CA      United States18401  Windstream                     Los Angeles, CA      United States17249  Wiline Networks                Los Angeles, CA      United States37498  Netprotect                     Los Angeles, CA      United States

然后指定测试服务器ip进行测试:

speedtest -s ID

在这里插入图片描述



~

这篇关于『iperf3 』服务器连接速度测试(2023/02/16 最新版)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/852329

相关文章

2024.6.24 IDEA中文乱码问题(服务器 控制台 TOMcat)实测已解决

1.问题产生原因: 1.文件编码不一致:如果文件的编码方式与IDEA设置的编码方式不一致,就会产生乱码。确保文件和IDEA使用相同的编码,通常是UTF-8。2.IDEA设置问题:检查IDEA的全局编码设置和项目编码设置是否正确。3.终端或控制台编码问题:如果你在终端或控制台看到乱码,可能是终端的编码设置问题。确保终端使用的是支持你的文件的编码方式。 2.解决方案: 1.File -> S

【Altium】查找PCB上未连接的网络

【更多软件使用问题请点击亿道电子官方网站】 1、文档目标: PCB设计后期检查中找出没有连接的网络 应用场景:PCB设计后期,需要检查是否所有网络都已连接布线。虽然未连接的网络会有飞线显示,但是由于布线后期整板布线密度较高,虚连,断连的网络用肉眼难以轻易发现。用DRC检查也可以找出未连接的网络,如果PCB中DRC问题较多,查找起来就不是很方便。使用PCB Filter面板来达成目的相比DRC

Java面试题:通过实例说明内连接、左外连接和右外连接的区别

在 SQL 中,连接(JOIN)用于在多个表之间组合行。最常用的连接类型是内连接(INNER JOIN)、左外连接(LEFT OUTER JOIN)和右外连接(RIGHT OUTER JOIN)。它们的主要区别在于它们如何处理表之间的匹配和不匹配行。下面是每种连接的详细说明和示例。 表示例 假设有两个表:Customers 和 Orders。 Customers CustomerIDCus

16.Spring前世今生与Spring编程思想

1.1.课程目标 1、通过对本章内容的学习,可以掌握Spring的基本架构及各子模块之间的依赖关系。 2、 了解Spring的发展历史,启发思维。 3、 对 Spring形成一个整体的认识,为之后的深入学习做铺垫。 4、 通过对本章内容的学习,可以了解Spring版本升级的规律,从而应用到自己的系统升级版本命名。 5、Spring编程思想总结。 1.2.内容定位 Spring使用经验

通过SSH隧道实现通过远程服务器上外网

搭建隧道 autossh -M 0 -f -D 1080 -C -N user1@remotehost##验证隧道是否生效,查看1080端口是否启动netstat -tuln | grep 1080## 测试ssh 隧道是否生效curl -x socks5h://127.0.0.1:1080 -I http://www.github.com 将autossh 设置为服务,隧道开机启动

【服务器运维】MySQL数据存储至数据盘

查看磁盘及分区 [root@MySQL tmp]# fdisk -lDisk /dev/sda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical)

【服务器运维】CentOS6 minimal 离线安装MySQL5.7

1.准备安装包(版本因人而异,所以下面的命令中版本省略,实际操作中用Tab自动补全就好了) cloog-ppl-0.15.7-1.2.el6.x86_64.rpmcpp-4.4.7-23.el6.x86_64.rpmgcc-4.4.7-23.el6.x86_64.rpmgcc-c++-4.4.7-23.el6.x86_64.rpmglibc-2.12-1.212.el6.x86_64.r

【服务器运维】CentOS7 minimal 离线安装 gcc perl vmware-tools

0. 本机在有网的情况下,下载CentOS镜像 https://www.centos.org/download/ 1. 取出rpm 有的情况可能不需要net-tools,但是如果出现跟ifconfig相关的错误,就把它安装上。另外如果不想升级内核版本的话,就找对应内核版本的rpm版本安装 perl-Time-Local-1.2300-2.el7.noarch.rpmperl-Tim

据阿谱尔APO Research调研显示,2023年全球髓内钉市场销售额约为4.7亿美元

根据阿谱尔 (APO Research)的统计及预测,2023年全球髓内钉市场销售额约为4.7亿美元,预计在2024-2030年预测期内将以超过3.82%的CAGR(年复合增长率)增长。 髓内钉市场是指涉及髓内钉制造、分销和销售的行业。髓内钉是一种用于整形外科手术的医疗器械,用于稳定长骨骨折,特别是股骨、胫骨和肱骨。髓内钉通常由不銹钢或钛等材料制成,并插入骨的髓管中,以在愈合过程中提供结构支

SQL Server中,always on服务器的相关操作

在SQL Server中,建立了always on服务,可用于数据库的同步备份,当数据库出现问题后,always on服务会自动切换主从服务器。 例如192.168.1.10为主服务器,12为从服务器,当主服务器出现问题后,always on自动将主服务器切换为12,保证数据库正常访问。 对于always on服务器有如下操作: 1、切换主从服务器:假如需要手动切换主从服务器时(如果两个服务