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

奇怪的 US-CN 跨国 iperf UDP 报文测试结果

  •  
  •   nbsn · 2021-05-29 01:04:02 +08:00 · 2374 次点击
    这是一个创建于 1035 天前的主题,其中的信息可能已经有所发展或是发生改变。
    重庆的电信线路,测试到 US BWG 一个主机(线路是:CN2 GIA-E ),不知道是不是网络的原因,UDP 报文发包测试始终没有速度。
    这个主机需要做一些物联网 udp 测试。百思不得其解。

    测试步骤:
    位于重庆的 IPERF-CLIENT,第一次测试 UDP 报文

    iperf3 -c IPERF-SERVER -p 12345 -b 10M -u

    Connecting to host IPERF-SERVER, port 12345
    [ 4] local 10.125.30.250 port 50136 connected to IPERF-SERVER port 12345
    [ ID] Interval Transfer Bandwidth Total Datagrams
    [ 4] 0.00-1.01 sec 1.10 MBytes 9.18 Mbits/sec 141
    [ 4] 1.01-2.01 sec 1.20 MBytes 10.0 Mbits/sec 153
    [ 4] 2.01-3.01 sec 1.19 MBytes 9.95 Mbits/sec 152
    [ 4] 3.01-4.00 sec 1.19 MBytes 10.0 Mbits/sec 152
    [ 4] 4.00-5.01 sec 1.19 MBytes 9.85 Mbits/sec 152
    [ 4] 5.01-6.01 sec 1.21 MBytes 10.2 Mbits/sec 155
    [ 4] 6.01-7.01 sec 1.19 MBytes 9.93 Mbits/sec 152
    [ 4] 7.01-8.01 sec 1.20 MBytes 10.1 Mbits/sec 153
    [ 4] 8.01-9.00 sec 1.18 MBytes 9.95 Mbits/sec 151
    [ 4] 9.00-10.00 sec 1.20 MBytes 10.0 Mbits/sec 153
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
    [ 4] 0.00-10.00 sec 11.8 MBytes 9.92 Mbits/sec 0.000 ms 0/0 (0%)
    [ 4] Sent 0 datagrams

    iperf Done.

    US 服务器端输出:
    [ 5] local IPERF-SERVER port 12345 connected to IPERF-CLIENT port 50136
    [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
    [ 5] 0.00-1.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 1.00-2.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 2.00-3.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 3.00-4.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 4.00-5.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 5.00-6.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 6.00-7.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 7.00-8.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 8.00-9.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 9.00-10.00 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    [ 5] 10.00-10.21 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
    [ 5] 0.00-10.21 sec 0.00 Bytes 0.00 bits/sec 0.000 ms 0/0 (0%)

    重庆这边换 TCP 报文:
    iperf3 -c IPERF-SERVER -p 12345 -b 10M

    Connecting to host IPERF-SERVER, port 12345
    [ 4] local IPERF-CLIENT port 13889 connected to IPERF-SERVER port 12345
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.00-1.01 sec 1.38 MBytes 11.4 Mbits/sec
    [ 4] 1.01-2.01 sec 1.25 MBytes 10.5 Mbits/sec
    [ 4] 2.01-3.00 sec 1.38 MBytes 11.6 Mbits/sec
    [ 4] 3.00-4.01 sec 1.25 MBytes 10.4 Mbits/sec
    [ 4] 4.01-5.01 sec 1.25 MBytes 10.5 Mbits/sec
    [ 4] 5.01-6.01 sec 1.50 MBytes 12.6 Mbits/sec
    [ 4] 6.01-7.01 sec 1.38 MBytes 11.6 Mbits/sec
    [ 4] 7.01-8.01 sec 1.25 MBytes 10.5 Mbits/sec
    [ 4] 8.01-9.00 sec 1.25 MBytes 10.5 Mbits/sec
    [ 4] 9.00-10.00 sec 1.50 MBytes 12.6 Mbits/sec
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.00-10.00 sec 13.4 MBytes 11.2 Mbits/sec sender
    [ 4] 0.00-10.00 sec 13.3 MBytes 11.2 Mbits/sec receiver

    iperf Done.

    US 服务器端输出:
    Accepted connection from IPERF-CLIENT, port 13885
    [ 5] local IPERF-SERVER port 12345 connected to IPERF-CLIENT port 13889
    [ ID] Interval Transfer Bandwidth
    [ 5] 0.00-1.00 sec 194 KBytes 1.59 Mbits/sec
    [ 5] 1.00-2.00 sec 2.02 MBytes 16.9 Mbits/sec
    [ 5] 2.00-3.00 sec 1.54 MBytes 12.9 Mbits/sec
    [ 5] 3.00-4.00 sec 1.25 MBytes 10.5 Mbits/sec
    [ 5] 4.00-5.00 sec 1.25 MBytes 10.5 Mbits/sec
    [ 5] 5.00-6.00 sec 1.50 MBytes 12.6 Mbits/sec
    [ 5] 6.00-7.00 sec 1.25 MBytes 10.5 Mbits/sec
    [ 5] 7.00-8.00 sec 1.38 MBytes 11.5 Mbits/sec
    [ 5] 8.00-9.00 sec 1.25 MBytes 10.5 Mbits/sec
    [ 5] 9.00-10.00 sec 1.41 MBytes 11.8 Mbits/sec
    [ 5] 10.00-10.18 sec 291 KBytes 13.6 Mbits/sec
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval Transfer Bandwidth
    [ 5] 0.00-10.18 sec 0.00 Bytes 0.00 bits/sec sender
    [ 5] 0.00-10.18 sec 13.3 MBytes 11.0 Mbits/sec receiver
    13 条回复    2021-05-31 22:32:55 +08:00
    smallthing
        1
    smallthing  
       2021-05-29 04:27:10 +08:00
    这有啥奇怪的。。。
    ryd994
        2
    ryd994  
       2021-05-29 07:03:31 +08:00   ❤️ 1
    因为 UDP 没有重传和流控
    服务端是 0 就是所有包全丢
    iperf3 测 UDP 需要注意一下报文大小 /MTU 。iperf 的默认是 8k,在很多机房的网络上都不管用。因为 ip fragment 没有端口信息,所以很难执行防火墙规则。要么放行要么丢弃。放行就有安全问题,所以一般丢弃。
    你可以试试使用 1kB 的报文
    zk8802
        3
    zk8802  
       2021-05-29 13:37:32 +08:00
    看看是不是 iperf3 版本的问题。曾经有的版本的 iperf3 因为 bug 的原因,会使得所有 UDP 包都显示为丢包。

    可以在服务器端抓一下包,看看 UDP 包到底有没有到。
    exdriver
        4
    exdriver  
       2021-05-29 14:17:58 +08:00 via iPhone
    有的小鸡 udp 测速会被黑洞的
    nbsn
        5
    nbsn  
    OP
       2021-05-30 01:00:47 +08:00
    @ryd994 谢谢提示。修改 MTU 后测试正常。iperf3 默认是有 MTU 的。当大于默认 MTU 后,报文会分片。TCP 有重传,就不会丢包,服务器能看到测试的速率。
    ryd994
        6
    ryd994  
       2021-05-30 03:34:42 +08:00 via Android
    @nbsn TCP 不是有重传,是握手时有 mss 协商。网关等设备可能会修改 mss 。

    还有,谢谢你的反馈。在论坛上问题解决后也留个结果给后人,这是好习惯。
    leavic
        7
    leavic  
       2021-05-30 09:15:34 +08:00
    因为发送端只看到自己发出去多少,接收端只看自己收到多少,而 udp 是无保障一定送达的,你发 10 包全丢也可能。
    bclerdx
        8
    bclerdx  
       2021-05-30 22:41:44 +08:00
    @ryd994 你说的 8K 是指 8KB MTU 巨型帧?
    bclerdx
        9
    bclerdx  
       2021-05-30 22:46:56 +08:00
    @ryd994 这里所说的网关设备是属于两端设备的中间设备吧?
    nbsn
        10
    nbsn  
    OP
       2021-05-31 15:08:41 +08:00
    @bclerdx 8K 是 iperf3 默认的 UDP 发送帧大小。通常不设定 MTU 的话,就会按照 8K 的默认值发包。
    bclerdx
        11
    bclerdx  
       2021-05-31 15:25:01 +08:00
    @nbsn 那么机房的设备,不支持 8KB 大小的帧?
    nbsn
        12
    nbsn  
    OP
       2021-05-31 22:18:50 +08:00
    @bclerdx 木桶原理,取决于路径经过的最小网络设备对数据报文大小的支持能力,叫 path mtu 。
    bclerdx
        13
    bclerdx  
       2021-05-31 22:32:55 +08:00
    @nbsn 现在还有运营商的路径中的某些设备没有配置 PMTU 或对 ICMP 限制做手脚,导致路径发现 PMTU 不能正常工作的嘛?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2797 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:54 · PVG 20:54 · LAX 05:54 · JFK 08:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.