1. 程式人生 > >Ubuntu 安裝網卡驅動

Ubuntu 安裝網卡驅動

inter 無線網 pair 1.0 bash tac 虛擬 cannot 找到

搭建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
       width: 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

Ubuntu 安裝網卡驅動