ubuntu 中测速永远无法超过 4m

2018-11-30 15:35:40 +08:00
 lidongdong1222
新安装的 ubuntu,测试上传速度的时候永远无法超过 4m,同样环境安装的 centos 测速可以达到 40m,大概是什么原因呢?
3788 次点击
所在节点    Ubuntu
11 条回复
LGA1150
2018-11-30 17:33:23 +08:00
用什么工具测的? iperf3 ?
liuxu
2018-11-30 17:37:13 +08:00
竟有如此怪异之事?我从 ubuntu12.04 用到现在 18.04 ,没见过
iwtbauh
2018-11-30 17:42:30 +08:00
无线 or 有线?
网卡型号?
使用的驱动程序和版本?
供应商固件版本?
内核日志?
liuxu
2018-11-30 17:55:31 +08:00
如果是用 speedtest 测试的话,是测试节点问题,不要迷信它们,最好自己搞个网盘实际测试一下

liuxu:~$ speedtest
Retrieving speedtest.net configuration...
Testing from China Unicom Beijing (114.249.28.210)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Beijing Broadband Network (Beijing) [1.67 km]: 4.419 ms
Testing download speed................................................................................
Download: 92.63 Mbit/s
Testing upload speed......................................................................................................
Upload: 3.93 Mbit/s

liuxu:~$ speedtest --server 5505
Retrieving speedtest.net configuration...
Testing from China Unicom Beijing (114.249.28.210)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by Beijing Broadband Network (Beijing) [1.67 km]: 5.469 ms
Testing download speed................................................................................
Download: 91.26 Mbit/s
Testing upload speed......................................................................................................
Upload: 4.02 Mbit/s

liuxu:~$ speedtest --server 17019
Retrieving speedtest.net configuration...
Testing from China Unicom Beijing (114.249.28.210)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by CoreLink, Inc. (Shanghai) [1074.57 km]: 28.922 ms
Testing download speed................................................................................
Download: 86.42 Mbit/s
Testing upload speed......................................................................................................
Upload: 12.03 Mbit/s

liuxu:~$ speedtest --server 17184
Retrieving speedtest.net configuration...
Testing from China Unicom Beijing (114.249.28.210)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by China Mobile,TianJin (Tianjin) [111.65 km]: 18.27 ms
Testing download speed................................................................................
Download: 81.23 Mbit/s
Testing upload speed......................................................................................................
Upload: 12.55 Mbit/s
lidongdong1222
2018-11-30 17:58:32 +08:00
@LGA1150 @iwtbauh @liuxu

用 speedtest-cli 测试的
esxi 里直接跟主路由分配的同一块网卡
没有开启防火墙,iptables 也没有配置任何东西

driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
expansion-rom-version:
bus-info: 0000:02:01.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

Settings for ens33:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
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: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: off (auto)
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
lidongdong1222
2018-11-30 17:59:37 +08:00
@liuxu
使用相同的节点,centos 里测速,wifi 下连接的笔记本测速上行都是 40,只有 ubuntu 里不到 5
liuxu
2018-11-30 18:35:18 +08:00
@lidongdong1222

用 --server 参数指定了相同节点?

说实话,这个锅 ubuntu 不好接,毕竟都是 python 的,唯一不同的就是 user-agent 了

def build_user_agent():
"""Build a Mozilla/5.0 compatible User-Agent string"""

ua_tuple = (
'Mozilla/5.0',
'(%s; U; %s; en-us)' % (platform.system(), platform.architecture()[0]),
'Python/%s' % platform.python_version(),
'(KHTML, like Gecko)',
'speedtest-cli/%s' % __version__
)
user_agent = ' '.join(ua_tuple)
printer('User-Agent: %s' % user_agent, debug=True)
return user_agent
lidongdong1222
2018-11-30 22:25:35 +08:00
@liuxu

手动更改了 UA,也不行
oovveeaarr
2018-11-30 23:21:04 +08:00
换 python2
lidongdong1222
2018-12-01 00:13:50 +08:00
@oovveeaarr

正解

root@ubuntu:~$ python2 /usr/lib/python3/dist-packages/speedtest.py --no-download
Retrieving speedtest.net configuration...
Testing from China Unicom Beijing (123.118.10.37)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Beijing Unicom (Beijing) [1.67 km]: 31.197 ms
Skipping download test
Testing upload speed................................................................................................
Upload: 42.66 Mbit/s

root@ubuntu:~$ python3 /usr/lib/python3/dist-packages/speedtest.py --no-download
Retrieving speedtest.net configuration...
Testing from China Unicom Beijing (123.118.10.37)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Beijing Unicom (Beijing) [1.67 km]: 4.88 ms
Skipping download test
Testing upload speed......................................................................................................
Upload: 1.66 Mbit/s
liuxu
2018-12-02 03:38:46 +08:00
@oovveeaarr
@lidongdong1222

问题出在 python3 发送的 header 上

https://www.v2ex.com/t/513463

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/513102

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX