How to Setup WiFi on Raspberry Pi 4 with Ubuntu 20.04 LTS 64-bit ARM Server

It’s actually pretty simple and here are the steps:

  1. You need 3 pieces of info in order to setup your WiFi:

    Raspberry Pi wireless card name on your system;
    WiFi router name you are trying to login (SSID), and
    WiFi login password

You should already know your WiFi login name and password, the only info we need is WiFi name.

To clearly illustrate how to setup, let’s assume that your WiFi login name is “MyWiFi” and your password is “MyPass”.

  1. Find WiFi card name:

    $ ls /sys/class/net
    eth0 lo wlan0

on my machine, it’s “wlan0”. To simplify our demo, assume that yours is “wlan0” as well.

  1. Edit network configuration file to add WiFi info:

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

you will see the following in the original file:

# 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: no
            dhcp6: no
            addresses: [192.168.1.45/24, '2001:1::45/64']
            gateway4: 192.168.1.1
            nameservers:
                addresses: [192.168.1.1,8.8.8.8]
            match:
                driver: bcmgenet smsc95xx lan78xx
            optional: true
            set-name: eth0
    version: 2

After adding your WiFi info such that it should look something like the following:

# 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: no
            dhcp6: no
            addresses: [192.168.1.45/24, '2001:1::45/64']
            gateway4: 192.168.1.1
            nameservers:
                addresses: [192.168.1.1,8.8.8.8]
            match:
                driver: bcmgenet smsc95xx lan78xx
            optional: true
            set-name: eth0
    version: 2
    wifis:
        wlan0:
            optional: true
            access-points:
                "MyWiFi":
                    password: "MyPass"
            dhcp4: true
  1. Make sure that the 3 pieces of info above is replaced with yours.

    wlan0
    MyWiFi
    MyPass

And also please make sure that you are a very careful person to input the above info with exact format as original file started, and all indents should be typed with spaces (4 spaces each level), NOT tabs, which is very important!

  1. Save the file and reboot

you should have your WiFi setup when the machine is up and running again.

Deja una respuesta

Tu dirección de correo electrónico no será publicada.