iwd

提供: ArchWiki
2021年3月13日 (土) 18:22時点におけるKusanaginoturugi (トーク | 投稿記録)による版 (→‎Select DNS manager: 訳出)
ナビゲーションに移動 検索に移動

関連記事

IWD (iNet wireless daemon) は Intel によって書かれた Linux 用の無線デーモンです。プロジェクトの中心的な目標は、外部ライブラリに依存せず、Linux カーネルが提供する機能を最大限に活用することにより、リソース使用率を最適化することです。

iwd はスタンドアロンでも動作しますが ConnMansystemd-networkdNetworkManager のような包括的なネットワークマネージャーとの組み合わせて使うこともできます。

インストール

iwd パッケージをインストールしてください。

使用方法

iwd パッケージにはクライアントプログラムの iwctl とデーモンの iwd、そして Wi-Fi 監視ツールの iwmon が含まれています。

iwd デーモンを実行したら (iwd.service起動有効化)、iwctl コマンドを使って制御することができます。

iwctl

対話型プロンプトを表示するには、次のようにします:

$ iwctl

対話型プロンプトは、プレフィックスが、[iwd]# と表示されます。

ヒント:
  • iwctl プロンプトで、Tab キーを押すとコマンドとデバイス名を補完できます。
  • 対話型プロンプトを終了するには、Ctrl+d を押して、 EOF を送信します。
  • 対話型プロンプトを使用せずに、すべてのコマンドをコマンドライン引数として使用できます。例:iwctl device wlan0 show

使用可能なすべてのコマンドの一覧を表示するには:

[iwd]# help

ネットワークに接続する

先ず、ワイヤレスデバイス名がわからない場合は、すべての Wi-Fiデバイスを一覧表示します:

[iwd]# device list

次に、ネットワークをスキャンします:

[iwd]# station device scan

利用可能なすべてのネットワークを一覧表示できます:

[iwd]# station device get-networks

最後に、ネットワークに接続するには:

[iwd]# station device connect SSID
ヒント: ユーザーインターフェイスはオートコンプリートをサポートしています。station と入力し、Tab Tab を押すと、使用可能なデバイスが表示され、デバイスの最初の文字を入力し、Tab を押して補完します。 同じように、connect を入力し Tab Tab と押すと、利用可能なネットワークのリストを表示します。次に、使用するネットワークの最初の文字を入力して、Tab キーを押して補完を完了します。

パスフレーズが必要な場合は、入力を求められます。コマンドライン引数として指定することもできます:

$ iwctl --passphrase passphrase station device connect SSID
ノート:
  • iwd はネットワークパスフレーズを /var/lib/iwd ディレクトリに自動的に保存し、将来的にそれらを使用して自動接続します。 #Network configuration を参照してください。
  • SSID にスペースが含まれるネットワークに接続するには、接続時にネットワーク名をダブルクオートで囲む必要があります。
  • iwd は、8〜63 文字の ASCII エンコード文字の PSK パスフレーズのみをサポートします。要件が満たされていない場合は次のエラーメッセージが表示されます: PMK generation failed. Ensure Crypto Engine is properly configured

WPS/WSC を使用してネットワークに接続する

ボタンを押してネットワークに接続できるように設定されている場合 (Wikipedia:ja:Wi-Fi Protected Setup) は、まず、ネットワークデバイスがこのセットアップ手順を使用できることを確認してください。

[iwd]# wsc list

次に、デバイスが上記のリストに表示されている場合、

[iwd]# wsc device push-button

それから、ルーターのボタンを押します。この手順は、2分以内にボタンを事前に押した場合にも機能します。

ネットワークがその方法で接続するために、PIN 番号を検証する必要がある場合は、help コマンド出力をチェックして、wsc コマンドに適切なオプションを提供する方法を確認してください。

ネットワークから切断する

ネットワークから切断するには:

[iwd]# station device disconnect

デバイスと接続情報を表示する

MAC アドレスなどの WiFi デバイスの詳細を表示するには:

[iwd]# device device show

WiFi デバイスの接続ネットワークを含む接続状態を表示するには:

[iwd]# station device show

既知のネットワークの管理

以前に接続したネットワークを一覧表示するには:

[iwd]# known-networks list

既知のネットワークを忘れるには:

[iwd]# known-networks SSID forget

ネットワーク設定

デフォルトでは、iwd はネットワーク設定を /var/lib/iwd ディレクトリに保存します。設定ファイルの名前は、network.type となります。network はネットワーク SSID で .type はネットワークタイプ(.open.wep.psk または .8021x)です。このファイルは暗号化された事前共有鍵と、オプションでクリアテキストのパスフレーズを保存するために使用され、ユーザー iwctl を呼び出さずに作成することもできます。このファイルは、そのネットワーク SSID に関連する他の設定にも使用できます。詳細な設定については、iwd.network(5) を参照してください。

WPA-PSK

