linux 连接wifi wpa2,RHEL等Linux系统使用wpa_supplicant以WPA-PSK/WPA2-PSK连接WIFI
以RHEL6.4為實(shí)驗(yàn)對(duì)象:
1、安裝 wpa_supplicant.
yum install wpa_supplicant
2、編輯 wpa_supplicant 配置文件
vim /etc/sysconfig/wpa_supplicant
以下格式:
# Use the flag "-i" before each of your interfaces, like so:
# ?INTERFACES="-ieth1 -iwlan0"
INTERFACES="-iwlan0"
# Use the flag "-D" before each driver, like so:
# ?DRIVERS="-Dwext"
DRIVERS="-Dwext"
# Other arguments
# ? -u ? Enable the D-Bus interface (required for use with NetworkManager)
# ? -f ? Log to /var/log/wpa_supplicant.log
# ? -P ? Write pid file to /var/run/wpa_supplicant.pid
# ? ? ? ?required to return proper codes by init scripts (e.g. double "start" action)
# ? ? ? ?-B to daemonize that has to be used together with -P is already in wpa_supplicant.init.d
OTHER_ARGS="-u -f /var/log/wpa_supplicant.log -P /var/run/wpa_supplicant.pid"
3、向 wpa_supplicant.conf ?文件寫入將要連接 WIFI 的 SSID 和 密碼
wpa_passphrase SSID PASSWORD >> /etc/wpa_supplicant/wpa_supplicant.conf
4、設(shè)置 wpa_supplicant 服務(wù)開機(jī)啟動(dòng)
chkconfig --level 2345 wpa_supplicant on
5、檢查 ifcfg-wlan0 無線網(wǎng)卡腳本是否設(shè)置開機(jī)啟動(dòng)
DEVICE=wlan0
ONBOOT=yes
BOOTPROTO=dhcp
5.1、如果想馬上連接到 WIFI ,可以重啟網(wǎng)絡(luò)
/etc/init.d/network restart
5.2、可以使用iwconfig 命令查看 WIFI 是否連接成功
iwconfig wlan0
6、由于網(wǎng)卡開啟時(shí)還沒有連接到正確的wifi,以上配置文件的所以在每次 WIFI 連接后都需要手動(dòng)使用dhclient 命令獲取dhcp信息 (也可以在 ifcfg-wlan0 中設(shè)置固定IP地址)
dhclient wlan0
6.1、查看是否獲取IP地址等信息
ifconfig wlan0 至此,就可以正常連接使用 WPA-PSK/WPA2-PSK 加密的 WIFI 了。
總結(jié)
以上是生活随笔為你收集整理的linux 连接wifi wpa2,RHEL等Linux系统使用wpa_supplicant以WPA-PSK/WPA2-PSK连接WIFI的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: powerpc-linux-gcc,关于
- 下一篇: 阿里开发者们的第5个感悟:听话,出活