Connecting a Raspberry Pi to McGill WiFi


OVERVIEW

Target audience: McGill students, faculty and staff, researchers

When you boot a Raspberry PI and click on the WiFi logo to connect to the McGill network, you will see that wpa.mcgill.ca is greyed out.

Follow the steps below to connect to the McGill WiFi. To run these commands, open a terminal window.

Instructions for Raspberry Pi OS Bookworm or newer:

  1. Validate that you can see the wpa.mcgill.ca network by running this command. You should see wpa.mcgill.ca as an available network.

    sudo nmcli dev wifi

  2. Add the connection with nmcli being sure to replace the username and password with your credentials.

    sudo nmcli connection add \
    type wifi \
    connection.id wpa.mcgill.ca \
    wifi.ssid wpa.mcgill.ca \
    wifi.mode infrastructure \
    wifi-sec.key-mgmt wpa-eap \
    802-1x.eap peap \
    802-1x.identity firstname.lastname@mail.mcgill.ca \
    802-1x.phase2-auth mschapv2 \
    802-1x.password <mcgill password>


  3. Now that the configuration is added, run this command to connect to wpa.mcgill.ca:

    sudo nmcli dev wifi connect wpa.mcgill.ca

  4. Validate that you are connected to wpa.mcgill.ca by running:

    sudo nmcli connection show --active

  5. If you are connected to wpa.mcgill.ca the following information will be displayed and highlighted:
    root@raspberry:~ # sudo nmcli connection show --active

    NAME              UUID                                                       TYPE          DEVICE
    wpa.mcgill.ca  8cd3526a-17c7-4794-9dd0-d1241a99bd08  wifi           wlan0
    lo                   405e39ff-ad32-4428-bb3a-dfbe907c424d  loopback     lo

  6. To set wpa.mcgill.ca as your default Wifi network, run this command:

    sudo nmcli connection modify wpa.mcgill.ca connection.autoconnect-priority 100

Instructions for Raspberry Pi OS Older than Bookworm (e.g., Bullseye, Buster, and Stretch):

  1. To generate a password hash, run the following command and substitute your password:

    echo -n plaintext_password_here | iconv -t utf16le | openssl md4
    (stdin)= 6602f435f01b9173889a8d3b9bdcfd0b


  2. Edit /etc/wpa_supplicant/wpa_supplicant.conf. You will have to manually add the WiFi credentials to this file by adding the following:
    Replace identity and password after the hash with your credentials:

    network={
             ssid="wpa.mcgill.ca"
             scan_ssid=1
             key_mgmt=WPA-EAP
             pairwise=CCMP
             group=CCMP
             eap=PEAP
             identity=firstname.lastname@mail.mcgill.ca
             password=hash:6602f435f01b9173889a8d3b9bdcfd0b
             phase1="peaplabel=0"
             phase2="MSCHAPV2"
             id_str="mcgill"
    }


  3. Protect the file so only the root has access:

    chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
    chown root:root /etc/wpa_supplicant/wpa_supplicant.conf

  4. Edit /etc/dhcpcd.conf. Add the following three lines to the end of the file:

    cat << EOF >> /etc/dhcpcd.conf
    interface wlan0
    env ifwireless = 1
    env wpa_supplicant_driver = wext , nl80211
    EOF

  5. Edit /lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant. You will have to search for the one instance of nl80211,wext and replace it with wext,nl80211.

  6. Reboot the Raspberry PI. It should connect to WiFi after a little while.

references

ADDITIONAL REFERENCES: