Show Table of Contents
9.8. 使用命令行工具 nmcli 配置 IPoIB
首先确定是否需要重新命名默认的 IPoIB 设备,如果是,则请按照 第 9.3.3 节 “70-persistent-ipoib.rules 用法” 一节中的说明,使用 udev 重命名规则重新命名这些设备。用户可强制重命名 IPoIB 设备而无需重启,方法是删除
ib_ipoib
内核模块,然后按以下方法重新载入:
~]$rmmod ib_ipoib
~]$modprobe ib_ipoib
按要求重新命名设备后,请使用 nmcli 工具创建 IPoIB 接口,如下:
~]$nmcli con add type infiniband con-name mlx4_ib0 ifname mlx4_ib0 transport-mode connected mtu 65520
Connection 'mlx4_ib0' (8029a0d7-8b05-49ff-a826-2a6d722025cc) successfully added. ~]$nmcli con edit mlx4_ib0
===| nmcli interactive connection editor |=== Editing existing 'infiniband' connection: 'mlx4_ib0' Type 'help' or '?' for available commands. Type 'describe [>setting<.>prop<]' for detailed property description. You may edit the following settings: connection, infiniband, ipv4, ipv6 nmcli> set infiniband.mac-address 80:00:02:00:fe:80:00:00:00:00:00:00:f4:52:14:03:00:7b:cb:a3 nmcli> save Connection 'mlx4_ib3' (8029a0d7-8b05-49ff-a826-2a6d722025cc) successfully updated. nmcli> quit
此时已创建名为
mlx4_ib0
的 IPoIB 接口,并将其设定为连接模式,采用最大连接模式 MTU,在 IPv4
或 IPv6
中使用 DHCP
。如果为集群流量使用 IPoIB 接口,而为集群以外通讯使用以太网接口,则很可能需要按要求禁用 IPoIB 接口中的默认路由及所有默认名称服务器。
~]$ nmcli con edit mlx4_ib0
===| nmcli interactive connection editor |===
Editing existing 'infiniband' connection: 'mlx4_ib0'
Type 'help' or '?' for available commands.
Type 'describe [>setting<.>prop<]' for detailed property description.
You may edit the following settings: connection, infiniband, ipv4, ipv6
nmcli> set ipv4.ignore-auto-dns yes
nmcli> set ipv4.ignore-auto-routes yes
nmcli> set ipv4.never-default true
nmcli> set ipv6.ignore-auto-dns yes
nmcli> set ipv6.ignore-auto-routes yes
nmcli> set ipv6.never-default true
nmcli> save
Connection 'mlx4_ib0' (8029a0d7-8b05-49ff-a826-2a6d722025cc) successfully updated.
nmcli> quit
若需要
P_Key
接口,则请使用 nmcli 创建该接口,如下:
~]$nmcli con add type infiniband con-name mlx4_ib0.8002 ifname mlx4_ib0.8002 parent mlx4_ib0 p-key 0x8002
Connection 'mlx4_ib0.8002' (4a9f5509-7bd9-4e89-87e9-77751a1c54b4) successfully added. ~]$nmcli con modify mlx4_ib0.8002 infiniband.mtu 65520 infiniband.transport-mode connected ipv4.ignore-auto-dns yes ipv4.ignore-auto-routes yes ipv4.never-default true ipv6.ignore-auto-dns yes ipv6.ignore-auto-routes yes ipv6.never-default true