linux 测试网速

本文介绍了在Linux环境中如何使用`ethtool`和`speedtest-cli`命令来检查网络连接的速度和性能。首先,通过`ethtool`查看网卡的详细信息,包括速度和双工设置。然后,通过`wget`下载并运行`speedtest.py`脚本来进行实际的上传和下载速度测试,结果显示下载速度为64.44 Mbit/s,上传速度为89.58 Mbit/s。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

查看网络速度:

```shell

root@user:/tmp# ethtool enp8s0
Settings for enp8s0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: Symmetric
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: 100Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: on (auto)
    Supports Wake-on: pumbg
    Wake-on: g
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: yes
root@user:/tmp#

```

查看真实网速:

 ```shell

root@user:/tmp# wget https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
--2020-11-12 07:20:19--  https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.64.133, 151.101.192.133, 151.101.0.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.64.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 65018 (63K) [text/plain]
Saving to: ‘speedtest.py’

speedtest.py                                   100%[===================================================================================================>]  63.49K  72.2KB/s    in 0.9s    

2020-11-12 07:20:24 (72.2 KB/s) - ‘speedtest.py’ saved [65018/65018]

root@user:/tmp# 
root@user:/tmp# python speedtest.py 
Retrieving speedtest.net configuration...
Testing from China Telecom (Group) (103.44.253.2)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by China Mobile HuNan 5G (ChangSha) [735.40 km]: 48.173 ms
Testing download speed................................................................................
Download: 64.44 Mbit/s
Testing upload speed................................................................................................
Upload: 89.58 Mbit/s
root@user:/tmp#

```

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

唐墨123

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值