6
1

More than 1 year has passed since last update.

Raspberry Pi ( Ubuntu ) の Wifi を CUI から設定する

Last updated at Posted at 2021-11-14

概要

Raspberry Pi ( Ubuntu Server ) の Wifi を CUI から設定する方法
Ubuntu Serverをインストールすると、ディスクトップ環境が無く、WiFi設定も行われていない状態となります
その場合での方法になります
Ubuntu DesktopだとSettingアプリを起動すればGUIでのインストール時に設定画面が出てきますので、Ubuntu 21.10でも構わない方は、そちらがお勧めです

環境

・Ubuntu Server 21.04

WiFiの設定

WiFiの設定ファイル

/etc/netplan/50-cloud-init.yaml

設定の記載方法

vi が苦手なら nano を利用してください

$ sudo cp /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.org
$ sudo vi /etc/netplan/50-cloud-init.yaml

[SSID]  SSIDを記載します、[]は不要です
[PASSWD] パスワードを記載します、[]は不要です

# 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:
    ethernets:
        eth0:
            dhcp4: true
            optional: true
    version: 2
    wifis:
            wlan0:
                    dhcp4: true
                    optional: true
                    access-points:
                             [SSID]:
                                     password: "[PASS]"

設定を保存後、コマンド netplan で反映します

$ sudo netplan apply

WiFi接続状態の確認方法

コマンド wifi-status WiFi接続状態を確認できます

$ wifi-status
6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1