linux使用wpa_supplicant连接WPA2企业网
创建wpa_supplicant配置文件
touch /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
#ap_scan=0(有线连接时)
network={
# key_mgmt=IEEE8021X(有线连接时)
key_mgmt=WPA-EAP(无线连接时)
ssid="wifi名称"
eap=PEAP
identity="user_name"
password="user_password"
phase2="autheap=MSCHAPV2"
}
关闭所有wpa_supplicant进程
sudo killall wpa_supplicant
查看网卡名称
ifconfig
连接
sudo wpa_supplicant -B -i 网卡名称 -c /etc/wpa_supplicant/wpa_supplicant.conf
其中/etc/wpa_supplicant/wpa_supplicant.conf为第一步中创建的配置文件路径`
查看是否连接成功
iwconfig 网卡名称
自动获取ip
dhclient 网卡名称
最后可以直接ping www.baidu.com来进行判断是否有网络