ESP32 - WPA2 Enterprise (802.1x)

I have made sketch for ESP32 board that let it connect to WPA/WPA2 Enterprise network. Tested under local WLAN with RADIUS server and Eduroam. Not tested under network with TACACS, only RADIUS with methods: PEAP + MsCHAPv2

Enjoy and let me know if it is working in your university, local 802.1x network. Some users had problems in USA and Russia.

Dear friends. In new verison of Arduino core for ESP32 is new requirement - init hardware with Wifi.mode function (AP/STA/AP+STA).

martinius96:
Dear friends. In new verison of Arduino core for ESP32 is new requirement - init hardware with Wifi.mode function (AP/STA/AP+STA).

Does this enable wpa2 on other networks?
Thanks!

Working?

Hey,
first of all thank you for your work!
I got a problem according to the settings/config.
I need to connect to my network with the following config:
EAP-Method:
PEAP
Phase 2-Authentication:
MSCHAPV2
CA-certificate:
do not validate
and of course identy and password

But in your code it's just the default config that I can't change.

esp_wpa2_config_t config = WPA2_CONFIG_INIT_DEFAULT(); //set config settings to default
esp_wifi_sta_wpa2_ent_enable(&config); //set config settings to enable function

Is the config in any way accessable and changeable?

PS: Sorry for my bad english and the not 100% accurate technical terms.

Yours sincerely
Stephan Pelowski

Sketches are not available more.
Only for ask at: martinius96@gmail.com

I have made some examples to popular IoT portals, etc for enterprise connections to eduroam networks or similar under 802.1x (WPA/WPA2 Enterprise) with ESP32 and June 2018 Arduino core.
Available services in repo:

  • Cayenne MQTT - MySensors
  • Amazon web services IoT (AWS-IoT)
  • Microsoft Azure IoT
  • AskSensors
  • IBM Watson Bluemix
  • ThinX Cloud
  • ThingSpeak
  • ThingsBoard
  • ThingWorx
  • Samsung Artik IoT
  • User's HTTP/HTTPS requests to own backend or MQTT connection with topic posting.

Today I have tested newest Arduino core for ESP32 and it worked great! Connection sucessful under PEAP + MsCHAPv2. So.. You don't need to downgrade your Arduino cores for ESP32 boards.

martinius96:
Today I have tested newest Arduino core for ESP32 and it worked great! Connection sucessful under PEAP + MsCHAPv2. So.. You don't need to downgrade your Arduino cores for ESP32 boards.

Do you think this would work for a ESP8266? Also, I can't see the code anywhere, and are there any libraries to download with it?

No, it will not work.
you need to use esp_wpa2.h library.
But you need to use all dependencies, and it will not work, cuz. ESP8266 don't have enough RAM for that.

Hi I have been battling with ESP8266 and the wpa2_enterprise.h and have not had much luck in connecting to my office wifi. We have a "WPA2 enterprise PEAP + MsCHAPv2" network. This needs a SSID, username eg: fristname.lastname and a password to login to the network. I am planning of buying a "HiLetgo ESP-WROOM-32 ESP32 ESP-32S Development Board". Would "esp_wpa2.h library" work on this board for me to connect this the network? Any pointers are much appreciated.

Yes, it will work for ESP32. If you have RADIUS server under Debian with FreeRadius extension. (eduroam is using that software package) I was testing it on my home RADIUS server with same authentication method under Linux Zeroshell and I wasn't sucessful. For that I think it is working only under Debian with FreeRadius.
You can use methods PEAP + MsCHAPv2 or EAP-TTLS + MsCHAPv2. Code is same.
There you can find many examples: GitHub - martinius96/ESP32-eduroam: Examples with connection to eduroam powered university networks around the world and then to IoT services or self-hosted websites..

I was testing ESP8266 with connection to Enterprise WiFi too: GitHub - martinius96/ESP8266-eduroam: Connection to 802.1x WPA/WPA2 Enterprise networks under ESP8266
But it still fall after 5 seconds after connection is sucessful. For that, try ESP32.

Hello,

I'm trying to figure out how to allow ESP8266 to associate with a WPA2 Enterprise (username/password based) Wifi network.

Seems like things are starting to connect, but at some point nothing happens.
RADIUS server, which is actually a Windows Server 2019 NPS, receives the request, authenticates it successfully, but then, nothing more ... no IP address (auto or manual) on ESP8266.

Do you have any idea on how to get this working ?

Thanks

PS : If you want to see my code, I opened an ISSUE on "esp8266 / Arduino" on Github.
LINK : WPA2 enterprise with credentials auth ok with radius but still get STATION_WRONG_PASSWORD after 30s · Issue #6803 · esp8266/Arduino · GitHub

Hello,

Appreciate your job !

I've tried on a ESP32-CAM (ESP32-S) board but still connecting and reboot the card :

Connecting to network: smile
............................................................ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6400
entry 0x400806a8

Connecting to network: smile
............................................................ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6400
entry 0x400806a8

Connecting to network: smile
...............................................................

Did you tried with this kind of board ?

Thanks in advance !

Adrien