SSID "spaceship" とパスフレーズ "test1234" を使用して WPA-PSK または WPA2-PSK で保護されたネットワークに接続するための最小限のサンプルファイル:

/var/lib/iwd/spaceship.psk
[Security]
PreSharedKey=aafb192ce2da24d8c7805c956136f45dd612103f086034c402ed266355297295
ノート: ネットワークの SSID は英数字のみまたは - _ のいずれかを含む場合のみファイル名として使用されます。他の文字が含まれている場合、名前は = 文字の後に16進数でエンコードされた SSID が代わりに使用されます。

パスフレーズから事前共有鍵を計算するには、次の二つの方法のいずれかを使用できます:

  • 設定ファイルにクリアテキストでパスフレーズを入力します:
/var/lib/iwd/spaceship.psk
[Security]
Passphrase=test1234

事前共有鍵は、最初の接続時にファイルに追加されます。

/var/lib/iwd/spaceship.psk
[Security]
Passphrase=test1234
PreSharedKey=aafb192ce2da24d8c7805c956136f45dd612103f086034c402ed266355297295

WPA Enterprise

EAP-PWD

EAP-PWD で保護されたエンタープライズアクセスポイントに接続するには /var/lib/iwd フォルダに以下の内容で essid.8021x という名前のファイルを作成する必要があります:

/var/lib/iwd/essid.8021x
[Security]
EAP-Method=PWD
EAP-Identity=your_enterprise_email
EAP-Password=your_password

[Settings]
AutoConnect=True

アクセスポイントに自動接続したくない場合、Autoconnect オプションを False に設定して iwctl で手動でアクセスポイントに接続してください。パスワードを平文で保存したくない場合は、ファイルからパスワードの設定を外してください。

EAP-PEAP

EAP-PWD と同様に、フォルダー内に essid.8021x を作成する必要があります。設定ファイルの作成に奨む前に、組織が使用している CA 証明証を確認する良い機会でもあります。MSCHAPv2 を機能させるには、ppp もインストールする必要があります。詳細については、MS-CHAPv2 を参照してください。これは MSCHAPv2 パスワード認証を使用する設定ファイルの例です:

/var/lib/iwd/essid.8021x
[Security]
EAP-Method=PEAP
EAP-Identity=anonymous@realm.edu
EAP-PEAP-CACert=/path/to/root.crt
EAP-PEAP-ServerDomainMask=radius.realm.edu
EAP-PEAP-Phase2-Method=MSCHAPV2
EAP-PEAP-Phase2-Identity=johndoe@realm.edu
EAP-PEAP-Phase2-Password=hunter2

[Settings]
AutoConnect=true
ヒント: eduroam の使用を計画している場合は、#Eduroam も参照してください。

TTLS-PAP

Like EAP-PWD, you also need to create a essid.8021x in the folder. Before you proceed to write the configuration file, this is also a good time to find out which CA certificate your organization uses. This is an example configuration file that uses PAP password authentication:

/var/lib/iwd/essid.8021x
[Security]
EAP-Method=TTLS
EAP-Identity=anonymous@uni-test.de
EAP-TTLS-CACert=cert.pem
EAP-TTLS-ServerDomainMask=*.uni-test.de
EAP-TTLS-Phase2-Method=Tunneled-PAP
EAP-TTLS-Phase2-Identity=user
EAP-TTLS-Phase2-Password=password

[Settings]
AutoConnect=true

Eduroam

Eduroam offers a configuration assistant tool (CAT), which unfortunately does not support iwd. However, the installer, which you can download by clicking on the download button then selecting your university, is just a Python script. It is easy to extract the necessary configuration options, including the certificate and server domain mask.

The following table contains a mapping of iwd configuration options to eduroam CAT install script variables.

Iwd Configuration Option CAT Script Variable
file name one of Config.ssids
EAP-Method Config.eap_outer
EAP-Identity Config.anonymous_identity
EAP-PEAP-CACert Config.CA
EAP-PEAP-ServerDomainMask one of Config.servers
EAP-PEAP-Phase2-Method Config.eap_inner
EAP-PEAP-Phase2-Identity username@Config.user_realm
ノート:
  • EAP-Identity may not be required by your Eduroam provider, in which case you can use anonymous in this field.
  • If your EAP-PEAP-ServerDomainMask starts with DNS:, use only the part after DNS:.

Other cases

More example tests can be found in the test cases of the upstream repository.

任意設定

メインの設定は /etc/iwd/main.conf ファイルで行います。

ネットワーク (SSID) の設定は /var/lib/iwd ディレクトリを使用します。

特定のネットワークで自動接続を無効化

/var/lib/iwd/network.type ファイルを作成・編集してください (network はネットワークの SSID に、type は "open", "wep", "psk", "8021x" のどれかのネットワークタイプに置き換えてください)。そしてファイルに以下のセクションを追加してください:

