转载部分:

本人笔记本的型号为lenovo G510,Ubuntu 中,通常有线网卡为eth0,无线网卡则为wlan0,后续增加的以此类推(可能某些无线网卡型号命名为eth1,而非wlan0。用ifconfig命令查看系统的网卡信息,根本没有出现wlan0或者eth1,说明驱动没有安装。

安装网卡驱动的话,需要了解网卡类型,用lspci命令查看,发现我的网卡是

Broadcom Corporation BCM43142 802.11b/g/n (rev 01)

这个网卡是一个很老的网卡,已经很少用了,所以驱动非常难下载。尝试了很多办法,终于在下面的网上找到了:

​http://askubuntu.com/questions/175104/how-do-i-install-bcm43142-wireless-drivers-for-dell-vostro-3460-3560​

我所做的事情如下:

sudo apt-get install linux-headers$(uname -r | grep -Po "\-[a-z].*")

sudo apt-get install build-essential dkms

sudo apt-get install dpkg

sudo apt-get install bcmwl-kernel-source

然后无线网络就可以用了,用ifconfig命令发现出现了eth1

整理部分:

整理Shell脚本如下:

# Update and install necessary packages
apt-get update
apt-get install linux-image-$(uname -r|sed 's,[^-]*-[^-]*-,,') linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')

# Download some extra packages, that do the trick for "wl module not found"
wget http://old.kali.org/kali/pool/main/g/gcc-6/cpp-6_6.4.0-9_amd64.deb
wget http://old.kali.org/kali/pool/main/g/gcc-6/gcc-6-base_6.4.0-9_amd64.deb
wget http://old.kali.org/kali/pool/main/l/linux/linux-compiler-gcc-6-x86_4.13.10-1kali2_amd64.deb
wget http://old.kali.org/kali/pool/main/l/linux/linux-kbuild-4.13_4.13.10-1kali2_amd64.deb
wget http://old.kali.org/kali/pool/main/l/linux/linux-headers-4.13.0-kali1-common_4.13.10-1kali2_all.deb
wget http://old.kali.org/kali/pool/main/l/linux/linux-headers-4.13.0-kali1-amd64_4.13.10-1kali2_amd64.deb
wget http://old.kali.org/kali/pool/non-free/b/broadcom-sta/broadcom-sta-dkms_6.30.223.271-7_all.deb
wget http://old.kali.org/kali/pool/main/d/dkms/dkms_2.3-3_all.deb

# Install with correct order
dpkg -i cpp-6_6.4.0-9_amd64.deb
dpkg -i gcc-6-base_6.4.0-9_amd64.deb
dpkg -i linux-compiler-gcc-6-x86_4.13.10-1kali2_amd64.deb
dpkg -i linux-kbuild-4.13_4.13.10-1kali2_amd64.deb
dpkg -i linux-headers-4.13.0-kali1-common_4.13.10-1kali2_all.deb
dpkg -i linux-headers-4.13.0-kali1-amd64_4.13.10-1kali2_amd64.deb
dpkg -i broadcom-sta/broadcom-sta-dkms_6.30.223.271-7_all.deb
dpkg -i dkms_2.3-3_all.deb


# Install broadcom drivers
apt-get install broadcom-sta-dkms

# Enable modules and disabled unnecessary ones
modprobe -r b44 b43 b43legacy ssb brcmsmac bcma
modprobe wl

# Done :)
echo "WI-FI work now!"
echo "Don't forget to enable network-manager: nano /etc/NetworkManager/NetworkManager.conf to true and restart the service."

附github连接

​https://gist.github.com/speeddragon/2d4ea420a8a53407cb8218fa28c2a74b​