ふと思い立って押し入れに眠っていたラズパイ3にUbuntu Serverでも入れてみようと思い立ったものの、WiFi接続の方法やIPの固定の仕方が分からなかったので備忘録として残しておきます。
Ubuntu Server 22.04のインストールに関しては、公式からダウンロードできるRaspberry Pi Imagerを用いてインストールするのが一番良いかと思います。
WiFi接続&IP固定
WiFiの接続設定とIPの固定は同じ設定ファイル上で行います。
編集するファイル
/etc/netplan/50-cloud-init.yaml
設定内容
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    wifis:
        renderer: networkd
        wlan0: # Wifiの設定
            access-points:
                "接続したいSSID":
                    password: "パスワード"
            addresses: 
                - 192.168.1.10/24 # 固定したいIP
            routes:
               - to: default
                 via: 192.168.1.1 # デフォルトゲートウェイ
            nameservers:
                addresses:
                    - 192.168.1.1 # DNS
            dhcp4: false # IP固定したいのでDHCPは無効にする
            optional: true以上の設定をしたら以下のコマンドでチェックする。
sudo netplan try以下の表示が出るので問題なければEnterを押して設定を反映する。
Do you want to keep these settings?
Press ENTER before the timeout to accept the new configuration
Changes will revert in 117 seconds以上でWiFiへの接続とIP固定は完了です。