List

 

While working on “Building an affordable live streaming camera using a Raspberry Pi” project, I found that the Raspberry Pi is not able to connect to University’s secure wireless network. I found that the cause of the problem is WPA2 Enterprise which is used by most of the institutions like universities and big companies. I hope this blog post would help you if you are facing with the same problem.

  1. First edit wpa_supplicant.conf file located in /etc/wpa_supplicant/ folder.
    Open a terminal and type the command below:

    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

    Use your wireless network ssid, username and password for the red colored parameters.

    network={
    
        ssid="ssid"
    
        scan_ssid=1
    
        key_mgmt=WPA-EAP
    
        group=CCMP TKIP
    
        eap=PEAP
    
        identity="username"
    
        password="password"
    
        phase1="peapver=0"
    
        phase2="MSCHAPV2"
    
    }

    Save and exit file (ctrl+x, yes)

  2. Edit network interfaces.
    sudo nano /etc/network/interfaces
    auto lo
    
    iface lo inet loopback
    iface eth0 inet dhcp
    
    allow-hotplug wlan0
    
    iface wlan0 inet dhcp
        pre-up wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant
        post-down killall -q wpa_supplicant
  3. Reboot the Raspberry Pi
  4. Check the wpa_cli status
    sudo wpa_cli status

    wpa_state parameter must be equal to “COMPLETED”.
    The output for me is:

    Selected interface 'wlan0'
    
    bssid=28:8a:1c:fa:5d:42
    
    freq=0
    
    ssid=UofM Secure
    
    id=0
    
    mode=station
    
    pairwise_cipher=CCMP
    
    group_cipher=CCMP
    
    key_mgmt=WPA2/IEEE 802.1X/EAP
    
    wpa_state=COMPLETED
    
    ip_address=10.104.164.239
    
    address=b8:27:eb:d1:bc:0d
    
    Supplicant PAE state=AUTHENTICATED
    
    suppPortStatus=Authorized
    
    EAP state=SUCCESS
    
    selectedMethod=25 (EAP-PEAP)
    
    EAP TLS cipher=AES256-SHA
    
    EAP-PEAPv0 Phase2 method=MSCHAPV2
    
    uuid=c7492b97-0cc5-5df3-bff7-bbb00be7bbff
  5. Now, the Raspberry Pi must be automatically connecting to secure network which you have defined in the wpa supplicant configuration.

18 Responses to “Connecting Raspberry Pi to WPA2 Enterprise Wireless Network”

  1. Keiran

    Hi Baris,
    Thank you very much for your informative post! I also work at the University of Minnesota (St. Paul campus), and I’ve been trying to get a Raspberry Pi Zero to connect to UofM Secure.

    However, I have not had success get a connection using wpa_supplicant. Can you direct me to the resources you used to figure out the correct configuration?
    Thanks!

    Sincerely,
    Keiran

  2. Zhenlin Jin

    Dear Prof. Unver:

    I found some minor editing errors on the code network interfaces part.
    Instead of -c/etc/wpa_supplicant/wpa_supp$, it should be -c /etc/wpa_supplicant/wpa_supplicant

    I have been searching for answer online all over the places, and finally this article solved my problem in order to connect to school WPA2 enterprise network.

    Thank you!

    -Zhenlin Jin

    • Baris Unver

      Updated, thank you for the feedback by the way I’m just a Ph.D. student yet 🙂

  3. Cameron

    I was able to get this to work with some slight tweaking. In the network interfaces file I used ‘manual’ instead of ‘dhcp’ and it worked perfectly (was not able to get it to work otherwise). Thank you!

    • Mamek

      thanks you, this seems to work for me too.

  4. Sean

    NICE !!!!!!!!!!!! worked!

  5. Jacob

    Thank you! Worked great after a reboot

    • Baris Unver

      You are most welcome!

  6. Kendra

    If the network interfaces already have dialogue, where do we input the new code?

  7. Frank

    I set the network interface file with “manual” instead of “dhcp” (otherwise it cannot connect to wifi), but I keep got wpa_state=DISCONNECTED in wpa_cli status (I have stable wifi internet connection tho). Any solutions? And I cannot go headless over ssh might because of the DISCONNECTED status?

  8. Thomas Bridges

    Once change I had to make to get it to work:
    pre-up wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant
    to
    pre-up wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

    Awesome guide, thanks for the help.

  9. Alice

    It worked great for Georgia Tech’s wifi! Thank you!

  10. ZooHE

    When I try this code, I get “Failed to connect to non-global ctrl_ifname: (nil) error: No such file or directory

  11. ZooHe

    When I run sudo wpa_cli status, I get

    “Failed to connect to non-global ctrl_ifname: (nil) error: No such file or directory”

    Any idea how to resolve this?

  12. Ludo

    I finally managed to connect my Rpi3 to corporate wifi!
    Thanks for your help!

  13. MultiSensor Robot – documentation – AMY ZHENG

    […] I believe you’ll have to reboot your computer afterwards, if it didn’t work you can read through Connecting Raspberry Pi to WPA2 Enterprise Wireless Network. […]

  14. Orkhan AmirAslan

    Good that I found this blog post, Baris abi. Thanks.

    • Baris Unver

      You are welcome Orkhan kardesim!

Leave a Reply

Your email address will not be published. Required fields are marked *