V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
whyorwhynot
V2EX  ›  宽带症候群

openvpn 聚合 iperf3 测速正常,但是 speedtest-cli 依旧很慢

  •  
  •   whyorwhynot · 2020-09-29 13:06:28 +08:00 · 3228 次点击
    这是一个创建于 1521 天前的主题,其中的信息可能已经有所发展或是发生改变。

    因为出国线路拥堵,用 openvpn 单线转发性能捉急,楼主调研发现了 openvpn bonding 这个玩意,可以做到多线程多链路转发。

    在参考了 github 上 onemarcfifty/openvpn-bonding 这个项目后也算折腾起来了,使用 bond 模式 0 和 2 都可以做到网络提速,通过 iperf3 和服务端连接多线程测速,可以达到 50 多 mbps 的下行速度,可是用 speedtest 进行测速就只有 4mbps 。

    有热心的 v2er 知道原因吗。。。 help

    本地上传测速 iperf3 -c 10.100.0.254 -P8

    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-10.00  sec  3.95 MBytes  3.31 Mbits/sec  169             sender
    [  5]   0.00-10.00  sec  3.15 MBytes  2.64 Mbits/sec                  receiver
    [  7]   0.00-10.00  sec  4.47 MBytes  3.75 Mbits/sec  171             sender
    [  7]   0.00-10.00  sec  3.52 MBytes  2.95 Mbits/sec                  receiver
    [  9]   0.00-10.00  sec  10.6 MBytes  8.91 Mbits/sec  377             sender
    [  9]   0.00-10.00  sec  9.03 MBytes  7.58 Mbits/sec                  receiver
    [ 11]   0.00-10.00  sec  7.89 MBytes  6.62 Mbits/sec  453             sender
    [ 11]   0.00-10.00  sec  5.93 MBytes  4.97 Mbits/sec                  receiver
    [ 13]   0.00-10.00  sec  7.93 MBytes  6.65 Mbits/sec  356             sender
    [ 13]   0.00-10.00  sec  6.91 MBytes  5.80 Mbits/sec                  receiver
    [ 15]   0.00-10.00  sec  9.75 MBytes  8.18 Mbits/sec  226             sender
    [ 15]   0.00-10.00  sec  8.24 MBytes  6.91 Mbits/sec                  receiver
    [ 17]   0.00-10.00  sec  7.96 MBytes  6.67 Mbits/sec  224             sender
    [ 17]   0.00-10.00  sec  7.02 MBytes  5.89 Mbits/sec                  receiver
    [ 19]   0.00-10.00  sec  11.1 MBytes  9.33 Mbits/sec  462             sender
    [ 19]   0.00-10.00  sec  10.4 MBytes  8.70 Mbits/sec                  receiver
    [SUM]   0.00-10.00  sec  63.7 MBytes  53.4 Mbits/sec  2438             sender
    [SUM]   0.00-10.00  sec  54.2 MBytes  45.4 Mbits/sec                  receiver
    

    本地下载测速 iperf3 -c 10.100.0.254 -P8 -R

    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-10.00  sec  8.72 MBytes  7.31 Mbits/sec  246             sender
    [  5]   0.00-10.00  sec  7.97 MBytes  6.68 Mbits/sec                  receiver
    [  7]   0.00-10.00  sec  8.95 MBytes  7.50 Mbits/sec  150             sender
    [  7]   0.00-10.00  sec  8.35 MBytes  7.01 Mbits/sec                  receiver
    [  9]   0.00-10.00  sec  9.33 MBytes  7.83 Mbits/sec  110             sender
    [  9]   0.00-10.00  sec  8.76 MBytes  7.35 Mbits/sec                  receiver
    [ 11]   0.00-10.00  sec  9.44 MBytes  7.92 Mbits/sec  138             sender
    [ 11]   0.00-10.00  sec  8.83 MBytes  7.40 Mbits/sec                  receiver
    [ 13]   0.00-10.00  sec  8.62 MBytes  7.23 Mbits/sec  165             sender
    [ 13]   0.00-10.00  sec  8.00 MBytes  6.71 Mbits/sec                  receiver
    [ 15]   0.00-10.00  sec  9.82 MBytes  8.24 Mbits/sec  137             sender
    [ 15]   0.00-10.00  sec  9.20 MBytes  7.72 Mbits/sec                  receiver
    [ 17]   0.00-10.00  sec  8.98 MBytes  7.53 Mbits/sec  186             sender
    [ 17]   0.00-10.00  sec  8.31 MBytes  6.97 Mbits/sec                  receiver
    [ 19]   0.00-10.00  sec  8.35 MBytes  7.00 Mbits/sec  131             sender
    [ 19]   0.00-10.00  sec  7.84 MBytes  6.57 Mbits/sec                  receiver
    [SUM]   0.00-10.00  sec  72.2 MBytes  60.6 Mbits/sec  1263             sender
    [SUM]   0.00-10.00  sec  67.3 MBytes  56.4 Mbits/sec                  receiver
    

    本地下载单线程测速 iperf3 -c 10.100.0.254 -R

    Connecting to host 10.100.0.254, port 5201
    Reverse mode, remote host 10.100.0.254 is sending
    [  5] local 10.100.0.253 port 50882 connected to 10.100.0.254 port 5201
    [ ID] Interval           Transfer     Bitrate
    [  5]   0.00-1.00   sec   141 KBytes  1.16 Mbits/sec                  
    [  5]   1.00-2.00   sec   374 KBytes  3.06 Mbits/sec                  
    [  5]   2.00-3.00   sec   912 KBytes  7.47 Mbits/sec                  
    [  5]   3.00-4.00   sec  1.22 MBytes  10.2 Mbits/sec                  
    [  5]   4.00-5.00   sec  1.42 MBytes  12.0 Mbits/sec                  
    [  5]   5.00-6.00   sec  1.60 MBytes  13.4 Mbits/sec                  
    [  5]   6.00-7.00   sec  1.81 MBytes  15.2 Mbits/sec                  
    [  5]   7.00-8.00   sec  1.78 MBytes  14.9 Mbits/sec                  
    [  5]   8.00-9.00   sec  1.80 MBytes  15.1 Mbits/sec                  
    [  5]   9.00-10.00  sec  1.69 MBytes  14.2 Mbits/sec                  
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-10.00  sec  13.6 MBytes  11.4 Mbits/sec   30             sender
    [  5]   0.00-10.00  sec  12.7 MBytes  10.7 Mbits/sec                  receiver
    

    客户端 bond 配置

    一共 8 个 tap,单个 tap 显示 10Mbps,但查询了一些论坛,有些人表示被限速到 10mbps 但有些人说只是展示问题
    Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
    
    Bonding Mode: load balancing (round-robin)
    MII Status: up
    MII Polling Interval (ms): 0
    Up Delay (ms): 0
    Down Delay (ms): 0
    Peer Notification Delay (ms): 0
    
    Slave Interface: tap1
    MII Status: up
    Speed: 10 Mbps
    Duplex: full
    Link Failure Count: 0
    Permanent HW addr: f6:8b:a1:db:0a:c9
    Slave queue ID: 0
    
    Slave Interface: tap2
    MII Status: up
    Speed: 10 Mbps
    Duplex: full
    Link Failure Count: 0
    Permanent HW addr: 92:99:a7:28:58:ac
    Slave queue ID: 0
    
    Slave Interface: tap3
    MII Status: up
    Speed: 10 Mbps
    Duplex: full
    Link Failure Count: 0
    Permanent HW addr: 9e:8b:2f:83:42:a8
    Slave queue ID: 0
    

    本地路由配置

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         _gateway        0.0.0.0         UG    1      0        0 bond0
    10.100.0.0      0.0.0.0         255.255.255.0   U     0      0        0 bond0
    link-local      0.0.0.0         255.255.0.0     U     1000   0        0 ens33
    172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
    192.168.122.0   0.0.0.0         255.255.255.0   U     100    0        0 ens33
    

    speedtest-cli 测速

    这个命令行测速工具应该是多线程测速,通过浏览器访问 speedtest 也是这个速度
    Retrieving speedtest.net configuration...
    Testing from FranTech Solutions (x.x.x.x)...
    Retrieving speedtest.net server list...
    Selecting best server based on ping...
    Hosted by Razzolink Inc (San Jose, CA) [0.45 km]: 305.063 ms
    Testing download speed................................................................................
    Download: 4.37 Mbit/s
    Testing upload speed..................................................................................
    Upload: 3.08 Mbit/s
    
    13 条回复    2020-10-15 10:52:45 +08:00
    tia
        1
    tia  
       2020-09-29 13:44:41 +08:00
    测国内节点
    whyorwhynot
        2
    whyorwhynot  
    OP
       2020-09-29 14:15:19 +08:00
    @tia 通过 vpn 测 speedtest 国内节点?选择了一个靠近本地的节点,浙江宁波移动, 延迟 440ms Download 2.25Mbps,Upload 1.41 Mbps
    huangya
        3
    huangya  
       2020-09-29 19:14:43 +08:00
    你确定 speedtest-cli 是多线程测速? speedtest-cli -h 看看有没有更多的 option 可以打开更多的 log, 一般是-vv(两个 vv 看下详细的 log,或者用 tcpdump 抓下包看看)
    JimmyTinsley
        4
    JimmyTinsley  
       2020-09-29 19:38:05 +08:00
    试试 speedtest 官方的 cli https://www.speedtest.net/zh-Hans/apps/cli
    whyorwhynot
        5
    whyorwhynot  
    OP
       2020-09-29 21:11:43 +08:00
    @huangya 是多线程的,看了一下代码,默认 8 线程,有一个 single 参数可以修改为单线程测速,测出来是多线程速度的差不多 1/8 (0.52 Mbit/s)
    whyorwhynot
        6
    whyorwhynot  
    OP
       2020-09-29 21:26:14 +08:00
    @JimmyTinsley 官方的 speedtest 默认线程数比 speedtest-cli 少了一半,是 4 个连接,测出来 download 2.3mbps 。。
    dsnap5
        7
    dsnap5  
       2020-09-30 03:21:44 +08:00 via iPhone
    内网中转鸡场,IPLC 流量转发,哪个不比你折腾的这玩艺要强
    whyorwhynot
        8
    whyorwhynot  
    OP
       2020-09-30 08:29:45 +08:00
    @dsnap5 机场之类的也在用,流量有限,带宽给他们占满了也不好。折腾这个主要是因为用自己的 vps 可以无限流量,中转一下长期挂着 BT 下载,也有些图拉丁思想。这个 bonding 可能效果就是这么差吧。。。。逃
    harwck
        9
    harwck  
       2020-10-01 16:53:47 +08:00 via Android
    换成 speedtest-cli 仓库里的 speedtest-cli.py 即可解
    fvladlpa
        10
    fvladlpa  
       2020-10-02 14:04:37 +08:00
    @whyorwhynot 讲真,你这种如果不走一些特殊的优化的线路,跟着公网挤,用啥都一样的。
    luyunpsyduck
        11
    luyunpsyduck  
       2020-10-14 07:45:09 +08:00
    openvpn 的单线程性能瓶颈应该是在跑大流量,200mbps 以上一个核心的 CPU 占用会飙升到 90%之后回落,伴随传输掉速。
    如果你公网路线垃圾的话,多线程也救不了你。
    lin559671
        12
    lin559671  
       2020-10-14 23:48:12 +08:00 via Android
    是 openVPN udp ? udp 的话,换 wireguard 试试。tcp 的话,也可以试试 pptp bonding 。 公网线路差的话什么都救不了你。
    whyorwhynot
        13
    whyorwhynot  
    OP
       2020-10-15 10:52:45 +08:00
    @luyunpsyduck @lin559671 公网线路垃圾。其实这 bonding 的多个线路还是走的 cloudflare cdn 通过 v2ray 任意门转发出来的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5580 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 98ms · UTC 06:45 · PVG 14:45 · LAX 22:45 · JFK 01:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.