/var/lib/iwd/spaceship.psk
[Settings]
Autoconnect=false

利用可能なネットワークの定期スキャンを無効にする

デフォルトでは、 iwd は切断状態の場合、利用可能なネットワークを定期的にスキャンします。定期スキャンを無効にする(常に手動でスキャンする)には、/etc/iwd/main.conf ファイルを作成/編集し、以下のセクションを追加します:

/etc/iwd/main.conf
[Scan]
DisablePeriodicScan=true

内蔵ネットワーク設定の有効化

バージョン 0.19 以降、iwd は内蔵の DHCP クライアントまたは静的な設定を使用して、IPアドレスの割り当てとルートの設定を行うことができます。これは、スタンドアロン DHCP クライアントの良い代替手段です。

iwd のネットワーク設定機能を有効にするには、//etc/iwd/main.conf を作成・編集し、以下のセクションを追加します:

/etc/iwd/main.conf
[General]
EnableNetworkConfiguration=true

また、RoutePriorityOffset でルートメトリックを設定する機能もあります:

/etc/iwd/main.conf
[Network]
RoutePriorityOffset=300

IPv6 support

バージョン 1.10 以降、iwd は IPv6 をサポートしていますが、デフォルトでは無効になっています。IPv6 を有効にするには、設定ファイルに以下を追加します:

/etc/iwd/main.conf
[Network]
EnableIPv6=true

この設定は、DHCPv6 または 静的 IPv6 設定のどちらを使用する場合でも必要です。ネットワーク毎に設定することもできます。

ネットワーク構成での静的 IP アドレスの設定

次のセクションを /var/lib/iwd/network.type ファイルに追加します。例えば:

/var/lib/iwd/spaceship.psk
[IPv4]
Address=192.168.1.10
Netmask=255.255.255.0
Gateway=192.168.1.1
Broadcast=192.168.1.255
DNS=192.168.1.1

DNS マネージャーの選択

現在、iwd は systemd-resolvedresolvconf の二つの DNS マネージャーをサポートしています。

systemd-resolved の場合、次のセクションを /etc/iwd/main.conf に追加します:

/etc/iwd/main.conf
[Network]
NameResolvingService=systemd

resolvconf の場合:

/etc/iwd/main.conf
[Network]
NameResolvingService=resolvconf

コンソール (ローカル) ユーザーが設定を変えられないようにする

デフォルトでは iwd の D-Bus インターフェイスは (たとえユーザーが "root" でなくても) 誰でも iwd デーモンに接続して設定を変更できるようになっています。

コンソールユーザーが設定を編集できないようにしたい場合、以下のように D-Bus 設定ファイルを作成してください:

/etc/dbus-1/system.d/iwd-strict.conf
<!-- prevent local users from changing iwd settings, but allow
     reading status information. overrides some part of
     /usr/share/dbus-1/system.d/iwd-dbus.conf. -->

<!-- This configuration file specifies the required security policies
     for iNet Wireless Daemon to work. -->

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <policy at_console="true">
    <deny send_destination="net.connman.iwd"/>
    <allow send_destination="net.connman.iwd" send_interface="org.freedesktop.DBus.Properties" send_member="GetAll" />
    <allow send_destination="net.connman.iwd" send_interface="org.freedesktop.DBus.Properties" send_member="Get" />
    <allow send_destination="net.connman.iwd" send_interface="org.freedesktop.DBus.ObjectManager" send_member="GetManagedObjects" />
    <allow send_destination="net.connman.iwd" send_interface="net.connman.iwd.Device" send_member="RegisterSignalLevelAgent" />
    <allow send_destination="net.connman.iwd" send_interface="net.connman.iwd.Device" send_member="UnregisterSignalLevelAgent" />
  </policy>

</busconfig>
ヒント: <allow> 行を削除するとネットワークの状態を読み出すこともできなくなります。

Troubleshooting

Verbose TLS debugging

This can be useful, if you have trouble setting up MSCHAPv2 or TTLS. You can set the following environment variable via a drop-in snippet:

/etc/systemd/system/iwd.service.d/tls-debug.conf
[Service]
Environment=IWD_TLS_DEBUG=TRUE

Check the iwd logs afterwards via journalctl -u iwd.service

Connect issues after reboot

A low entropy pool can cause connection problems in particular noticeable after reboot. See Random number generation for suggestions to increase the entropy pool.

Wireless device is not renamed by udev

Since version 1.0, iwd disables predictable renaming of wireless device. It installs the following systemd network link configuration file which prevents udev from renaming the interface to wlp#s#:

/usr/lib/systemd/network/80-iwd.link
[Match]
Type=wlan

[Link]
NamePolicy=keep kernel

As a result the wireless link name wlan# is kept after boot. This resolved a race condition between iwd and udev on interface renaming as explained in iwd udev interface renaming.

If this results in issues try masking it with:

# ln -s /dev/null /etc/systemd/network/80-iwd.link

参照