网络测速工具
一、Speedtest测试外网网速
使用场景:Speedtest是用来测试网络性能的开源软件,在Linux下面安装Speedtest可以用来测试网络出口的上传和下载速度,帮助排查网络方面导致的故障。
官网:
Speendtest.net官网:Speedtest by Ookla - The Global Broadband Speed Test
windows直接点击网页测试即可。
1. 安装
1.1 github脚本安装
直接下载 夸克网盘分享
unzip speedtest-cli-master.zip
cd speedtest-cli-master/
python setup.py install
speedtest-cli -h
1.2 shell安装
直接下载文件:夸克网盘分享
unzip speedtest-cli-master.zip
cd speedtest-cli-master/
mv speedtest.py speedtest-cli chmod +x speedtest-cli ./speedtest-cli -h
1.3 pip安装
speedtest是用python写的,没使用过pip的需要先安装pip,
pip安装:This page has moved - pip documentation v25.1.1
#开启epel源
yum install python-pip –y
安装speedtest-cli
pip install speedtest-cli
安装完成测试
which speedtest-cli | bash

2. speedtest-cli使用
speedtest-cli --share 生成一张分享图片


#使用说明
speedtest-cli -h
usage: speedtest-cli [-h] [--no-download] [--no-upload] [--single] [--bytes]
[--share] [--simple] [--csv]
[--csv-delimiter CSV_DELIMITER] [--csv-header] [--json]
[--list] [--server SERVER] [--exclude EXCLUDE]
[--mini MINI] [--source SOURCE] [--timeout TIMEOUT]
[--secure] [--no-pre-allocate] [--version]
Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli
options:
-h, --help show this help message and exit
--no-download Do not perform download test
--no-upload Do not perform upload test
--single Only use a single connection instead of multiple. This
simulates a typical file transfer.
--bytes Display values in bytes instead of bits. Does not
affect the image generated by --share, nor output from
--json or --csv
--share Generate and provide a URL to the speedtest.net share
results image, not displayed with --csv
--simple Suppress verbose output, only show basic information
--csv Suppress verbose output, only show basic information
in CSV format. Speeds listed in bit/s and not affected
by --bytes
--csv-delimiter CSV_DELIMITER
Single character delimiter to use in CSV output.
Default ","
--csv-header Print CSV headers
--json Suppress verbose output, only show basic information
in JSON format. Speeds listed in bit/s and not
affected by --bytes
--list Display a list of speedtest.net servers sorted by
distance
--server SERVER Specify a server ID to test against. Can be supplied
multiple times
--exclude EXCLUDE Exclude a server from selection. Can be supplied
multiple times
--mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10
--secure Use HTTPS instead of HTTP when communicating with
speedtest.net operated servers
--no-pre-allocate Do not pre allocate upload data. Pre allocation is
enabled by default to improve upload performance. To
support systems with insufficient memory, use this
option to avoid a MemoryError
--version Show the version number and exit
二、iperf/iperf3测试服务器间网速(支持windows和linux)
iperf命令是一个网络性能测试工具。iperf可以测试TCP和UDP带宽质量。iperf可以测量最大TCP带宽,具有多种参数和UDP特性。iperf可以报告带宽,延迟抖动和数据包丢失。利用iperf这一特性,可以用来测试一些网络设备如路由器,防火墙,交换机等的性能。
Linux:
1.安装
1.1 下载程序包手工安装方式
下载地址:夸克网盘分享
rpm -ivh iperf3-3.1.3-1.fc24.i686.rpm(需要处理依赖)
1.2 用yum软件仓库安装
yum -y install epel-release
iperf安装:yum install iperf -y
iperf3 安装: yum install iperf3 -y
2.使用
参数说明:
-s 以server模式启动。#iperf -s
-c host以client模式启动。host是server端地址。#iperf -c serverip
通用参数:
-f [kmKM] 分别表示以Kbits, Mbits, KBytes, MBytes显示报告,默认以Mbits为单位,#iperf -c 192.168.100.6 -f K
-i sec 以秒为单位显示报告间隔,#iperf -c 192.168.100.6 -i 2
-l 缓冲区大小,默认是8KB,#iperf -c 192.168.100.6 -l 64
-m 显示tcp最大mtu值
-o 将报告和错误信息输出到文件#iperf -c 192.168.100.6 -o ciperflog.txt
-p 指定服务器端使用的端口或客户端所连接的端口#iperf -s -p 5001;iperf -c 192.168.100.55 -p 5001
-u 使用udp协议
-w 指定TCP窗口大小,默认是8KB
-B 绑定一个主机地址或接口(当主机有多个地址或接口时使用该参数)
-C 兼容旧版本(当server端和client端版本不一样时使用)
-M 设定TCP数据包的最大mtu值
-N 设定TCP不延时
-V 传输ipv6数据包
server专用参数:
-D 以服务方式运行。#iperf -s -D
-R 停止iperf服务。针对-D,#iperf -s -R
client端专用参数:
-d 同时进行双向传输测试
-n 指定传输的字节数,#iperf -c 192.168.100.6 -n 1024000
-r 单独进行双向传输测试
-t 测试时间,默认20秒,#iperf -c 192.168.100.6 -t 5
-F 指定需要传输的文件
-T 指定ttl值
UDP模式
服务器端:
iperf3 -u -s
客户端:
iperf3 -u -c 172.168.1.1 -b 100M -t 60
在udp模式下,以100Mbps为数据发送速率,客户端上传带宽测试,测试时间为60秒。
iperf3 -u -c 172.168.1.1 -b 5M -P 30 -t 60
客户端发起30个连接线程,以5Mbps为数据发送速率。
iperf3 -u -c 172.168.1.1 -b 100M -d -t 60
以100M为数据发送速率,进行上下行带宽测试。
TCP模式
服务器端:
iperf3 -s -p 5002 -d
客户端:
iperf3 -c 172.168.1.1 -t 60 -p 5002
在tcp模式下,客户端上传带宽测试,测试时间为60秒。
iperf3 -c 172.168.1.1 -P 30 -t 60 -p 5002
客户端发起30个连接线程。
iperf3 -c 172.168.1.1 -d -t 60 -p 5002
进行上下行带宽测试。
WINDOWS:
下载地址:夸克网盘分享
直接将解压出来的iperf3.exe和cygwin1.dll复制到%systemroot%目录即可,然后就可以在cmd中使用。
%SystemRoot% 系统目录,环境变量,可以直接在目录栏输入。
命令参数:


测试:
客户端:
iperf3 -c 10.211.55.6 -t 10 -p 5002 (可以直接连接linux的iperf3 server)

微信扫一扫关注该公众号
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)