引言:
最近对于嵌入式系统比较感兴趣,因此,计划先使用VMware workstation虚拟机试一试Linux系统下的网卡驱动安装
这不试不知道,一试吓一跳,发现Linux下的驱动安装还是比较麻烦的,下面将就本次的Linux系统下安装水星免驱USB网卡在Linux下的安装做一个尽量详细的记录。
一,
Linux下驱动安装的必要性
首先,Linux的稳定性是毋庸置疑的,因此,在很多情况下,Linux是首选的,但,Linux的操作系统版本是非常多的,而目前服务器方面基本是centos7或者Ubuntu
其次,openwrt这样的软路由操作系统也是需要安装网卡的,虽然我们可以直接插一个网线,使用板载网卡,但,无疑使用USB类型的网卡更方便使用嘛
最后呢,就是Linux下网卡如果安装成功后,可以做WiFi网络嗅探,WiFi热点破解这些工作了,虽然Windows下有很多WiFi破解工具,但,我想Linux下的破解工作可能会更方便,也是对自己的周边的无线网络的一个安全认识吧。
二,
环境简介
本次实践使用的是VMware workstation 虚拟机,操作系统 的版本是centos7,最小化安装,网卡见下图:
插入机箱后,虚拟机选择连接该网卡:
在Linux下查看网卡,因为该网卡是USB类型的,因此,Linux下应该是可以看到一个USB类型的光驱(sr1就是这个网卡了):
[root@centos10 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 80G 0 part └─centos-root 253:0 0 80G 0 lvm /
sr0 11:0 1 4.2G 0 rom /mnt
sr1 11:1 1 128M 0 rom
[root@centos10 ~]# blkid
/dev/sr0: UUID="2017-09-06-10-51-00-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/sda1: UUID="326cd1a2-713a-4a37-85d9-8f1606083297" TYPE="xfs"
/dev/sda2: UUID="RoyB4E-tuJx-OSAn-uGvH-YOiH-rerF-51wkyI" TYPE="LVM2_member"
/dev/mapper/centos-root: UUID="81ad8aed-bf72-4bd9-b9f4-8743e1dc074d" TYPE="xfs"
挂载此光驱到media目录下,可以看到Windows的驱动安装包,很显然,前面我们说的免驱是指的Windows下的免驱而不是Linux,Linux下还是需要安装驱动的:
[root@centos10 ~]# mount /dev/sr1 /media/
mount: /dev/sr1 is write-protected, mounting read-only
[root@centos10 ~]# cd /media/
[root@centos10 media]# ls
AutoRun.inf SetupInstall.exe
[root@centos10 media]# ls -alh
total 1.9M
dr-xr-xr-x 1 root root 2.0K Nov 3 2021 .
dr-xr-xr-x. 17 root root 244 Jan 15 04:41 ..
-r-xr-xr-x 1 root root 33 Mar 26 2018 AutoRun.inf
-r-xr-xr-x 1 root root 1.9M Jun 11 2018 SetupInstall.exe
看看Linux的版本信息:
[root@centos10 media]# uname -a
Linux centos10 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux[root@centos10 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
进一步看看USB的信息(lsusb命令如果没有,需要安装,安装命令为 yun install usbutils -y):
[root@centos10 ~]# lsusb
Bus 001 Device 002: ID 0bda:1a2b Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 004: ID 0e0f:0008 VMware, Inc.
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[root@centos10 ~]# lsusb -tv
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/7p, 12M|__ Port 1: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M|__ Port 1: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M|__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M
第一个命令输出的第一个就是网卡了,第二个命令可以印证,因为是usb-storage嘛,480M表示是usb3.0协议,读写速度,这些不需要过多关心
主要需要关注的是ID 0bda:1a2b, 利用此ID ,进一步识别网卡信息(注意,usb_modeswitch命令最小化安装没有,需要安装,yum install usb_modeswitch -y):
[root@centos10 ~]# usb_modeswitch -KW -v 0bda -p 1a2b
Take all parameters from the command line* usb_modeswitch: handle USB devices with multiple modes* Version 2.5.1 (C) Josua Dietze 2017* Based on libusb1/libusbx! PLEASE REPORT NEW CONFIGURATIONS !DefaultVendor= 0x0bda
DefaultProduct= 0x1a2bStandardEject=1Look for default devices ...found USB ID 0bda:1a2bvendor ID matchedproduct ID matchedfound USB ID 1d6b:0002found USB ID 0e0f:0008found USB ID 0e0f:0002found USB ID 0e0f:0003found USB ID 1d6b:0001Found devices in default mode (1)
Access device 002 on bus 001
Get the current device configuration ...
Current configuration number is 1
Use interface number 0with class 8
Use endpoints 0x0b (out) and 0x8a (in)USB description data (for identification)
-------------------------
Manufacturer: RealtekProduct: DISKSerial No.: not provided
-------------------------
Sending standard EJECT sequence
Looking for active drivers ...OK, driver detached
Set up interface 0
Use endpoint 0x0b for message sending ...
Trying to send message 1 to endpoint 0x0b ...OK, message successfully sent
Read the response to message 1 (CSW) ...Response successfully read (13 bytes), status 1
Trying to send message 2 to endpoint 0x0b ...OK, message successfully sent
Read the response to message 2 (CSW) ...Response reading failed (error -8)Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye![root@centos10 ~]# lsusb
Bus 001 Device 003: ID 0bda:b711 Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 004: ID 0e0f:0008 VMware, Inc.
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
再次查看USB信息,可以看到ID改变了,变为0bda:b711 ,说明Linux正确识别到了,但是,此时还没有驱动来驱动该硬件
在Linux下查询网卡芯片信息比较困难,其实比较简单的办法是在Windows下查看,见下图:
因此,我们可以确定该网卡的芯片是8188gu的,在网上寻找此芯片的Linux版本驱动就可以了,本次实验使用的是版本是下面的链接:
https://github.com/McMCCRU/rtl8188gu
我想这个应该也是可以的:
GitHub - wandercn/RTL8188GU: Realtek RTL8188GU Driver for TP-link TL-WN725N USB wifi
三,
相关资料介绍和驱动安装
驱动和操作系统的内核是密切相关的,因此, 本例中,需要升级内核,据测试,3.10版本的内核不会成功,本例中使用的内核版本是5版本
其次,是我们下载的驱动都是c语言的,因此,gcc的版本也需要比较高,默认的gcc4.8版本经测试也是失败的,本例中使用的gcc是9版本
本例涉及使用的安装包在下面的链接:
链接:https://pan.baidu.com/s/1tQseIUjo_MVCe-kaU8cROA?pwd=kkey
提取码:kkey
1,
升级内核
进入目录
[root@centos10 kernel-lt-5.4.266]# pwd
/root/11/kernel-lt-5.4.266
[root@centos10 kernel-lt-5.4.266]# ll
total 75756
-rw-r--r-- 1 root root 52929208 Jan 15 06:21 kernel-lt-5.4.266-1.el7.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 13541288 Jan 15 06:21 kernel-lt-devel-5.4.266-1.el7.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 8626820 Jan 15 06:21 kernel-lt-doc-5.4.266-1.el7.elrepo.noarch.rpm
-rw-r--r-- 1 root root 1401376 Jan 15 06:21 kernel-lt-headers-5.4.266-1.el7.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 233736 Jan 15 06:21 kernel-lt-tools-5.4.266-1.el7.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 120376 Jan 15 06:21 kernel-lt-tools-libs-5.4.266-1.el7.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 97832 Jan 15 06:21 kernel-lt-tools-libs-devel-5.4.266-1.el7.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 603824 Jan 15 06:21 python-perf-5.4.266-1.el7.elrepo.x86_64.rpm
可以强制安装,这个没有什么影响:
[root@centos10 kernel-lt-5.4.266]# rpm -ivh ./* --force --nodeps
warning: ./kernel-lt-5.4.266-1.el7.elrepo.x86_64.rpm: Header V4 DSA/SHA256 Signature, key ID baadae52: NOKEY
Preparing... ################################# [100%]
Updating / installing...1:kernel-lt-tools-libs-5.4.266-1.el################################# [ 13%]2:kernel-lt-tools-5.4.266-1.el7.elr################################# [ 25%]3:kernel-lt-tools-libs-devel-5.4.26################################# [ 38%]4:python-perf-5.4.266-1.el7.elrepo ################################# [ 50%]5:kernel-lt-headers-5.4.266-1.el7.e################################# [ 63%]6:kernel-lt-doc-5.4.266-1.el7.elrep################################# [ 75%]7:kernel-lt-devel-5.4.266-1.el7.elr################################# [ 88%]8:kernel-lt-5.4.266-1.el7.elrepo ################################# [100%]
安装完毕后,重启虚拟机,选择新内核,进入系统,再次激活USB:
[root@centos10 ~]# usb_modeswitch -KW -v 0bda -p 1a2b
Take all parameters from the command line* usb_modeswitch: handle USB devices with multiple modes* Version 2.5.1 (C) Josua Dietze 2017* Based on libusb1/libusbx! PLEASE REPORT NEW CONFIGURATIONS !DefaultVendor= 0x0bda
DefaultProduct= 0x1a2bStandardEject=1Look for default devices ...found USB ID 0bda:1a2bvendor ID matchedproduct ID matchedfound USB ID 1d6b:0002found USB ID 0e0f:0008found USB ID 0e0f:0002found USB ID 0e0f:0003found USB ID 1d6b:0001Found devices in default mode (1)
Access device 002 on bus 001
Get the current device configuration ...
Current configuration number is 1
Use interface number 0with class 8
Use endpoints 0x0b (out) and 0x8a (in)USB description data (for identification)
-------------------------
Manufacturer: RealtekProduct: DISKSerial No.: not provided
-------------------------
Sending standard EJECT sequence
Looking for active drivers ...OK, driver detached
Set up interface 0
Use endpoint 0x0b for message sending ...
Trying to send message 1 to endpoint 0x0b ...OK, message successfully sent
Read the response to message 1 (CSW) ...Response successfully read (13 bytes), status 1
Trying to send message 2 to endpoint 0x0b ...OK, message successfully sent
Read the response to message 2 (CSW) ...Response reading failed (error -8)Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!
2,
安装gcc9:
[root@centos10 11]# tar xvf gcc-9.tar
[root@centos10 11]# mkdir /opt/rh
[root@centos10 11]# mv devtoolset-9/ /opt/rh/
[root@centos10 11]# source /opt/rh/devtoolset-9/enable
[root@centos10 11]# echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
[root@centos10 11]# source /etc/profile
验证gcc是否安装成功:
[root@centos10 11]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-9/root/usr --mandir=/opt/rh/devtoolset-9/root/usr/share/man --infodir=/opt/rh/devtoolset-9/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-9.3.1-20200408/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
3,
编译的环境依赖安装:
因为我前面编译过,因此,清除了上次的编译,主要是安装bc 和gcc-c++
[root@centos10 rtl8188gu-master]# yum install unzip gcc-c++ bc -y[root@centos10 rtl8188gu-master]# make clean
#make -C /lib/modules/5.4.266-1.el7.elrepo.x86_64/build M=/root/11/rtl8188gu-master clean
cd hal ; rm -fr */*/*/*.mod.c */*/*/*.mod */*/*/*.o */*/*/*.o.* */*/*/.*.cmd */*/*/*.ko
cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/*.o.* */*/.*.cmd */*/*.ko
cd hal ; rm -fr */*.mod.c */*.mod */*.o */*.o.* */.*.cmd */*.ko
cd hal ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd core/efuse ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd core ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd os_dep/linux ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd os_dep ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd platform ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
rm -fr Module.symvers ; rm -fr Module.markers ; rm -fr modules.order
rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko *~
rm -fr .tmp_versions
rm -fr .cache.mk
4,
开始编译:
预编译,完成后 echo $? 看看是不是正常完成:
[root@centos10 rtl8188gu-master]# make
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/5.4.266-1.el7.elrepo.x86_64/build M=/root/11/rtl8188gu-master modules
make[1]: Entering directory `/usr/src/kernels/5.4.266-1.el7.elrepo.x86_64'CC [M] /root/11/rtl8188gu-master/core/rtw_cmd.oCC [M] /root/11/rtl8188gu-master/core/rtw_security.oCC [M] /root/11/rtl8188gu-master/core/rtw_debug.oCC [M] /root/11/rtl8188gu-master/core/rtw_io.oCC [M] /root/11/rtl8188gu-master/core/rtw_ioctl_query.oCC [M] /root/11/rtl8188gu-master/core/rtw_ioctl_set.oCC [M] /root/11/rtl8188gu-master/core/rtw_ieee80211.oCC [M] /root/11/rtl8188gu-master/core/rtw_mlme.oCC [M] /root/11/rtl8188gu-master/core/rtw_mlme_ext.oCC [M] /root/11/rtl8188gu-master/core/rtw_mi.oCC [M] /root/11/rtl8188gu-master/core/rtw_wlan_util.oCC [M] /root/11/rtl8188gu-master/core/rtw_vht.oCC [M] /root/11/rtl8188gu-master/core/rtw_pwrctrl.oCC [M] /root/11/rtl8188gu-master/core/rtw_rf.oCC [M] /root/11/rtl8188gu-master/core/rtw_recv.oCC [M] /root/11/rtl8188gu-master/core/rtw_sta_mgt.oCC [M] /root/11/rtl8188gu-master/core/rtw_ap.oCC [M] /root/11/rtl8188gu-master/core/rtw_xmit.oCC [M] /root/11/rtl8188gu-master/core/rtw_p2p.oCC [M] /root/11/rtl8188gu-master/core/rtw_rson.oCC [M] /root/11/rtl8188gu-master/core/rtw_tdls.oCC [M] /root/11/rtl8188gu-master/core/rtw_br_ext.oCC [M] /root/11/rtl8188gu-master/core/rtw_iol.oCC [M] /root/11/rtl8188gu-master/core/rtw_sreset.oCC [M] /root/11/rtl8188gu-master/core/rtw_btcoex_wifionly.oCC [M] /root/11/rtl8188gu-master/core/rtw_btcoex.oCC [M] /root/11/rtl8188gu-master/core/rtw_beamforming.oCC [M] /root/11/rtl8188gu-master/core/rtw_odm.oCC [M] /root/11/rtl8188gu-master/core/efuse/rtw_efuse.oCC [M] /root/11/rtl8188gu-master/os_dep/osdep_service.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/os_intfs.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/usb_intf.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/usb_ops_linux.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/ioctl_linux.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/xmit_linux.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/mlme_linux.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/recv_linux.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/ioctl_cfg80211.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/rtw_cfgvendor.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/wifi_regd.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/rtw_android.oCC [M] /root/11/rtl8188gu-master/os_dep/linux/rtw_proc.oCC [M] /root/11/rtl8188gu-master/hal/hal_intf.oCC [M] /root/11/rtl8188gu-master/hal/hal_com.oCC [M] /root/11/rtl8188gu-master/hal/hal_com_phycfg.oCC [M] /root/11/rtl8188gu-master/hal/hal_phy.oCC [M] /root/11/rtl8188gu-master/hal/hal_dm.oCC [M] /root/11/rtl8188gu-master/hal/hal_dm_acs.oCC [M] /root/11/rtl8188gu-master/hal/hal_btcoex_wifionly.oCC [M] /root/11/rtl8188gu-master/hal/hal_btcoex.oCC [M] /root/11/rtl8188gu-master/hal/hal_mp.oCC [M] /root/11/rtl8188gu-master/hal/hal_mcc.oCC [M] /root/11/rtl8188gu-master/hal/hal_hci/hal_usb.oCC [M] /root/11/rtl8188gu-master/hal/led/hal_usb_led.oCC [M] /root/11/rtl8188gu-master/hal/HalPwrSeqCmd.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/Hal8710BPwrSeq.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/rtl8710b_sreset.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/rtl8710b_hal_init.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/rtl8710b_phycfg.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/rtl8710b_rf6052.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/rtl8710b_dm.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/rtl8710b_rxdesc.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/rtl8710b_cmd.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/hal8710b_fw.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/rtl8710b_lps_poff.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/usb/usb_halinit.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/usb/rtl8710bu_led.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/usb/rtl8710bu_xmit.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/usb/rtl8710bu_recv.oCC [M] /root/11/rtl8188gu-master/hal/rtl8710b/usb/usb_ops.oCC [M] /root/11/rtl8188gu-master/hal/efuse/rtl8710b/HalEfuseMask8710B_USB.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_debug.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_antdiv.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_soml.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_smt_ant.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_antdect.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_interface.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_phystatus.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_hwconfig.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_dig.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_pathdiv.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_rainfo.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_dynamictxpower.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_adaptivity.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_cfotracking.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_noisemonitor.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_acs.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_beamforming.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_dfs.oCC [M] /root/11/rtl8188gu-master/hal/phydm/txbf/halcomtxbf.oCC [M] /root/11/rtl8188gu-master/hal/phydm/txbf/haltxbfinterface.oCC [M] /root/11/rtl8188gu-master/hal/phydm/txbf/phydm_hal_txbf_api.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_adc_sampling.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_ccx.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_psd.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_primary_cca.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_cck_pd.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_rssi_monitor.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_auto_dbg.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_math_lib.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_api.oCC [M] /root/11/rtl8188gu-master/hal/phydm/phydm_pow_train.oCC [M] /root/11/rtl8188gu-master/hal/phydm/halrf/halrf.oCC [M] /root/11/rtl8188gu-master/hal/phydm/halrf/halphyrf_ce.oCC [M] /root/11/rtl8188gu-master/hal/phydm/halrf/halrf_powertracking_ce.oCC [M] /root/11/rtl8188gu-master/hal/phydm/halrf/halrf_powertracking.oCC [M] /root/11/rtl8188gu-master/hal/phydm/halrf/halrf_kfree.oCC [M] /root/11/rtl8188gu-master/hal/phydm/rtl8710b/halhwimg8710b_bb.oCC [M] /root/11/rtl8188gu-master/hal/phydm/rtl8710b/halhwimg8710b_mac.oCC [M] /root/11/rtl8188gu-master/hal/phydm/rtl8710b/halhwimg8710b_rf.oCC [M] /root/11/rtl8188gu-master/hal/phydm/rtl8710b/phydm_regconfig8710b.oCC [M] /root/11/rtl8188gu-master/hal/phydm/rtl8710b/phydm_rtl8710b.oCC [M] /root/11/rtl8188gu-master/hal/phydm/halrf/rtl8710b/halrf_8710b.oCC [M] /root/11/rtl8188gu-master/hal/btc/halbtc8723bwifionly.oCC [M] /root/11/rtl8188gu-master/hal/btc/halbtc8822bwifionly.oCC [M] /root/11/rtl8188gu-master/hal/btc/halbtc8821cwifionly.oCC [M] /root/11/rtl8188gu-master/platform/platform_ops.oLD [M] /root/11/rtl8188gu-master/8188gu.oBuilding modules, stage 2.MODPOST 1 modulesCC [M] /root/11/rtl8188gu-master/8188gu.mod.oLD [M] /root/11/rtl8188gu-master/8188gu.ko
make[1]: Leaving directory `/usr/src/kernels/5.4.266-1.el7.elrepo.x86_64'
[root@centos10 rtl8188gu-master]# echo $?
0
开始驱动安装:
[root@centos10 rtl8188gu-master]# make install
install -p -m 644 8188gu.ko /lib/modules/5.4.266-1.el7.elrepo.x86_64/kernel/drivers/net/wireless/
/sbin/depmod -a 5.4.266-1.el7.elrepo.x86_64
可以看到,驱动是安装到了/lib/modules/5.4.266-1.el7.elrepo.x86_64/kernel/drivers/net/wireless/这个目录下,并且最后depmod 了一下
三,
检查驱动安装和使用驱动
网卡驱动安装基本上算是完成了,现在需要彻底激活此网卡
查看网卡的驱动模块是否正确加载:
没有任何输出,如果正确加载会有输出的哦
[root@centos10 rtl8188gu-master]# lsmod |grep 8188
这个时候不要慌,看看该网卡驱动的详细信息:
[root@centos10 rtl8188gu-master]# modinfo /lib/modules/5.4.266-1.el7.elrepo.x86_64/kernel/drivers/net/wireless/8188gu.ko
filename: /lib/modules/5.4.266-1.el7.elrepo.x86_64/kernel/drivers/net/wireless/8188gu.ko
version: v5.2.20.2_28373.20180619
author: Realtek Semiconductor Corp.
description: Realtek Wireless Lan Driver
license: GPL
srcversion: 50084205D88612258B5BBBB
alias: usb:v0BDAp2005d*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDApB711d*dc*dsc*dp*icFFiscFFipFFin*
depends: cfg80211
retpoline: Y
name: 8188gu
vermagic: 5.4.266-1.el7.elrepo.x86_64 SMP mod_unload modversions
parm: rtw_ips_mode:The default IPS mode (int)
parm: rtw_lps_level:The default LPS level (int)
parm: rtw_usb_rxagg_mode:int
parm: rtw_dynamic_agg_enable:int
parm: rtw_drv_log_level:set log level when insert driver module, default log level is _DRV_INFO_ = 4 (uint)
parm: rtw_tx_bw_mode:The max tx bw for 2.4G and 5G. format is the same as rtw_bw_mode (uint)
parm: rtw_rx_ampdu_sz_limit_1ss:RX AMPDU size limit for 1SS link of each BW, 0xFF: no limitation (array of uint)
parm: rtw_rx_ampdu_sz_limit_2ss:RX AMPDU size limit for 2SS link of each BW, 0xFF: no limitation (array of uint)
parm: rtw_rx_ampdu_sz_limit_3ss:RX AMPDU size limit for 3SS link of each BW, 0xFF: no limitation (array of uint)
parm: rtw_rx_ampdu_sz_limit_4ss:RX AMPDU size limit for 4SS link of each BW, 0xFF: no limitation (array of uint)
parm: rtw_vht_enable:int
parm: rtw_vht_rx_mcs_map:VHT RX MCS map (uint)
parm: rtw_rf_config:int
parm: rtw_country_code:The default country code (in alpha2) (charp)
parm: rtw_channel_plan:The default chplan ID when rtw_alpha2 is not specified or valid (int)
parm: rtw_excl_chs:exclusive channel array (array of uint)
parm: rtw_qos_opt_enable:int
parm: ifname:The default name to allocate for first interface (charp)
parm: if2name:The default name to allocate for second interface (charp)
parm: rtw_pwrtrim_enable:int
parm: rtw_initmac:charp
parm: rtw_special_rf_path:int
parm: rtw_chip_version:int
parm: rtw_rfintfs:int
parm: rtw_lbkmode:int
parm: rtw_network_mode:int
parm: rtw_channel:int
parm: rtw_mp_mode:int
parm: rtw_wmm_enable:int
parm: rtw_vrtl_carrier_sense:int
parm: rtw_vcs_type:int
parm: rtw_busy_thresh:int
parm: rtw_ht_enable:int
parm: rtw_bw_mode:int
parm: rtw_ampdu_enable:int
parm: rtw_rx_stbc:int
parm: rtw_rx_ampdu_amsdu:int
parm: rtw_tx_ampdu_amsdu:int
parm: rtw_beamform_cap:int
parm: rtw_lowrate_two_xmit:int
parm: rtw_power_mgnt:int
parm: rtw_smart_ps:int
parm: rtw_low_power:int
parm: rtw_wifi_spec:int
parm: rtw_full_ch_in_p2p_handshake:int
parm: rtw_antdiv_cfg:int
parm: rtw_antdiv_type:int
parm: rtw_drv_ant_band_switch:int
parm: rtw_single_ant_path:int
parm: rtw_switch_usb_mode:int
parm: rtw_enusbss:int
parm: rtw_hwpdn_mode:int
parm: rtw_hwpwrp_detect:int
parm: rtw_hw_wps_pbc:int
parm: rtw_check_hw_status:int
parm: rtw_max_roaming_times:The max roaming times to try (uint)
parm: rtw_mc2u_disable:int
parm: rtw_80211d:Enable 802.11d mechanism (int)
parm: rtw_notch_filter:0:Disable, 1:Enable, 2:Enable only for P2P (uint)
parm: rtw_hiq_filter:0:allow all, 1:allow special, 2:deny all (uint)
parm: rtw_adaptivity_en:0:disable, 1:enable (uint)
parm: rtw_adaptivity_mode:0:normal, 1:carrier sense (uint)
parm: rtw_adaptivity_dml:0:disable, 1:enable (uint)
parm: rtw_adaptivity_dc_backoff:DC backoff for Adaptivity (uint)
parm: rtw_adaptivity_th_l2h_ini:th_l2h_ini for Adaptivity (int)
parm: rtw_adaptivity_th_edcca_hl_diff:th_edcca_hl_diff for Adaptivity (int)
parm: rtw_amplifier_type_2g:BIT3:2G ext-PA, BIT4:2G ext-LNA (uint)
parm: rtw_amplifier_type_5g:BIT6:5G ext-PA, BIT7:5G ext-LNA (uint)
parm: rtw_RFE_type:default init value:64 (uint)
parm: rtw_powertracking_type:default init value:64 (uint)
parm: rtw_GLNA_type:default init value:0 (uint)
parm: rtw_TxBBSwing_2G:default init value:0xFF (uint)
parm: rtw_TxBBSwing_5G:default init value:0xFF (uint)
parm: rtw_OffEfuseMask:default open Efuse Mask value:0 (uint)
parm: rtw_FileMaskEfuse:default drv Mask Efuse value:0 (uint)
parm: rtw_rxgain_offset_2g:default RF Gain 2G Offset value:0 (uint)
parm: rtw_rxgain_offset_5gl:default RF Gain 5GL Offset value:0 (uint)
parm: rtw_rxgain_offset_5gh:uint
parm: rtw_rxgain_offset_5gm:default RF Gain 5GM Offset value:0 (uint)
parm: rtw_pll_ref_clk_sel:force pll_ref_clk_sel, 0xF:use autoload value (uint)
parm: rtw_tx_pwr_by_rate:0:Disable, 1:Enable, 2: Depend on efuse (int)
parm: rtw_target_tx_pwr_2g_a:2.4G target tx power (unit:dBm) of RF path A for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_2g_b:2.4G target tx power (unit:dBm) of RF path B for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_2g_c:2.4G target tx power (unit:dBm) of RF path C for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_2g_d:2.4G target tx power (unit:dBm) of RF path D for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_phy_file_path:The path of phy parameter (charp)
parm: rtw_load_phy_file:PHY File Bit Map (int)
parm: rtw_decrypt_phy_file:Enable Decrypt PHY File (int)
parm: rtw_en_napi:int
parm: rtw_en_gro:int
parm: rtw_iqk_fw_offload:int
可以看到该网卡驱动依赖的是另一个模块cfg80211,lsmod命令没有看到cfg80211,modinfo看不到该模块的信息(备注:该模块是kernel的验证签名模块)
[root@centos10 rtl8188gu-master]# find / -name cfg80211
/usr/src/kernels/5.4.266-1.el7.elrepo.x86_64/include/config/cfg80211
[root@centos10 rtl8188gu-master]# modinfo /usr/src/kernels/5.4.266-1.el7.elrepo.x86_64/include/config/cfg80211
modinfo: ERROR: Module /usr/src/kernels/5.4.266-1.el7.elrepo.x86_64/include/config/cfg80211 not found.
查看系统日志,可以看到网卡的USB无法使用:
[ 11.810876] Buffer I/O error on dev sr1, logical block 32640, async page read
[ 11.981365] sr 32:0:0:0: [sr1] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[ 11.981369] sr 32:0:0:0: [sr1] tag#0 CDB: Read(10) 28 00 00 00 ff 00 00 00 3c 00
[ 11.981371] blk_update_request: I/O error, dev sr1, sector 261120 op 0x0:(READ) flags 0x84700 phys_seg 30 prio class 0
[ 12.083530] sr 32:0:0:0: [sr1] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[ 12.083535] sr 32:0:0:0: [sr1] tag#0 CDB: Read(10) 28 00 00 00 ff 3c 00 00 04 00
[ 12.083537] blk_update_request: I/O error, dev sr1, sector 261360 op 0x0:(READ) flags 0x80700 phys_seg 2 prio class 0
[ 12.116606] sr 32:0:0:0: [sr1] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[ 12.116629] sr 32:0:0:0: [sr1] tag#0 CDB: Read(10) 28 00 00 00 ff 00 00 00 02 00
[ 12.116633] blk_update_request: I/O error, dev sr1, sector 261120 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[ 12.116725] Buffer I/O error on dev sr1, logical block 32640, async page read
[ 35.543061] usb 1-1: USB disconnect, device number 2
使用modprobe命令重新激活这两个模块(没有输出表示正确哦),并查看模块是否正确加载:
[root@centos10 rtl8188gu-master]# modprobe cfg80211
[root@centos10 rtl8188gu-master]# modprobe 8188gu
[root@centos10 rtl8188gu-master]# lsmod |grep 8188 ||grep cfg80211
8188gu 1007616 0
cfg80211 704512 1 8188gu
这个时候,可以看到cfg80211的模块信息了(上面的说看不到信息的话,我收回!!!!!,这里表明此模块是无线连接的支持模块,收回此模块是签名验证的说法!!!!!):
[root@centos10 rtl8188gu-master]# find / -name cfg80211.ko
/usr/lib/modules/5.4.266-1.el7.elrepo.x86_64/kernel/net/wireless/cfg80211.ko
[root@centos10 rtl8188gu-master]# modinfo /usr/lib/modules/5.4.266-1.el7.elrepo.x86_64/kernel/net/wireless/cfg80211.ko
filename: /usr/lib/modules/5.4.266-1.el7.elrepo.x86_64/kernel/net/wireless/cfg80211.ko
alias: net-pf-16-proto-16-family-nl80211
description: wireless configuration support
license: GPL
author: Johannes Berg
srcversion: 6CA837C31154DE1B46FBEC0
depends: rfkill
retpoline: Y
intree: Y
name: cfg80211
vermagic: 5.4.266-1.el7.elrepo.x86_64 SMP mod_unload modversions
parm: bss_entries_limit:limit to number of scan BSS entries (per wiphy, default 1000) (int)
parm: ieee80211_regdom:IEEE 802.11 regulatory domain code (charp)
parm: cfg80211_disable_40mhz_24ghz:Disable 40MHz support in the 2.4GHz band (bool)
此时并没有看到这个新安装的网卡:
[root@centos10 rtl8188gu-master]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 192.168.123.20 netmask 255.255.255.0 broadcast 192.168.123.255inet6 fd15:4ba5:5a2b:1008:162e:7500:4e67:2fb1 prefixlen 64 scopeid 0x0<global>inet6 fe80::523b:7d77:34e9:fa42 prefixlen 64 scopeid 0x20<link>ether 00:0c:29:e8:89:a2 txqueuelen 1000 (Ethernet)RX packets 2903 bytes 217349 (212.2 KiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 2910 bytes 629873 (615.1 KiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0device interrupt 19 base 0x2000 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536inet 127.0.0.1 netmask 255.0.0.0inet6 ::1 prefixlen 128 scopeid 0x10<host>loop txqueuelen 1000 (Local Loopback)RX packets 0 bytes 0 (0.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 0 bytes 0 (0.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
可以看到,ens33这个网卡有异常,好像多了ipv6的信息,应该是一个ipv6的,查看系统日志,看到如下报错:
<info> [1705156203.3089] device (ens33): ipv6: duplicate address check faile
因此,决定关闭ipv6,关闭步骤如下:
1,
删除ens33网卡内的所有关于ipv6的信息,最终该网卡的配置文件如下:
[root@centos10 rtl8188gu-master]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens33
UUID=abed039b-c453-47ee-acd4-301974b75aab
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.123.20
GATEWAY=192.168.123.2
NETMASK=255.255.225.0
DNS1=223.5.5.5
DNS1=223.6.6.6
2,
内核屏蔽ipv6:
[root@centos10 rtl8188gu-master]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
最后两行屏蔽ipv6的,然后sysctl -p 激活此设置
3,
network这个文件末尾添加no
[root@centos10 rtl8188gu-master]# cat /etc/sysconfig/network
# Created by anaconda
NETWORKING_IPV6=no
4,
重启网络
[root@centos10 rtl8188gu-master]# systemctl restart NetworkManager
[root@centos10 rtl8188gu-master]# systemctl restart network
5,
重新插拔网卡,再次查看网卡信息,新网卡出来了:
[root@centos10 rtl8188gu-master]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000link/ether 00:0c:29:e8:89:a2 brd ff:ff:ff:ff:ff:ffinet 192.168.123.20/24 brd 192.168.123.255 scope global noprefixroute ens33valid_lft forever preferred_lft forever
3: wls35u1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000link/ether 00:5c:c2:ce:dc:24 brd ff:ff:ff:ff:ff:ff
现在需要连接WiFi了,有很多方法,比如上面资料里提到的wpa_suppliant_withoutopenssl-master,或者直接在桌面图形化方式连接
本次采用桌面方式,因此,先安装一个桌面:
yum group install "GNOME Desktop"
安装完毕后,startx命令进入桌面:
此时的网卡还没有激活,因此,激活先,看到网卡里有一个up就可以啦:
[root@centos10 rtl8188gu-master]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000link/ether 00:0c:29:e8:89:a2 brd ff:ff:ff:ff:ff:ffinet 192.168.123.20/24 brd 192.168.123.255 scope global noprefixroute ens33valid_lft forever preferred_lft forever
3: wls35u1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000link/ether 00:5c:c2:ce:dc:24 brd ff:ff:ff:ff:ff:ff
扫描WiFi热点:
[root@centos10 rtl8188gu-master]# nmcli device wifi list
IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY mywifi Infra 5 270 Mbit/s 54 ▂▄__ WPA2 -- Infra 5 270 Mbit/s 54 ▂▄__ WPA2 mywifi-WiFi5 Infra 5 270 Mbit/s 52 ▂▄__ WPA2 ChinaNet-gTUm Infra 5 130 Mbit/s 45 ▂▄__ WPA1 WPA2 ChinaNet-6b4R Infra 2 130 Mbit/s 30 ▂___ WPA1 YBJ Infra 1 130 Mbit/s 29 ▂___ WPA1 WPA2 @PHICOMM_40 Infra 2 270 Mbit/s 29 ▂___ WPA1 WPA2 MIQI Infra 11 195 Mbit/s 29 ▂___ WPA1 WPA2 -- Infra 11 195 Mbit/s 27 ▂___ WPA1 WPA2 ChinaNet-wfJ9 Infra 10 130 Mbit/s 25 ▂___ WPA1 WPA2 ChinaNet-B9QD Infra 6 130 Mbit/s 24 ▂___ WPA1 WPA2 midea_db_0821 Infra 3 65 Mbit/s 22 ▂___ WPA2 qiangweiguo_Wi-Fi5 Infra 9 130 Mbit/s 22 ▂___ WPA1 WPA2 -- Infra 6 540 Mbit/s 20 ▂___ WPA1 WPA2 -- Infra 8 130 Mbit/s 20 ▂___ WPA2 qiangweiguo Infra 9 130 Mbit/s 20 ▂___ WPA1 WPA2 -- Infra 9 130 Mbit/s 19 ▂___ WPA2
或者使用iwlist命令(这个命令以后再说,现在只是演示一下):
[root@centos10 wireless_tools]# iwlist wls35u1 scan
wls35u1 Scan completed :Cell 01 - Address: 74:05:A5:DC:86:C2ESSID:"YBJ"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.412 GHz (Channel 1)Encryption key:onBit Rates:144 Mb/sExtra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202IE: WPA Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKQuality=0/100 Signal level=17/100 Extra:fm=0003Cell 02 - Address: 50:33:F0:A4:02:3EESSID:"801"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.412 GHz (Channel 1)Encryption key:onBit Rates:780 Mb/sExtra:wpa_ie=dd1a0050f20101000050f20202000050f2020050f20401000050f202IE: WPA Version 1Group Cipher : TKIPPairwise Ciphers (2) : TKIP CCMPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : TKIPPairwise Ciphers (2) : TKIP CCMPAuthentication Suites (1) : PSKQuality=0/100 Signal level=13/100 Extra:fm=0003Cell 03 - Address: F4:32:3D:98:9A:39ESSID:"ChinaNet-6b4R"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.417 GHz (Channel 2)Encryption key:onBit Rates:144 Mb/sExtra:wpa_ie=dd1a0050f20101000050f20202000050f2040050f20201000050f202IE: WPA Version 1Group Cipher : TKIPPairwise Ciphers (2) : CCMP TKIPAuthentication Suites (1) : PSKQuality=0/100 Signal level=18/100 Extra:fm=0001Cell 04 - Address: CC:81:DA:55:EF:48ESSID:"@PHICOMM_40"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.417 GHz (Channel 2)Encryption key:onBit Rates:300 Mb/sExtra:wpa_ie=dd1a0050f20101000050f20202000050f2020050f20401000050f202IE: WPA Version 1Group Cipher : TKIPPairwise Ciphers (2) : TKIP CCMPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : TKIPPairwise Ciphers (2) : TKIP CCMPAuthentication Suites (1) : PSKQuality=0/100 Signal level=14/100 Extra:fm=0001Cell 05 - Address: F8:CD:C8:90:BC:32ESSID:"ChinaNet-gTUm"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.432 GHz (Channel 5)Encryption key:onBit Rates:144 Mb/sExtra:wpa_ie=dd1a0050f20101000050f20202000050f2040050f20201000050f202IE: WPA Version 1Group Cipher : TKIPPairwise Ciphers (2) : CCMP TKIPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : TKIPPairwise Ciphers (2) : CCMP TKIPAuthentication Suites (1) : PSKIE: Unknown: DD7D0050F204104A0001101044000101103B000103104700107B882E1F7DD6CD39808942E5FA1712CB1021000842726F6164636F6D1023000842726F6164636F6D1024000431323334104200033236371054000800060050F20400011011000A42726F6164636F6D4150100800022008103C0001031049000600372A000120Quality=0/100 Signal level=27/100 Extra:fm=0003Cell 06 - Address: 50:33:F0:CD:21:D9ESSID:"mywifi"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.432 GHz (Channel 5)Encryption key:onBit Rates:867 Mb/sExtra:rsn_ie=30140100000fac040100000fac040100000fac020000IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKIE: Unknown: DD9F0050F204104A0001101044000102103B00010310470010BC329E001DD811B286015033F0CD21D81021001852616C696E6B20546563686E6F6C6F67792C20436F72702E1023001C52616C696E6B20576972656C6573732041636365737320506F696E74102400065254323836301042000831323334353637381054000800060050F20400011011000B52616C696E6B4150535F3010080002008C103C000101Quality=0/100 Signal level=33/100 Extra:fm=0003Cell 07 - Address: 52:33:F0:2D:21:D9ESSID:"mywifi-WiFi5"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.432 GHz (Channel 5)Encryption key:onBit Rates:867 Mb/sExtra:rsn_ie=30140100000fac040100000fac040100000fac020000IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKIE: Unknown: DD9F0050F204104A0001101044000102103B00010310470010BC329E001DD811B286015033F0CD21D81021001852616C696E6B20546563686E6F6C6F67792C20436F72702E1023001C52616C696E6B20576972656C6573732041636365737320506F696E74102400065254323836301042000831323334353637381054000800060050F20400011011000B52616C696E6B4150535F3210080002008C103C000101Quality=0/100 Signal level=33/100 Extra:fm=0003Cell 08 - Address: 52:33:F0:7D:21:D9ESSID:""Protocol:IEEE 802.11bgnMode:MasterFrequency:2.432 GHz (Channel 5)Encryption key:onBit Rates:867 Mb/sExtra:rsn_ie=30140100000fac040100000fac040100000fac020000IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKIE: Unknown: DD270050F204104A000110104400010210470010BC329E001DD811B286015033F0CD21D8103C000101Quality=0/100 Signal level=33/100 Extra:fm=0001Cell 09 - Address: 08:10:7B:F0:7E:21ESSID:"zhwww"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.447 GHz (Channel 8)Encryption key:onBit Rates:780 Mb/sExtra:rsn_ie=30140100000fac040100000fac040100000fac020000IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKIE: Unknown: DDA90050F204104A0001101044000102103B0001031047001063041253101920191227AABBCCDDEEFF1021001852616C696E6B20546563686E6F6C6F67792C20436F72702E1023001C52616C696E6B20576972656C6573732041636365737320506F696E74102400065254323836301042000831323334353637381054000800060050F20400011011000B52616C696E6B4150535F3010080002218C103C0001011049000600372A000120Quality=0/100 Signal level=17/100 Extra:fm=0003Cell 10 - Address: 0A:10:7B:70:7E:21ESSID:""Protocol:IEEE 802.11bgnMode:MasterFrequency:2.447 GHz (Channel 8)Encryption key:onBit Rates:780 Mb/sExtra:rsn_ie=30140100000fac040100000fac040100000fac020000IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKQuality=0/100 Signal level=18/100 Extra:fm=0001Cell 11 - Address: F8:2F:65:77:5A:00ESSID:"qiangweiguo"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.452 GHz (Channel 9)Encryption key:onBit Rates:144 Mb/sExtra:wpa_ie=dd1a0050f20101000050f20202000050f2040050f20201000050f202IE: WPA Version 1Group Cipher : TKIPPairwise Ciphers (2) : CCMP TKIPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : TKIPPairwise Ciphers (2) : CCMP TKIPAuthentication Suites (1) : PSKIE: Unknown: DD230050F204104A0001101044000102100800020780103C0001011049000600372A000120Quality=0/100 Signal level=11/100 Extra:fm=0001Cell 12 - Address: 58:C6:7E:FB:4F:38ESSID:"ChinaNet-wfJ9"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.457 GHz (Channel 10)Encryption key:onBit Rates:144 Mb/sExtra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202IE: WPA Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKIE: Unknown: DD7E0050F204104A0001101044000102103B000103104700105D2DBCBB9D644948047E083B1A419A72102100094669626572686F6D65102300094669626572686F6D651024000631323334353610420004313233341054000800060050F20400011011000B4669626572686F6D6541501008000220081049000600372A000120Quality=0/100 Signal level=13/100 Extra:fm=0003Cell 13 - Address: 44:F9:71:0D:A0:B6ESSID:"MIQI"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.462 GHz (Channel 11)Encryption key:onBit Rates:1.3 Gb/sExtra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202IE: WPA Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKIE: Unknown: DD760050F204104A0001101044000102103B000103104700100000000000001000000044F9710DA0B6102100074D455243555259102300085952313930304D4710240003312E30104200001054000800060050F2040001101100085952313930304D47100800022288103C0001031049000600372A000120Quality=0/100 Signal level=16/100 Extra:fm=0003Cell 14 - Address: 46:F9:71:2D:A0:B6ESSID:""Protocol:IEEE 802.11bgnMode:MasterFrequency:2.462 GHz (Channel 11)Encryption key:onBit Rates:1.3 Gb/sExtra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202IE: WPA Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKQuality=0/100 Signal level=17/100 Extra:fm=0001Cell 15 - Address: F8:2F:65:77:5A:05ESSID:""Protocol:IEEE 802.11bgnMode:MasterFrequency:2.452 GHz (Channel 9)Encryption key:onBit Rates:144 Mb/sExtra:rsn_ie=30140100000fac040100000fac040100000fac020c00IE: IEEE 802.11i/WPA2 Version 1Group Cipher : CCMPPairwise Ciphers (1) : CCMPAuthentication Suites (1) : PSKIE: Unknown: DD230050F204104A0001101044000102100800020780103C0001011049000600372A000120Quality=0/100 Signal level=12/100 Extra:fm=0001Cell 16 - Address: B0:95:8E:40:4D:59ESSID:"智诚伟业建筑劳务5.8"Protocol:IEEE 802.11bgnMode:MasterFrequency:2.462 GHz (Channel 11)Encryption key:onBit Rates:300 Mb/sExtra:wpa_ie=dd1a0050f20101000050f20202000050f2020050f20401000050f202IE: WPA Version 1Group Cipher : TKIPPairwise Ciphers (2) : TKIP CCMPAuthentication Suites (1) : PSKExtra:IE: IEEE 802.11i/WPA2 Version 1Group Cipher : TKIPPairwise Ciphers (2) : TKIP CCMPAuthentication Suites (1) : PSKQuality=0/100 Signal level=12/100
OK,扫描热点完毕后,就可以在桌面看到所有WiFi了,然后点击自己的WiFi,输入密码连接就可以了,我的WiFi名称是 mywif:
密码输入后,就可以看到网卡的ip了:
[root@centos10 wireless_tools]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000link/ether 00:0c:29:e8:89:a2 brd ff:ff:ff:ff:ff:ffinet 192.168.123.20/24 brd 192.168.123.255 scope global noprefixroute ens33valid_lft forever preferred_lft forever
3: wls35u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000link/ether 00:5c:c2:ce:dc:24 brd ff:ff:ff:ff:ff:ffinet 192.168.2.7/24 brd 192.168.2.255 scope global noprefixroute dynamic wls35u1valid_lft 604784sec preferred_lft 604784secinet6 240e:348:371:b0b0:6bbe:33f1:30d9:88df/64 scope global noprefixroute dynamic valid_lft 7186sec preferred_lft 3586secinet6 fe80::614:9f3:e3d3:e123/64 scope link noprefixroute valid_lft forever preferred_lft forever
查看系统日志,可以看到网卡如何连接的:
Jan 15 07:45:25 centos10 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): wls35u1: link becomes ready
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.6671] device (wls35u1): supplicant interface state: 4-way handshake -> completed
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.6671] device (wls35u1): Activation: (wifi) Stage 2 of 5 (Device Configure) successful. Connected to wireless network "mywifi"
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.6671] device (p2p-dev-wls35u1): supplicant management interface state: 4-way handshake -> completed
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.6672] device (wls35u1): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.6677] dhcp4 (wls35u1): activation: beginning transaction (timeout in 45 seconds)
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.6693] dhcp4 (wls35u1): dhclient started with pid 15641
Jan 15 07:45:25 centos10 avahi-daemon[27084]: Registering new address record for fe80::614:9f3:e3d3:e123 on wls35u1.*.
Jan 15 07:45:25 centos10 dhclient[15641]: DHCPDISCOVER on wls35u1 to 255.255.255.255 port 67 interval 4 (xid=0x6756f49f)
Jan 15 07:45:25 centos10 dhclient[15641]: DHCPREQUEST on wls35u1 to 255.255.255.255 port 67 (xid=0x6756f49f)
Jan 15 07:45:25 centos10 dhclient[15641]: DHCPOFFER from 192.168.2.1
Jan 15 07:45:25 centos10 dhclient[15641]: DHCPACK from 192.168.2.1 (xid=0x6756f49f)
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8488] dhcp4 (wls35u1): address 192.168.2.7
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8488] dhcp4 (wls35u1): plen 24 (255.255.255.0)
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8488] dhcp4 (wls35u1): gateway 192.168.2.1
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8488] dhcp4 (wls35u1): lease time 604800
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8488] dhcp4 (wls35u1): nameserver '192.168.2.1'
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8488] dhcp4 (wls35u1): wins '192.168.2.1'
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8488] dhcp4 (wls35u1): state changed unknown -> bound
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8492] device (wls35u1): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Jan 15 07:45:25 centos10 avahi-daemon[27084]: Joining mDNS multicast group on interface wls35u1.IPv4 with address 192.168.2.7.
Jan 15 07:45:25 centos10 avahi-daemon[27084]: New relevant interface wls35u1.IPv4 for mDNS.
Jan 15 07:45:25 centos10 avahi-daemon[27084]: Registering new address record for 192.168.2.7 on wls35u1.IPv4.
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8493] device (wls35u1): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8494] device (wls35u1): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Jan 15 07:45:25 centos10 NetworkManager[15138]: <info> [1705275925.8508] device (wls35u1): Activation: successful, device activated.
Jan 15 07:45:25 centos10 dhclient[15641]: bound to 192.168.2.7 -- renewal in 243510 seconds.
Jan 15 07:45:25 centos10 dbus[978]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 15 07:45:25 centos10 systemd: Starting Network Manager Script Dispatcher Service...
Jan 15 07:45:25 centos10 dbus[978]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 15 07:45:25 centos10 nm-dispatcher: req:1 'up' [wls35u1]: new request (4 scripts)
Jan 15 07:45:25 centos10 systemd: Started Network Manager Script Dispatcher Service.
Jan 15 07:45:25 centos10 nm-dispatcher: req:1 'up' [wls35u1]: start running ordered scripts...
Jan 15 07:45:25 centos10 systemd: Unit iscsi.service cannot be reloaded because it is inactive.
Jan 15 07:45:28 centos10 NetworkManager[15138]: <info> [1705275928.3065] dhcp6 (wls35u1): activation: beginning transaction (timeout in 45 seconds)
Jan 15 07:45:28 centos10 NetworkManager[15138]: <info> [1705275928.3074] dhcp6 (wls35u1): dhclient started with pid 15674
Jan 15 07:45:28 centos10 avahi-daemon[27084]: Registering new address record for 240e:348:371:b0b0:6bbe:33f1:30d9:88df on wls35u1.*.
Jan 15 07:45:28 centos10 NetworkManager[15138]: <info> [1705275928.3079] policy: set 'mywifi' (wls35u1) as default for IPv6 routing and DNS
Jan 15 07:45:28 centos10 avahi-daemon[27084]: Withdrawing address record for fe80::614:9f3:e3d3:e123 on wls35u1.
Jan 15 07:45:29 centos10 dhclient[15674]: XMT: Info-Request on wls35u1, interval 1020ms.
Jan 15 07:45:29 centos10 dhclient[15674]: RCV: Reply message on wls35u1 from fe80::1.
Jan 15 07:45:29 centos10 NetworkManager[15138]: <info> [1705275929.1308] dhcp6 (wls35u1): nameserver 'fe80::1'
Jan 15 07:45:29 centos10 NetworkManager[15138]: <info> [1705275929.1308] dhcp6 (wls35u1): state changed unknown -> bound
Jan 15 07:45:29 centos10 nm-dispatcher: req:2 'dhcp6-change' [wls35u1]: new request (4 scripts)
Jan 15 07:45:29 centos10 nm-dispatcher: req:2 'dhcp6-change' [wls35u1]: start running ordered scripts...
Jan 15 07:45:29 centos10 NetworkManager[15138]: <info> [1705275929.1332] dhcp6 (wls35u1): client pid 15674 exited with status 0
Jan 15 07:45:29 centos10 NetworkManager[15138]: <info> [1705275929.1332] dhcp6 (wls35u1): state changed bound -> terminated
也有网卡配置文件了,这个文件自动生成的:
[root@centos10 wireless_tools]# cat /etc/sysconfig/network-scripts/ifcfg-mywifi
ESSID=mywifi
MODE=Managed
KEY_MGMT=WPA-PSK
SECURITYMODE=open
MAC_ADDRESS_RANDOMIZATION=default
TYPE=Wireless
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=mywifi
UUID=7a115cd8-212d-4c6c-af4d-0edf72fab737
ONBOOT=yes
在查看系统日志,可以发现有一个报错,但该报错不影响网卡的使用,insmod出现loading out-of-tree module taints kernel,该报错主要是安全警示
以后在讲这些报错的处理以及内核和模块的管理工作
本例以完美实现,但奇怪的是ipv6为什么影响新网卡的模块加载,这个确实是有点让人疑惑的,有高手知道的话,可以告诉下我原因,不胜感激!!!!