Raspberry Pi 用 Ubuntu Server 18.04.5 の Netplan 構成に関する問題

Raspberry Pi 用 Ubuntu Server 18.04.5 の Netplan 構成に関する問題

そこで、ロボットプロジェクトのためにRaspberry PiとUbuntuをセットアップしたい。このガイド

書かれているように、/etc/netplan/50-cloud-init.yaml を次のように変更します。

network:
version: 2
renderer: networkd
# Renderer can be 'networkd' or 'NetworkManager'
ethernets:
eth0:
optional: true
dhcp4: false
wifis:
wlan0:
optional: true
dhcp4: true
access-points:
"YOUR-SSID-NAME":
password: "YOUR-PASSWORD"
# uncomment the line below if you're using a Microsoft DHCP Server
#dhcp-identifier: mac

注: macOS システムを使用しているため、最後の行のコメントを解除しませんでしたが、それが正しいかどうかはわかりません。

問題は:

次のように入力すると:

sudo netplan --debug try

sudo netplan --debug generate

「不明なキーワード「wlan0」」が表示されます。

エラーを Google で検索してみましたが、Web ではさまざまな種類のエラーしか見つかりません。どなたか助けていただければ幸いです。

答え1

.yaml ファイルのフォーマットが適切ではありません...

次のようになります...インデント、間隔は同じで、タブはありません。

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: true
      optional: true
  wifis:
    wlan0:
      dhcp4: true
      access-points:
        "YOUR-SSID-NAME":
          password: "YOUR-PASSWORD"

sudo netplan generate

sudo netplan apply

reboot

wpasupplicant もインストールする必要があります...

sudo apt-get update

sudo apt-get install wpasupplicant

reboot

.yaml が上書きされ続ける場合は...

また、次の内容で /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg を作成する必要がある場合もあります。

network: {config: disabled}

関連情報