V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lidongdong1222
V2EX  ›  Ubuntu

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

  •  
  •   lidongdong1222 · 2018-11-30 15:35:40 +08:00 · 3772 次点击
    这是一个创建于 2193 天前的主题,其中的信息可能已经有所发展或是发生改变。
    新安装的 ubuntu,测试上传速度的时候永远无法超过 4m,同样环境安装的 centos 测速可以达到 40m,大概是什么原因呢?
    第 1 条附言  ·  2018-11-30 18:00:31 +08:00
    只有上行有问题,下行可以达到 300+
    11 条回复    2018-12-02 03:38:46 +08:00
    LGA1150
        1
    LGA1150  
       2018-11-30 17:33:23 +08:00 via Android
    用什么工具测的? iperf3 ?
    liuxu
        2
    liuxu  
       2018-11-30 17:37:13 +08:00
    竟有如此怪异之事?我从 ubuntu12.04 用到现在 18.04 ,没见过
    iwtbauh
        3
    iwtbauh  
       2018-11-30 17:42:30 +08:00 via Android
    无线 or 有线?
    网卡型号?
    使用的驱动程序和版本?
    供应商固件版本?
    内核日志?
    liuxu
        4
    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
        5
    lidongdong1222  
    OP
       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
        6
    lidongdong1222  
    OP
       2018-11-30 17:59:37 +08:00
    @liuxu
    使用相同的节点,centos 里测速,wifi 下连接的笔记本测速上行都是 40,只有 ubuntu 里不到 5
    liuxu
        7
    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
        8
    lidongdong1222  
    OP
       2018-11-30 22:25:35 +08:00
    @liuxu

    手动更改了 UA,也不行
    oovveeaarr
        9
    oovveeaarr  
       2018-11-30 23:21:04 +08:00   ❤️ 1
    换 python2
    lidongdong1222
        10
    lidongdong1222  
    OP
       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
        11
    liuxu  
       2018-12-02 03:38:46 +08:00
    @oovveeaarr
    @lidongdong1222

    问题出在 python3 发送的 header 上

    https://www.v2ex.com/t/513463
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2706 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:10 · PVG 17:10 · LAX 01:10 · JFK 04:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.