LoginSignup
19
15

More than 3 years have passed since last update.

Ubuntu Server(Raspberry Pi)のWifi設定〜リモート接続

Last updated at Posted at 2020-07-05

1. Raspberry piにUbuntu Serverをインストールする。

割愛します。

2. 通信設定ファイルを編集する。

"SSID名"にはWifiのSSID名を入れ、右側は何もいらないらしい。

# ディレクトリの移動
$ cd /etc/netplan/

# 編集する
$ sudo vim 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:
    ethernets:
            eth0:
                    dhcp4: true
                    optional: true
    version: 2

# 自分の場合は以下を追加した
    wifis:
            wlan0:
                    optional: true
                    dhcp4: true
                    access-points:
                            "SSID名":
                                    password: "パスワード" # "SSID名"からのインデントなので注意

3. 通信設定のテスト/反映

下記がうまくいけば、特に何も出ない。

# こいつはエラーが出ても大丈夫
$ sudo netplan --debug try
# こいつにエラーがなければOK
$ sudo netplan --debug generate
$ sudo netplan --debug apply

# 念の為、再起動
$ sudo reboot

4. Macからリモート接続してみる

inet ~~の部分のIPアドレスを使用する

# Raspberry piのターミナル
$ ip a
1: lo: ~~
2: eth0:~~
3: wlan0:~~
    inet XXX.XXX.XXX.XXX/XX brd ~~~~~~
    ~~

自分の場合ホスト名がubuntuなので、IPアドレスを合わせてssh接続する。
ホストが表示され接続されればOK。

# Macのターミナル 
# $ ssh raspberrypiのホスト名@IPアドレス
$ ssh ubuntu@XXX.XXX.XXX.XXX

色々と情報は落ちているものの、細かいところがわからなかった為少し時間がかかってしまったので
忘備録として。

5. 参考URL

以上

19
15
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
19
15