Linux
Ubuntu
0

Ubuntu Server 18.04 LTSの無線LAN接続

Ubuntu 18.04ではネット接続の設定には"Netplan"を利用する.
従来のバージョンで利用してきた"/etc/network/interfaces"を開いてみると以下のように記載されていた.

/etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown

Netplanの設定

デフォルトでは"/etc/netplan/50-cloud-init.yaml"で設定されている.

/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.
# 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:
        enp5s0:
            addresses: []
            dhcp4: true
            optional: true
    version: 2

これに設定を追記していき,無線LAN設定していく.
netplan.ioを参考にした.)

有線LANの設定は"ethernets"以下に記述し,無線LANの設定は"wifis"以下に記述する.
無線LANアダプタは"wlp9s0"として認識されていたので,以下の内容を追記する.

    wifis:
        wlp9s0:
            addresses: []
            dhcp4: true
            optional: true
            access-points:
                SSID1:
                    password: PASSWORD1
                SSID2:
                    password: PASSWORD2

なお,SSID1やPASSWORD1などは適宜修正する.(並列で記述することで複数設定が可能.)

また,無線LANの接続については"NetworkManager"を用いる必要があるらしい.
まずは,NetworkManagerをインストールし,設定ファイルの"renderer"オプションを追加する.

sudo apt-get install network-manager
/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.
# 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:
        enp5s0:
            addresses: []
            dhcp4: true
            optional: true
    wifis:
        wlp9s0:
            addresses: []
            dhcp4: true
            optional: true
            access-points:
                SSID1:
                    password: PASSWORD1
                SSID2:
                    password: PASSWORD2
    version: 2
    renderer: NetworkManager

最後に

sudo netplan apply

で設定完了.

Why do not you register as a user and use Qiita more conveniently?
You seem to be reading articles frequently this month. You can use this function by logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away