1, 查看无线网卡的芯片型号
如果是usb网卡, 用lsusb(属于usbutils的命令), 查看无线网卡的型号:
#[root@localhost wireless]# lsusb
Bus 001 Device 002: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter
如果是内置网卡,或pci网卡:
#[root@localhost wireless]# lspci
04:00.0 Network controller: MEDIATEK Corp. MT7630e 802.11bgn Wireless Network Adapter
2, 网上找对应芯片的驱动
这个过程比较麻烦, 目前这2个芯片的驱动我有, 这里不能上传附件, 有需要可以网上找,
3, 编译驱动, 并安装
必须先安装内核模块编译工具, 主要有:
yum install make gcc
yum install kernel-devel
然后编译:
make;make install
最后安装:
depmode /lib/modules/xxxxxx(kernel-ver)/drvier/net/wirless/xxx.ko
modprobe xxx
4, 使用iw工具配置及登录
安装工具:
yum install wireless-tool
启动网卡:
#ifconfig wlan0 up
设置混杂模式:
#iwconfig wlan0 essid any
探测网络:
iwlist wlan0 scanning
登录(WEP加密):
iwconfig wlan0 essid "DoMyNet_DC04" key s:123456
登录(WAP加密):
配置/etc/wpa_supplicant/wpa_supplicant.conf文件
[root@localhost wireless]# cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="DoMyNet_DC04"
psk="123456"
priority=1
}
[root@localhost wireless]# wpa_supplicant -B -i ra0 -c /etc/wpa_supplicant/wpa_supplicant.conf
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
ra0: Trying to associate with 14:3d:f2:68:dc:04 (SSID='DoMyNet_DC04' freq=2467 MHz)
ra0: Associated with 14:3d:f2:68:dc:04
ra0: WPA: Key negotiation completed with 14:3d:f2:68:dc:04 [PTK=CCMP GTK=TKIP]
ra0: CTRL-EVENT-CONNECTED - Connection to 14:3d:f2:68:dc:04 completed [id=0 id_str=]
这个后台进程会一直存在,
最后获取/设置IP地址
dhclient wlan0
或
ifconfig wlan0 x.x.x.x
机器重启自动连接wifi
网络配置静态IP/也可以动态IP
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-wlan0
TYPE=Ethernet
DEVICE=ra0
ONBOOT=yes
BOOTPROTO="static"
IPADDR=192.168.10.89
NETMASK=255.255.255.0
GETWAY=192.168.10.1
DNS1=192.168.10.1
#BOOTPROTO="dhcp"
配置wpa_supplicant.conf
[root@localhost ~]# cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="DoMyNet_DC04"
psk="xxxxx"
priority=1
}
配置rc.local
[root@localhost ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
route del default
route add default gw 192.168.10.1
wpa_supplicant -B -i ra0 -c /etc/wpa_supplicant/wpa_supplicant.conf
改变rc.loca为可执行文件
#chmod +x /etc/rc.local
阅读(2500) | 评论(0) | 转发(0) |