LoginSignup
35

More than 5 years have passed since last update.

Ubuntu Server 18.04 LTSの無線LAN接続

Posted at

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

で設定完了.

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
35