Manual Configuration or WPA Supplicant for WiFi on a University Network
Solution 1
Here is what I have for my /etc/network/interfaces
file.
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
#source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
# Wifi network interface
allow-hotplug wlan0
#iface wlan0 inet manual
# wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
Above you see the lines with iface wlan0 inet manual
and below it wpa-roam...
commented out. With this setting my wifi would not reconnect after system suspend without rebooting.
Here is my setup for the /etc/wpa_supplicant/wpa_supplicant.conf
file.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="University-Network-Name"
scan_ssid=1
key_mgmt=WPA-EAP
identity="my-username"
password="secret-password"
eap=PEAP
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
priority=30
}
network={
ssid="home-ssid-name"
psk="secret-password"
priority=40
}
Solution 2
I would recommend not to use different network interface for different WLANs, but instead use one interface and the roaming mode if wpa_supplicant, using wpa_supplicant.conf
for the WLAN details. That's how I do it on my laptop.
So my /etc/network/interfaces
looks like
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
and in my wpa_supplicant.conf
, I have something like
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="first_ssid"
psk="blah1"
priority=30
}
network={
ssid="second_ssid"
psk="blah2"
priority=50
}
etc. Nice and easy. I have't set up EAP this way yet, but there are options you can use to specify this.
You can also use wpa_cli
or wpa_gui
to add other networks etc. on the fly, if needed. wpa_cli
is scriptable.
(Of course the really interesting question is: what happens every Monday to make your connection fail?)
Related videos on Youtube
Dharmin Shah
Updated on September 18, 2022Comments
-
Dharmin Shah over 1 year
I am using Debian Stretch/Testing with Xfce. I have an eight year old Acer laptop. I am currently using
network-manager-gnome
to connect to WiFi from the laptop at the university where I teach.Most of the time I have no issue. However, something strange has been happening. On Mondays, only on Mondays (every Monday for the past three weeks). My connection will work for about two to three minutes, and then it will slow to a halt. It actually did the same thing today when connected to a WiFi hotspot I created on my phone. My phone works fine on the university WiFi at these same times.
Today, while using
network-manager-gnome
, my WiFi hotspot connection died. So I disabled Network Manager and I connected to the hotspot via manual configuration. This WiFi connection worked perfectly fine.For manual configuration I have the
/etc/network/interfaces
file that sources to theinterfaces.d
directory. I have created/etc/network/interfaces.d/wlan0
. It has content like this:auto wlan_home iface wlan_home inet dhcp wpa-ssid home-network-ssid wpa-psk secret-key auto wlan_hotspot iface wlan_hotspot inet dhcp wpa-ssid wifi-hotspot-ssid wpa-psk secret-key
To connect I use the command (example of home network):
sudo ifup wlan0=wlan_home
(I of course have the proper r/w permissions (chmod 600) set to the
wlan0
file as well as a generated key instead of my actual password.)Now to my question. I would like to add the proper configuration information to the
wlan0
file to be able to connect to my university network. I would like to be able to connect using this manual configuration for when Network Manager fizzles out. Here is the general information used to connect innm-connection-editor
. I have been unable to find any guide on the proper connection information to place in my file. Otherwise, perhaps the only option is to set up the connection with thewpa_supplicant.conf
file. -
Dharmin Shah about 7 yearsI went ahead and posted my own answer because it had the details on how I was able to connect to my university wifi. You have my upvote at least. You got me going in the right direction. I appreciate it. By the way, today (Monday), I used the wpa_supplicant to connect to wifi instead of Network Manager, and it was the first Monday where the wifi did not disconnect on my laptop. Perhaps one day this mystery will be revealed to me.
-
Dharmin Shah about 7 yearsI think I know the most likely culprit of why I always had network connection issues on Mondays. I did not have a throttle set for the download speed for Dropbox. On Mondays, Dropbox would be syncing all the files from over the weekend. It would hoard my connection, and this caused the entire connection on my laptop to disconnect. After throttling the download speed, all works well. (I hope I can eventually move away from Dropbox to something like NextCloud. It's my only proprietary program on this machine.) I am still using WPA Supplicant though. Nice to have that option.
-
dirkt about 7 yearsBTW, I use dropbox-uploader to manually upload and manage dropbox file. No automatic syncing, and I didn't install the official propriety dropbox software.