Red Hat Training
A Red Hat training course is available for RHEL 8
9.9. nmstatectl を使用したネットワークボンディングの設定
Nmstate API を使用してネットワークボンディングを設定するには、nmstatectl
ユーティリティーを使用します。
たとえば、以下の手順では、以下の設定で NetworkManager にボンディングを作成します。
-
ボンドのネットワークインターフェイス:
enp1s0
およびenp7s0
-
モード:
active-backup
-
静的 IPv4 アドレス: サブネットマスクが
/24
の192.0.2.1
-
静的 IPv6 アドレス:
2001:db8:1::1
(/64
サブネットマスクあり) -
IPv4 デフォルトゲートウェイ:
192.0.2.254
-
IPv6 デフォルトゲートウェイ:
2001:db8:1::fffe
-
IPv4 DNS サーバー:
192.0.2.200
-
IPv6 DNS サーバー:
2001:db8:1::ffbb
-
DNS 検索ドメイン:
example.com
前提条件
- サーバーに、2 つ以上の物理ネットワークデバイスまたは仮想ネットワークデバイスがインストールされている。
- 物理または仮想のイーサネットデバイスをサーバーにインストールしてボンディングでポートとしてイーサネットデバイスを使用する。
-
ポート
一覧でインターフェイス名を設定し、対応するインターフェイスを定義して、ボンディングのポートとしてチーム、ブリッジ、または VLAN デバイスを使用する。 -
nmstate
パッケージがインストールされている。
手順
以下の内容を含む YAML ファイルを作成します (例:
~/create-bond.yml
)。--- interfaces: - name: bond0 type: bond 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 link-aggregation: mode: active-backup port: - enp1s0 - enp7s0 - name: enp1s0 type: ethernet state: up - name: enp7s0 type: ethernet state: up routes: config: - destination: 0.0.0.0/0 next-hop-address: 192.0.2.254 next-hop-interface: bond0 - destination: ::/0 next-hop-address: 2001:db8:1::fffe next-hop-interface: bond0 dns-resolver: config: search: - example.com server: - 192.0.2.200 - 2001:db8:1::ffbb
設定をシステムに適用します。
# nmstatectl apply ~/create-bond.yml
検証手順
デバイスおよび接続の状態を表示します。
# nmcli device status DEVICE TYPE STATE CONNECTION bond0 bond connected bond0
接続プロファイルのすべての設定を表示します。
# nmcli connection show bond0 connection.id: bond0 connection.uuid: 79cbc3bd-302e-4b1f-ad89-f12533b818ee connection.stable-id: -- connection.type: bond connection.interface-name: bond0 ...
接続設定を YAML 形式で表示します。
# nmstatectl show bond0
関連情報
-
nmstatectl(8)
の man ページ -
/usr/share/doc/nmstate/examples/
directory