I'm experiencing an issue with my school's WiFi where it stops working every 5 minutes or so. When this happens, nmcli monitor shows "Connectivity is now 'limited'". I have this short script that automatically reconnects to the wifi when this issue occurs:
#!/bin/bash
while true; do
if nmcli connection show --active | grep -q 'eduroam' \
&& ! ping -c 3 -W 2 google.com &> /dev/null; then
nmcli connection up eduroam
fi
sleep 10
done
While it seems to work fine, I was hoping for a better way. When the connection is limited it takes a while to run (up to ~20 seconds), but I'm reluctant to reduce the ping count or timeout further, to avoid false positives. Perhaps there is some way to have network manager itself trigger the recconection? Of course, fixing the "Connectivity is now 'limited'" issue would be best, so if you have any ideas on that it would be great. In case it's relevant, I should also mention the wifi doesn't use a captive portal, a CA is required, and the authentication is done through PEAP. Thank you for your attention!