centos6.5 连接无线网络

1.查看是否有无线网卡的接口(命令:iwconfig)

centos6.5 连接无线网络

2.查看需要连接的无线网络(命令:iw dev wlan0 scan | less)

3.如果要连接的网络是wpa加密的话需要安装wpa supplicant工具

   这个rpm包 我在安装centos的镜像文件里找到了,直接安装即可

   我的环境是由于没有网络  我通过u盘进行挂载完成的 

   centos6.5 连接无线网络

    1.把wpa_supplicant-0.7.3-4.el6_3.i686拷贝到u盘里进行挂载

       挂载步骤:

1.查看u盘的设备名称(device 类似于/dev/sda1) 命令(fdisk -l)

2.进行挂载  mount /dev/sdc4  /mnt/usb (以我的为例)

3.rpm -ivh /mnt/usb/wpa_supplicant-0.7.3-4.el6_3.i686 进行安装

4.umount /mnt/usb 取消挂载

4.更改 vim /etc/wpa_supplicant/wpa_supplicant.conf(ssid是帐号 psk是密码)

centos6.5 连接无线网络centos6.5 连接无线网络

5.wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -dd -B

centos6.5 连接无线网络

6.iwconfig

centos6.5 连接无线网络

7.dhclient wlan0

就可以连接无线网络了

8.如果想要开机就自动连接wifi的话

vim /etc/sysconfig/network-scripts/ifcfg-wlan0

修改内容:

ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

vim /etc/rc.d/rc.local

修改内容:

wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -dd -B
service network restart


这样开机就自动连接wifi了

参考文献:

https://wenku.baidu.com/view/d6ee71cbad02de80d5d84045.html