AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 901719
Accepted
Nate
Nate
Asked: 2018-03-15 18:56:24 +0800 CST2018-03-15 18:56:24 +0800 CST 2018-03-15 18:56:24 +0800 CST

未定义的 iperf3 端口?

  • 772

我正在尝试识别与 iperf3 UDP 会话相关的所有端口,并注意到 TCP 握手使用 iperf3 服务器上的未定义(?)端口。

有没有办法指定用于 iperf3 测试的所有端口?

说明示例:

在此示例中,我观察到使用的以下 IP 地址和端口:

  • [客户端] 10.0.1.20,端口 5222
  • [服务器] 10.0.1.89,端口 5205
  • [客户端] 10.0.1.20,端口 56039 ????

客户:

// iperf3 (v3.1.3) Client running on Ubuntu 16.04 IP address: 10.0.1.20, port 5222
$ iperf3 -c 10.0.1.89 -u -p 5205 --cport 5222 -B 10.0.1.20

服务器:

// iperf3 (v3.1.3) Server running on Ubuntu 16.04 IP address: 10.0.1.89, port 5205
$ iperf3 -s -p 5205
-----------------------------------------------------------
Server listening on 5205
-----------------------------------------------------------
Accepted connection from 10.0.1.20, port 56039
[  5] local 10.0.1.89 port 5205 connected to 10.0.1.20 port 5222
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
...

客户端上运行的wireshark 捕获也证实了这一点。

iperf
  • 2 2 个回答
  • 2303 Views

2 个回答

  • Voted
  1. Thomas
    2018-03-16T03:19:13+08:002018-03-16T03:19:13+08:00

    在iperf3 网站上有关于这种行为的描述。

    ...初始 TCP 连接用于交换测试参数,控制测试的开始和结束,以及交换测试结果。这有时被称为“控制连接”。实际测试数据通过单独的 TCP 连接发送,作为单独的 UDP 数据包流或作为独立的 SCTP 连接发送,具体取决于客户端指定的协议...

    查看man iperf3and 选项--cport,这似乎只影响数据流,而不影响控制连接,这是您标识为未定义端口的第三个端口。

    • 1
  2. Best Answer
    Arthur Gomes
    2018-03-17T11:50:13+08:002018-03-17T11:50:13+08:00

    不,无法通过命令行参数设置此客户端端口,也不能使用 iperf API。

    这至少适用于当前的 3.1 iperf 版本。查看源代码,可以找到负责建立初始 TCP 连接的函数:

    /* iperf_connect -- client to server connection function */
    int
    iperf_connect(struct iperf_test *test)
    {
    [...]
        /* Create and connect the control channel */
        if (test->ctrl_sck < 0)
            // Create the control channel using an ephemeral port
            test->ctrl_sck = netdial(test->settings->domain, Ptcp, test->bind_address, 0, test->server_hostname, test->server_port, test->settings->connect_timeout);
    
        if (test->ctrl_sck < 0) {
            i_errno = IECONNECT;
            return -1;
        }
    [...]
    

    查看netdial()函数签名,它负责创建与服务器的连接:

    netdial(int domain, int proto, char *local, int local_port, char *server, int port, int timeout)
    

    更具体地说,我们可以看到它将netdial() local_port 参数设置为0. 这应该在创建 TCP 控制通道时为客户端建立一个随机端口。

    正如 Thomas 所提到的,该--cport选项将仅控制数据流端口,我们还可以查看负责建立 UDP 数据流的函数的源代码:

     if ((s = netdial(test->settings->domain, Pudp, test->bind_address, test->bind_port, test->server_hostname, test->server_port, -1)) < 0) 
    

    该函数使用test->bind_port选项作为local_port参数,从--cport选项中检索。

    • 1

相关问题

  • iperf3 错误 - 无法创建新流:权限被拒绝

  • 运行 UDP 测试时 Iperf3 一直挂起

  • 在 Docker 中运行 nuttcp 时出现分段错误

  • 衡量覆盖网络性能的正确方法

  • 为 win32 预编译的 Iperf 2.x 二进制文件?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve