Raspberry Pi 4 Ubuntu WiFi Setup

In this article I will show Raspberry Pi 4 Ubuntu WiFi Setup from command line.

Identify The WiFi Card Name In Raspberry Pi 4 Ubuntu

Raspberry Pi 4 has hardware WiFi card already onboard, but you can add other USB WiFi device.

First lets identify interfaces in system.

Information regarding network interfaces we can find in /sys/class/net file:

$ sudo ls /sys/class/net

eth0 lo wlan0

In our case we have 1 WiFi card and interface name is wlan0.

Edit the Netplan Configuration File

Open Netplan configuration file with any text editor (nano, vim):

$ sudo nano /etc/netplan/50-cloud-init.yaml

And add wifis section in config as shown in example:

# 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
    wifis:
        wlan0:
            dhcp4: true
            access-points:
                "WIFI SSID":
                    password: "WiFi Password"
    version: 2

Then save and close file.

Apply New Netplan

To apply netplan in Ubuntu execute:

$ sudo netplan --debug try
$ sudo netplan --debug generate
$ sudo netplan --debug apply

And reboot with command:

$ sudo reboot

After reboot your Raspberry Pi with installed Ubuntu will automatically connect to your WiFi access point.

Discuss article in ArsTech Forum

   

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee

arstech

Leave a Reply

Your email address will not be published. Required fields are marked *