RHEL等Linux系统使用wpa_supplicant以WPA-PSK/WPA2-PSK连接WIFI
2014-04-22 19:38
429 查看
以RHEL6.4为实验对象:
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、设置 wpa_supplicant 服务开机启动
chkconfig --level 2345 wpa_supplicant on
5、检查 ifcfg-wlan0 无线网卡脚本是否设置开机启动
DEVICE=wlan0
ONBOOT=yes
BOOTPROTO=dhcp
5.1、如果想马上连接到 WIFI ,可以重启网络
/etc/init.d/network restart
5.2、可以使用iwconfig 命令查看 WIFI 是否连接成功
iwconfig wlan0
6、由于网卡开启时还没有连接到正确的wifi,以上配置文件的所以在每次 WIFI 连接后都需要手动使用dhclient 命令获取dhcp信息 (也可以在 ifcfg-wlan0 中设置固定IP地址)
dhclient wlan0
6.1、查看是否获取IP地址等信息
ifconfig wlan0
至此,就可以正常连接使用 WPA-PSK/WPA2-PSK 加密的 WIFI 了。
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、设置 wpa_supplicant 服务开机启动
chkconfig --level 2345 wpa_supplicant on
5、检查 ifcfg-wlan0 无线网卡脚本是否设置开机启动
DEVICE=wlan0
ONBOOT=yes
BOOTPROTO=dhcp
5.1、如果想马上连接到 WIFI ,可以重启网络
/etc/init.d/network restart
5.2、可以使用iwconfig 命令查看 WIFI 是否连接成功
iwconfig wlan0
6、由于网卡开启时还没有连接到正确的wifi,以上配置文件的所以在每次 WIFI 连接后都需要手动使用dhclient 命令获取dhcp信息 (也可以在 ifcfg-wlan0 中设置固定IP地址)
dhclient wlan0
6.1、查看是否获取IP地址等信息
ifconfig wlan0
至此,就可以正常连接使用 WPA-PSK/WPA2-PSK 加密的 WIFI 了。
相关文章推荐
- zedboard之GPIO驱动(从FPGA一直到LINUX应用)
- zedboard之GPIO驱动(从FPGA一直到LINUX应用)
- Linux下安装R语言
- 【嵌入式Linux驱动开发】四、输入设备驱动
- C语言程序前后自增(++a、a++)在Linux下的实现机制
- Red Hat Linux中用户和组
- linux下进行数据备份和计划任务练习题
- How to visualize disk usage on Linux
- What is a good file manager for Linux?
- How to monitor system temperature on Linux
- How to create desktop shortcut or launcher on Linux
- How to integrate Google Calendar in Linux desktop
- mysql数据库存储二进制数据 linux
- 常见的LINUX发行版安装libiconv库方法
- How to stitch photos together on Linux
- Linux 命令
- linux下dhcp服务器分配出去的IP地址及剩余IP地址
- Linux ALSA声卡驱动之四:Control设备的创建
- Linux中sed和awk命令比较实例
- CentOS-6下搭建本地yum仓库, 采用NFS服务