17

I've finally installed the drivers for my wireless adapter, however, I can't seem to find anything explaining out to connect to a WPA2-Enterprise connection. I've found many WPA/WEP/WPA2 explanations, however, these don't solve my situations.

Is there any way to do this? I'm currently CLI only, thanks!

muru
  • 207,228

4 Answers4

27

You can use nmcli

# nmcli con add type wifi ifname wlan0 con-name CONNECTION_NAME ssid SSID
# nmcli con edit id CONNECTION_NAME
nmcli> set ipv4.method auto
nmcli> set 802-1x.eap peap
nmcli> set 802-1x.phase2-auth mschapv2
nmcli> set 802-1x.identity USERNAME
nmcli> save
nmcli> activate

You may also need to add

  • nmcli> set 802-1x.password PASSWORD
  • nmcli> set 802-1x.anonymous-identity ANONYMOUS-IDENTITY
  • nmcli> set wifi-sec.key-mgmt wpa-eap
Mikeage
  • 663
user123456
  • 2,478
3

wpa_supplicant is the answer. It supports WPA-Enterprise and several EAP methods. I connect to my home network by executing:

wpa_supplicant -i wlan0 -B -c /path/to/wpa_supplicant.conf

Here is an example of configuration file. It's all about configuring this file to match your connection.

Balgerda
  • 137
2

None of the answers here worked for me, and after several attempts with nmcli, I eventually gave up and used the Ubuntu 18.04 network interface to create a connection and the I copied it over to the other computer. Here are the steps I followed:

  1. Create the network connection within the Ubuntu network connection GUI.
  2. Copy the new connection from /etc/NetworkManager/system-connections/ on my local compute over to the headless server.
  3. Edit the MAC ID of the connection to match the interfaces from ifconfig.
  4. Update the permissions of the copied file with:
chmod 0600 new_connection
chmod root:root new_connection
  1. Restart the network manager
systemctl restart NetworkManager

For those of you that don't want to manually create the network connection in the GUI, you can modify the following network connection

[connection]
id=new_connection
uuid=axxxxf1f-xxxx-494c-980a-xxxxxxxxxxx
type=wifi
permissions=

[wifi]
mac-address=XX:XX:XX:XX:XX:XX
mac-address-blacklist=
mode=infrastructure
ssid=some_wifi_ssid

[wifi-security]
key-mgmt=wpa-eap

[802-1x]
eap=peap;
identity=redacted_username
password=redacted_password
phase2-auth=mschapv2

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto
0

piggy backing off of this answer, I was able to connect to network via terminal in Ubuntu 22.04 LTS Desktop with the following after defining CONNECTION_NAME, SSID, USERNAME, and PASSWORD with my wifi interface in this example as wlan0:

# nmcli con add type wifi ifname wlan0 con-name CONNECTION_NAME ssid SSID
# nmcli con edit id CONNECTION_NAME
nmcli> set ipv4.method auto
nmcli> set 802-1x.eap peap
nmcli> set 802-1x.phase2-auth mschapv2
nmcli> set 802-1x.identity USERNAME
nmcli> set 802-1x.password PASSWORD
nmcli> set 802-1x.anonymous-identity ANONYMOUS-IDENTITY
nmcli> set wifi-sec.key-mgmt wpa-eap
nmcli> save
nmcli> activate
kyrlon
  • 174