33.2. nmstatectl を使用した 802.1X ネットワーク認証による静的イーサネット接続の設定

nmstatectl ユーティリティーを使用して、Nmstate API を介して、802.1X ネットワーク認証によるイーサネット接続を設定します。Nmstate API は、設定を行った後、結果が設定ファイルと一致することを確認します。何らかの障害が発生した場合には、nmstatectl は自動的に変更をロールバックし、システムが不正な状態のままにならないようにします。

注記

nmstate ライブラリーは、TLS Extensible Authentication Protocol (EAP) 方式のみをサポートします。

前提条件

  • ネットワークは 802.1X ネットワーク認証をサポートしている。
  • 管理ノードは NetworkManager を使用している。
  • TLS 認証に必要な以下のファイルがクライアントにある。

    • クライアント鍵が保存されているのは /etc/pki/tls/private/client.key ファイルで、そのファイルは所有されており、root ユーザーのみが読み取り可能です。
    • クライアント証明書は /etc/pki/tls/certs/client.crt に保存されます。
    • 認証局 (CA) 証明書は、/etc/pki/tls/certs/ca.crt ファイルに保存されています。

手順

  1. 以下の内容を含む YAML ファイル (例: ~/create-ethernet-profile.yml) を作成します。

    ---
    interfaces:
    - name: enp1s0
      type: ethernet
      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
      802.1x:
        ca-cert: /etc/pki/tls/certs/ca.crt
        client-cert: /etc/pki/tls/certs/client.crt
        eap-methods:
          - tls
        identity: client.example.org
        private-key: /etc/pki/tls/private/client.key
        private-key-password: password
    routes:
      config:
      - destination: 0.0.0.0/0
        next-hop-address: 192.0.2.254
        next-hop-interface: enp1s0
      - destination: ::/0
        next-hop-address: 2001:db8:1::fffe
        next-hop-interface: enp1s0
    dns-resolver:
      config:
        search:
        - example.com
        server:
        - 192.0.2.200
        - 2001:db8:1::ffbb

    これらの設定では、次の設定を使用して enp1s0 デバイスのイーサネット接続プロファイルを定義します。

    • 静的 IPv4 アドレス: サブネットマスクが /24192.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
    • TLS EAP プロトコルを使用した 802.1X ネットワーク認証
  2. 設定をシステムに適用します。

    # nmstatectl apply ~/create-ethernet-profile.yml

検証

  • ネットワーク認証が必要なネットワーク上のリソースにアクセスします。