0

Disclaimer: I am a complete beginner and raspberry pi is the first time I've used 'real' Linux

I have a raspberry pi zero 2 W running Raspberry Pi OS Lite (32bit) and the only way I have of communicating with it is through SSH (I tried using USB and gadget mode, couldn't figure it out/didn't work). Currently I'm connected to it with my iPhone hotspot and that works fine but what I need to do is I need to connect it to my university's eduroam network, I just can't get it to work. Eduroam is a network used by many universities across the world, it uses a username and password instead of just a password. Here's a list of things I've tried:

  • Changing wpa_supplicant.conf

I added the following

    network={
    ssid="eduroam"
    scan_ssid=1
    key_mgmt=WPA-EAP
    eap=PEAP
    identity="youridentity@youridentitydomain"
    password="yourpassword"
    phase1="peaplabel=0"
    phase2="auth=MSCHAPV2"
    }

from this thread and then restarted the network interface (sorry if I'm talking with my ass, I got this next step from ChatGPT) using

sudo wpa_cli -i wlan0 reconfigure

and I was met with "FAIL" from the Raspberry Pi. I suspected this wouldn't work since I didn't even see the current network in wpa_supplicant (my iPhone hotspot) nor even a country code.

  • Stop network manager and manually starting wpa_supplicant (after editing it) I asked ChatGPT about this since I couldn't find anything on google and it recommended the following steps:
  1. sudo pkill wpa_supplicant
  2. sudo rm /var/run/wpa_supplicant/wlan0
  3. sudo systemctl stop NetworkManager
  4. sudo systemctl disable NetworkManager
  5. sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

Since I would be disconnected from the network (my only mode of communication) I put this into a .sh file and ran it. I waited a while and connected to the eduroam network on my laptop (windows 11) and tried connecting to the pi both with ssh in command prompt and putty using raspberrypi.local as the host name (same hostname as I used to connect through my hotspot) but no such host was found.

I really don't know what to do anymore, google gives me nothing and ChatGPT goes in circles. I would really appreciate if anybody has encountered a similar problem and knows of a solution :)

Please let me know if there is anything I should add/change/remove about this post

P.S. There might be some other smaller things I've tried, I can't remember since I've been all over the place with this problem for a couple of days so I apologize if you post a solution I've already tried

TLDR;

-Raspberry Pi zero 2 W

-Raspberry Pi OS lite 32bit

-Only way of current communication is ssh through my iPhone hotspot

-I need to connect to 'eduroam' university network.

-wpa_supplicant doesn't seem to be used.

abc123
  • 11
  • 3

1 Answers1

1

I managed to figure it out myself so I decided to answer my own question in case anybody else stumbles upon this in the future. Before doing this I had reinstalled the OS to reset everything. That might not be necessary for you reading so no harm in trying.

  1. Use the following where <connection_name> is just a name you give this connection (example: "SchoolWifi") and < ssid > is, you guessed it, the SSID (so "eduroam")
sudo nmcli connection add type wifi con-name "<connection_name>" ifname wlan0 ssid "<ssid>"
  1. Here you set up authentication (put in your username and password). <connection_name> is the name you gave it earlier (in my example this would be "SchoolWifi"). <your_username> is the username you use to log into the eduroam network on your phone, for example. Usually it's the email given to you by the school (example: John123@University.com). <your_password> is the password you use, along with the username, when logging into the wifi (example: badpassword123)
sudo nmcli connection modify "<connection_name>" wifi-sec.key-mgmt wpa-eap 802-1x.eap peap 802-1x.phase2-auth mschapv2 802-1x.identity "<your_username>" 802-1x.password "<your_password>"

2a. (Only if necessary) Add a CA certificate, I didn't have to do this so I can't elaborate further. The command is:

sudo nmcli connection modify "<connection_name>" 802-1x.ca-cert "/path/to/ca_cert.pem"

2b. (optional) Adding priorities to the networks on your device. For me, after completing steps 1 and 2 I then had 2 networks saved; "eduroam" and "preconfigured"; if you don't have a keyboard and monitor for the raspberry pi and ssh is your only way of communicating with the device you should put a priority on the 2 networks so that if anything goes wrong it will connect to the original network on reboot. I say this because I was unable to ssh to my raspberry pi through the eduroam network. You add priorities with the following:

sudo nmcli connection modify "<connection_name>" connection.autoconnect-priority <number>

< number > is an integer you give the network in priority. The higher the number, the higher the priority. For me, by default, the priorities were 0 (on both networks) so just put it at 10 or something else higher than 0. <connection_name> depends on what you want to have the raspberry pi prioritize, if you want it to be the eduroam network then use whatever name you chose in step 1. If you want it to be the network that was connected to at first boot then use "preconfigured" or whatever the default is at the time of reading. You can see the list of saved networks with the following:

nmcli connection show

Use the NAME column to choose which network to prioritize

If you decide to skip this step, the raspberry pi will connect to whichever network's signal is strongest (since the priorities are equal)

  1. Activate the connection
sudo nmcli connection up "<connection_name>"

Where <connection_name> is the name you chose in step 1. If you are using ssh, this step will disconnect you so be careful which network you choose in step 2b.

Source: ChatGPT (yeah yeah I know, but it worked)

abc123
  • 11
  • 3