问题列表
1 默认内核版本3.10.0-693.el7.x86_64没有加载该款硬件的驱动,需要下载驱动源码
2 源码下载后编译出错,需要更新内核源码的头文件
3 NetworkManager无法进行WIFI扫描,因为加载的驱动被识别为有线,dev name is enp0s* but not wlp0s*
4 修改为驱动源码,识别为设备名为wlp0s*后,依然出现iw wlp0s20f0u8 info返回command failed: No such device (-19),
暂时没解决问题,参见问题5,但是都可以通过命令行连接成功
5 更新到最新的内核4.163.3版本后依然在NetworkManager界面认证过程失败,因为IPV6被设置为disabled
问题 1
源码下载地址
编译时需要确保安装了kernel-headers-*包
[root@localhost ~]# rpm -qa "kernel*"
kernel-tools-3.10.0-693.21.1.el7.x86_64
kernel-3.10.0-693.el7.x86_64
kernel-3.10.0-693.21.1.el7.x86_64
kernel-headers-3.10.0-693.21.1.el7.x86_64
kernel-devel-3.10.0-693.el7.x86_64
kernel-ml-devel-4.16.3-1.el7.elrepo.x86_64
kernel-tools-libs-3.10.0-693.21.1.el7.x86_64
kernel-ml-4.16.3-1.el7.elrepo.x86_64
dkms add .
dkms install rtl8192eu/1.0 #增加一个驱动模块且不随内核版本更新的影响
dkms status
dkms remove -m rtl8192eu -v 1.0 --all
问题 2
编译出现IEEE80211_BAND_2GHZ未定义错误时需要修改 /usr/src/kernels/3.10.0-693.el7.x86_64/include/net/cfg80211.h 增加如下枚举
enum ieee80211_band {
IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
/* keep last */
IEEE80211_NUM_BANDS
};
编译成功后加载驱动,通过命令行设置参数可以连接热点成功
-
[root@localhost ~]# cat /etc/wpa_supplicant/wpa_supplicant.conf
-
ctrl_interface=/var/run/wpa_supplicant
-
ctrl_interface_group=wheel
-
network={
-
ssid="${AP_NAME}"
-
psk="${AP_PWD}"
-
priority=6
-
}
-
-
[root@localhost ~]# cat /usr/local/sbin/wifi
-
#!/bin/bash
-
lsmod |grep "8192eu" > /dev/null
-
if [ 1 -eq $? ];then
-
sudo insmod /usr/local/sbin/8192eu.ko
-
fi
-
DEV_NAME=`ip link|grep "wlp0**"|awk -F'[ : ]' '{print $3}'`
-
DEV_NAME=`ip link|grep "enp0s*"|awk -F'[ : ]' '{print $3}'`
-
sudo ifconfig ${DEV_NAME} down
-
sudo sleep 1
-
sudo ifconfig ${DEV_NAME} up
-
sudo kill -9 $(ps -aux |grep "dhclient"|grep "$DEV_NAME"|awk '{print $2}')
-
sudo kill -9 $(ps -aux |grep "wpa_supplicant"|grep "$DEV_NAME"|awk '{print $2}')
-
-
sudo wpa_supplicant -B -i ${DEV_NAME} -c /etc/wpa_supplicant/wpa_supplicant.conf -D wext
-
echo after wpa_supplicant
-
sudo dhclient ${DEV_NAME}
-
echo after dhclient
问题 3
[root@localhost ~]# nmcli dev status
DEVICE TYPE STATE CONNECTION
virbr0 bridge connected virbr0
enp0s20f0u8 ethernet connected enp0s20f0u8
enp1s0 ethernet connected 200.200
virbr0-nic tun connected virbr0-nic
lo loopback unmanaged --
错误的把无线网卡编译为有线后的显示信息
[root@localhost ~]# udevadm info /sys/class/net/enp0s20f0u8 |grep "TYPE*"
E: ID_TYPE=generic
正确的无线网卡的显示信息
[root@localhost ~]# udevadm info /sys/class/net/wlp0s20f0u8 |grep "TYPE*"
E: DEVTYPE=wlan
E: ID_TYPE=generic
参考 https://github.com/pvaret/rtl8192cu-fixes/issues/23 https://github.com/pvaret/rtl8192cu-fixes/pull/24
修改/opt/20140812_rtl8192EU_linux_v4.3.1.1_11320/os_dep/linux/os_intfs.c 解决问题
-
static const struct device_type wlan_type = {
-
.name = "wlan", // Add by KEWELL
-
};
-
struct net_device *rtw_init_netdev(_adapter *old_padapter)
-
{
-
_adapter *padapter;
-
struct net_device *pnetdev;
-
RT_TRACE(_module_os_intfs_c_,_drv_info_,("+init_net_dev\n"));
-
if(old_padapter != NULL)
-
pnetdev = rtw_alloc_etherdev_with_old_priv(sizeof(_adapter), (void *)old_padapter);
-
else
-
pnetdev = rtw_alloc_etherdev(sizeof(_adapter));
-
if (!pnetdev)
-
return NULL;
-
pnetdev->dev.type = &wlan_type; // Add by KEWELL
-
padapter = rtw_netdev_priv(pnetdev);
-
padapter->pnetdev = pnetdev;
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
-
SET_MODULE_OWNER(pnetdev);
-
#endif
问题 4
(wlan0) failed to initialize Wi-Fi driver for ifindex 9
manager: wlan0: factory failed to create device: Device factory NMWifiFactory failed to create device wlan0
问题 5
参考 解决,详细过程如下:
升级到epel的最新内核参考 https://www.cnblogs.com/zengkefu/p/5667145.html,升级后在启动时可以选择启用最新版本的内核4.16.3-1.el7.elrepo.x86_64,此版本已经包含了rtl8192edu的驱动和固件。
-
1、导入key
-
rpm --import
-
当然,如果已经修改了repo的gpgcheck=0也可以不导入key
-
2、安装elrepo的yum源
-
rpm -Uvh
-
3、安装内核
-
在yum的ELRepo源中,有mainline颁布的,可以这样安装:
-
yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml -y
-
当然也可以安装long term的:
-
yum --enablerepo=elrepo-kernel install kernel-lt -y
-
[root@localhost ~]# uname -a
-
Linux localhost.localdomain 4.16.3-1.el7.elrepo.x86_64 #1 SMP Thu Apr 19 08:21:26 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
可以直接通过NetworkManager进行扫描和连接,连接过程一直连接不上,以为是NetworkManager在Scan热点时设置为动态WIFI 动态MAC原因,通过设置NetworkManager.conf文件后还是出错
参考文档
https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/
https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html#id-1.2.5.12
-
[root@localhost ~]# cat /etc/NetworkManager/NetworkManager.conf |grep -v "^#"|grep -v "^$"
-
[main]
-
plugins=ifcfg-rh
-
autoconnect-retries-default=1
-
[logging]
-
level=DEBUG
-
domains=ALL
-
[device]
-
match-device=interface-name:wlp0s20f0u8
-
managed=1
-
wifi.scan-rand-mac-address=no
-
carrier-wait-timeout=15000
-
[connection]
-
connection.auth-retries=1
-
再搜索到,提示可能是两端的IPV6不匹配,刚好我的机器通过grub强制关闭了IPV6
-
[root@localhost ~]# cat /etc/default/grub
-
GRUB_TIMEOUT=2
-
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
-
GRUB_DEFAULT=0
-
GRUB_DISABLE_SUBMENU=true
-
GRUB_TERMINAL_OUTPUT="console"
-
#GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet logo.nologo loglevel=0 rd.systemd.show_status=false rd.udev.log-priority=0 plymouth.enable=1"
-
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet logo.nologo loglevel=0 rd.systemd.show_status=false rd.udev.log-priority=0 plymouth.enable=1"
-
GRUB_DISABLE_RECOVERY="true"
-
取消后就可以连接成功了
-
-
[root@localhost ~]# nmcli dev status
-
设备 类型 状态 连接
-
virbr0 bridge 连接的 virbr0
-
wlp0s20f0u8 wifi 连接的 SSID_NAME
-
enp1s0 ethernet 不可用 --
-
lo loopback 未托管 --
-
virbr0-nic tun 未托管 --
阅读(3902) | 评论(0) | 转发(0) |