Ubuntu 安装网卡驱动

搭建Linux平台的无线热点,需要无线网卡和驱动都要支持 AP。

试了下Ubuntu平台默认驱动并不支持AP模式,所以需要更换驱动,具体操作步骤如下:

1.找到自己网卡芯片的型号,由于我的环境是搭建在本地的虚拟机上的,wifi是usb网卡。所以查找usb设备:lsusb

root@ubuntu:~/rtl8188eus# lsusb
Bus 001 Device 003: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
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

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.0-131-generic/build M=/root/rtl8188eu  modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-131-generic'
arch/x86/Makefile:133: stack-protector enabled but compiler support broken
arch/x86/Makefile:148: CONFIG_X86_X32 enabled but no binutils support
Makefile:704: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make[1]: gcc: Command not found
  CC [M]  /root/rtl8188eu/core/rtw_ap.o
/bin/bash: gcc: command not found
scripts/Makefile.build:277: recipe for target '/root/rtl8188eu/core/rtw_ap.o' failed
make[2]: *** [/root/rtl8188eu/core/rtw_ap.o] Error 127
Makefile:1437: recipe for target '_module_/root/rtl8188eu' failed
make[1]: *** [_module_/root/rtl8188eu] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-131-generic'
Makefile:151: recipe for target 'modules' failed
make: *** [modules] Error 2

  这是因为缺少了 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: 1
       bus info: pci@0000:02:01.0
       logical name: ens33
       version: 01
       serial: 00:0c:29:b9:f1:0e
       size: 1Gbit/s
       capacity: 1Gbit/s
        64 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.21-k8-NAPI duplex=full ip=10.1.4.24 latency=0 link=yes mingnt=255 multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:19 memory:fd5c0000-fd5dffff memory:fdff0000-fdffffff ioport:2000(size=64) memory:fd500000-fd50ffff
  *-network DISABLED
       description: Wireless interface
       physical id: 2
       bus info: usb@1:1
       logical name: wlx488ad2a0e0fe
       serial: 48: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

原文地址:https://www.cnblogs.com/shenh/p/10031635.html