『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

相关文章

Nginx设置连接超时并进行测试的方法步骤

《Nginx设置连接超时并进行测试的方法步骤》在高并发场景下,如果客户端与服务器的连接长时间未响应,会占用大量的系统资源,影响其他正常请求的处理效率,为了解决这个问题,可以通过设置Nginx的连接... 目录设置连接超时目的操作步骤测试连接超时测试方法:总结:设置连接超时目的设置客户端与服务器之间的连接

ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法

《ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法》本文介绍了Elasticsearch的基本概念,包括文档和字段、索引和映射,还详细描述了如何通过Docker... 目录1、ElasticSearch概念2、ElasticSearch、Kibana和IK分词器部署

部署Vue项目到服务器后404错误的原因及解决方案

《部署Vue项目到服务器后404错误的原因及解决方案》文章介绍了Vue项目部署步骤以及404错误的解决方案,部署步骤包括构建项目、上传文件、配置Web服务器、重启Nginx和访问域名,404错误通常是... 目录一、vue项目部署步骤二、404错误原因及解决方案错误场景原因分析解决方案一、Vue项目部署步骤

Linux流媒体服务器部署流程

《Linux流媒体服务器部署流程》文章详细介绍了流媒体服务器的部署步骤,包括更新系统、安装依赖组件、编译安装Nginx和RTMP模块、配置Nginx和FFmpeg,以及测试流媒体服务器的搭建... 目录流媒体服务器部署部署安装1.更新系统2.安装依赖组件3.解压4.编译安装(添加RTMP和openssl模块

SQL 中多表查询的常见连接方式详解

《SQL中多表查询的常见连接方式详解》本文介绍SQL中多表查询的常见连接方式,包括内连接(INNERJOIN)、左连接(LEFTJOIN)、右连接(RIGHTJOIN)、全外连接(FULLOUTER... 目录一、连接类型图表(ASCII 形式)二、前置代码(创建示例表)三、连接方式代码示例1. 内连接(I

JavaWeb-WebSocket浏览器服务器双向通信方式

《JavaWeb-WebSocket浏览器服务器双向通信方式》文章介绍了WebSocket协议的工作原理和应用场景,包括与HTTP的对比,接着,详细介绍了如何在Java中使用WebSocket,包括配... 目录一、概述二、入门2.1 POM依赖2.2 编写配置类2.3 编写WebSocket服务2.4 浏

java如何通过Kerberos认证方式连接hive

《java如何通过Kerberos认证方式连接hive》该文主要介绍了如何在数据源管理功能中适配不同数据源(如MySQL、PostgreSQL和Hive),特别是如何在SpringBoot3框架下通过... 目录Java实现Kerberos认证主要方法依赖示例续期连接hive遇到的问题分析解决方式扩展思考总

查询SQL Server数据库服务器IP地址的多种有效方法

《查询SQLServer数据库服务器IP地址的多种有效方法》作为数据库管理员或开发人员,了解如何查询SQLServer数据库服务器的IP地址是一项重要技能,本文将介绍几种简单而有效的方法,帮助你轻松... 目录使用T-SQL查询方法1:使用系统函数方法2:使用系统视图使用SQL Server Configu

Python中连接不同数据库的方法总结

《Python中连接不同数据库的方法总结》在数据驱动的现代应用开发中,Python凭借其丰富的库和强大的生态系统,成为连接各种数据库的理想编程语言,下面我们就来看看如何使用Python实现连接常用的几... 目录一、连接mysql数据库二、连接PostgreSQL数据库三、连接SQLite数据库四、连接Mo

oracle如何连接登陆SYS账号

《oracle如何连接登陆SYS账号》在Navicat12中连接Oracle11g的SYS用户时,如果设置了新密码但连接失败,可能是因为需要以SYSDBA或SYSOPER角色连接,解决方法是确保在连接... 目录oracle连接登陆NmOtMSYS账号工具问题解决SYS用户总结oracle连接登陆SYS账号