在一系列端口上将 MPI 设置为 运行

Set MPI to run on a range of ports

我有 mpirun (Open MPI) 1.8.7 的 mpirun 版本,并使用 Centos7 操作的集群。

要在节点之间设置我的防火墙配置,我需要知道 MPI 使用哪些端口?或者将特定端口范围设置为 mpirun 命令?

查看手册页,没有这个选项。我尝试设置了一些环境变量,但没有成功。

您可以在 openmpi-mca-params.conf 中限制端口范围(来自 link:)

By default, two files are searched (in order):

$HOME/.openmpi/mca-params.conf: The user-supplied set of values takes the highest precedence.

$prefix/etc/openmpi-mca-params.conf: The system-supplied set of values has a lower precedence.

以下设置似乎与使用的端口相关:

         MCA btl: parameter "btl_tcp_port_min_v4" (current value:
                  "1024", data source: default, level: 2 user/detail,
                  type: int)
                  The minimum port where the TCP BTL will try to bind
                  (default 1024)
         MCA btl: parameter "btl_tcp_port_range_v4" (current value:
                  "64511", data source: default, level: 2
                  user/detail, type: int)
                  The number of ports where the TCP BTL will try to
                  bind (default 64511). This parameter together with
                  the port min, define a range of ports where Open
                  MPI will open sockets.

         MCA oob: parameter "oob_tcp_static_ipv4_ports" (current
                  value: "", data source: default, level: 9 dev/all,
                  type: string)
                  Static ports for daemons and procs (IPv4)
         MCA oob: parameter "oob_tcp_dynamic_ipv4_ports" (current
                  value: "", data source: default, level: 9 dev/all,
                  type: string)
                  Range of ports to be dynamically used by daemons
                  and procs (IPv4)

参见 ompi_info --param btl tcp --level 9ompi_info --param oob tcp --level 9。设置这些值应该允许您限制 OpenMPI 将尝试使用的端口范围。但我不太确定这将如何提高您的安全性?大多数攻击者能够找到任何开放的端口范围吗?通常更重要的是,实际监听这些端口的是什么,不是吗?最好将防火墙移到集群之外,并确保哪些服务正在侦听开放端口。