我有一个mpirun版本的mpirun(Open MPI)1.8.7并使用Centos7操作集群。
要在节点之间设置防火墙配置,我需要知道MPI使用哪些端口?或者将特定端口范围设置为mpirun命令?
查看手册页,没有这样的选项。我尝试设置一些环境变量,但没有用。
答案 0 :(得分:3)
您可以在openmpi-mca-params.conf(来自该链接:)
中限制端口范围默认情况下,搜索两个文件(按顺序):
$HOME/.openmpi/mca-params.conf
:用户提供的值集具有最高优先级。
$prefix/etc/openmpi-mca-params.conf
:系统提供的一组值的优先级较低。
以下设置似乎与使用的端口相关:
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 9
和ompi_info --param oob tcp --level 9
。设置这些值应该允许您限制OpenMPI将尝试使用的端口范围。但我不太确定这会如何改善您的安全性?大多数攻击者都能找到任何开放端口范围?通常更重要的是,实际上是在监听这些端口,不是吗?最好将您的firwall移到群集之外,并确保哪些服务正在侦听开放端口。