27.3.6. nmstatectl を使用して IPoIB 接続を設定する
宣言型の Nmstate API を使用して、IP over InfiniBand (IPoIB) を設定できます。Nmstate を使用すると、結果が必ず設定ファイルと一致したものになります。一致しない場合は、変更がロールバックされます。
前提条件
- InfiniBand デバイスがサーバーにインストールされている。
- InfiniBand デバイスのカーネルモジュールがロードされている。
手順
次の内容を含む YAML ファイル (例:
~/create-IPoIB-profile.yml) を作成します。interfaces: - name: mlx5_ib0.8002 type: infiniband state: up ipv4: enabled: true address: - ip: 192.0.2.1 prefix-length: 24 dhcp: false ipv6: enabled: true address: - ip: 2001:db8:1::1 prefix-length: 64 autoconf: false dhcp: false infiniband: base-iface: "mlx5_ib0" mode: datagram pkey: "0x8002" routes: config: - destination: 0.0.0.0/0 next-hop-address: 192.0.2.254 next-hop-interface: mlx5_ib0.8002 - destination: ::/0 next-hop-address: 2001:db8:1::fffe next-hop-interface: mlx5_ib0.8002IPoIB 接続に以下が設定されました。
-
IPOIB デバイス名:
mlx5_ib0.8002 -
基本インターフェイス (親):
mlx5_ib0 -
InfiniBand パーティションキー:
0x8002 -
トランスポートモード:
datagram -
静的 IPv4 アドレス:
192.0.2.1(サブネットマスクが/24) -
静的 IPv6 アドレス:
2001:db8:1::1(サブネットマスクが/64) -
IPv4 デフォルトゲートウェイ:
192.0.2.254 -
IPv6 デフォルトゲートウェイ:
2001:db8:1::fffe
-
IPOIB デバイス名:
設定をシステムに適用します。
# nmstatectl apply ~/create-IPoIB-profile.yml
検証
mlx5_ib0.8002デバイスの IP 設定を表示します。# ip address show mlx5_ib0.8002 ... inet 192.0.2.1/24 brd 192.0.2.255 scope global noprefixroute ib0.8002 valid_lft forever preferred_lft forever inet6 2001:db8:1::1/64 scope link tentative noprefixroute valid_lft forever preferred_lft forevermlx5_ib0.8002デバイスのパーティションキー (P_Key) を表示します。# cat /sys/class/net/mlx5_ib0.8002/pkey 0x8002mlx5_ib0.8002デバイスのモードを表示します。# cat /sys/class/net/mlx5_ib0.8002/mode datagram