搭建Linux平台的无线热点,需要无线网卡和驱动都要支持 AP。
试了下Ubuntu平台默认驱动并不支持AP模式,所以需要更换驱动,具体操作步骤如下:
1.找到自己网卡芯片的型号,由于我的环境是搭建在本地的虚拟机上的,wifi是usb网卡。所以查找usb设备:lsusb
root@ubuntu:~/rtl8188eus# lsusb
Bus Device : ID 0bda: Realtek Semiconductor Corp. RTL8188EUS .11n Wireless Network Adapter
Bus Device : ID 1d6b: Linux Foundation 2.0 root hub
Bus Device : ID 0e0f: VMware, Inc. Virtual USB Hub
Bus Device : ID 0e0f: VMware, Inc. Virtual Mouse
Bus Device : ID 1d6b: Linux Foundation 1.1 root hub
2.通过查询信息可以或得 RTL8188EUS是我的无线网卡驱动,然后上GitHub搜索。
最终找到这个驱动:https://github.com/quickreflex/rtl8188eus
执行以下命令:
git clone https://github.com/lwfinger/rtl8188eu
make all
make install
make all 的时候可能报错
root@Ubuntu:~/rtl8188eu# make all
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.4.--generic/build M=/root/rtl8188eu modules
make[]: Entering directory '/usr/src/linux-headers-4.4.0-131-generic'
arch/x86/Makefile:: stack-protector enabled but compiler support broken
arch/x86/Makefile:: CONFIG_X86_X32 enabled but no binutils support
Makefile:: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make[]: gcc: Command not found
CC [M] /root/rtl8188eu/core/rtw_ap.o
/bin/bash: gcc: command not found
scripts/Makefile.build:: recipe for target '/root/rtl8188eu/core/rtw_ap.o' failed
make[]: *** [/root/rtl8188eu/core/rtw_ap.o] Error
Makefile:: recipe for target '_module_/root/rtl8188eu' failed
make[]: *** [_module_/root/rtl8188eu] Error
make[]: Leaving directory '/usr/src/linux-headers-4.4.0-131-generic'
Makefile:: recipe for target 'modules' failed
make: *** [modules] Error
这是因为缺少了 build-essential 软件包,它的作用是 提供编译程序必须软件包的列表信息。再更新下 linux-headers-generic
apt-get install linux-headers-generic
apt-get install build-essential
然后再执行 make all 和 make install
3.查询新的驱动:lshw -c network。 driver=rtl8188eu就是我们新安装上去的驱动
root@Ubuntu:~/rtl8188eus# lshw -c network
*-network
description: Ethernet interface
product: 82545EM Gigabit Ethernet Controller (Copper)
vendor: Intel Corporation
physical id:
bus info: pci@::01.0
logical name: ens33
version:
serial: :0c::b9:f1:0e
size: 1Gbit/s
capacity: 1Gbit/s
width: bits
clock: 66MHz
capabilities: pm pcix bus_master cap_list rom ethernet physical logical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000 driverversion=7.3.-k8-NAPI duplex=full ip=10.1.4.24 latency= link=yes mingnt= multicast=yes port=twisted pair speed=1Gbit/s
resources: irq: memory:fd5c0000-fd5dffff memory:fdff0000-fdffffff ioport:(size=) memory:fd500000-fd50ffff
*-network DISABLED
description: Wireless interface
physical id:
bus info: usb@:
logical name: wlx488ad2a0e0fe
serial: :8a:d2:a0:e0:fe
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=rtl8188eu multicast=yes wireless=unassociated
4.无线网络其他命令:
#开启网卡接口服务
ifconfig wlx488ad2a0e0fe up #查看设备上网络信息
iwconfig #默认使用所有无线网卡搜索
iwlist scanning | more #使用特定网卡搜索
iwlist wlx488ad2a0e0fe scan | more
iwlist wlx488ad2a0e0fe scan
提供另一个GitHub上的驱动:https://github.com/lwfinger/rtlwifi_new