为ubuntu配置WiFi
创始人
2024-03-08 03:57:55
0

1.前提条件

ubuntu不论什么版本,如果想要正常使用wifi,必须在电脑的bios中把secure boot设定为disable

2.快捷指令(WiFi相关的常用命令行指令)

2.1查看电脑连接的蓝牙和网卡设备

rfkill list all

在这里插入图片描述

0: hci0: Bluetooth 这个是我电脑的蓝牙Soft blocked: noHard blocked: no
1: phy0: Wireless LAN 这个是我电脑内的网卡Soft blocked: noHard blocked: no
2: phy1: Wireless LAN这个是插到电脑上的usb网卡Soft blocked: noHard blocked: no

拔掉usb网卡后显示:
在这里插入图片描述
网上人有说联想电脑出现Hard blocked: yes,可以在终端输入:sudo modprobe -r ideapad_laptop,参考可能解决方案;

2.2查看所有设备的型号

lspci

在这里插入图片描述
这里的

00:14.3 Network controller: Intel Corporation Device 06f0 这个是网卡型号
00:15.0 Serial bus controller [0c80]: Intel Corporation Device 06e8 这个是有线网卡型号

或者

2.3单独查看网络设备

lspci -nnk | grep -i net

在这里插入图片描述
这里的

00:14.3 Network controller [0280]: Intel Corporation Device [8086:06f0] 这个是网卡型号
04:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. 
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller 
[10ec:8168] (rev 15) 这个是有线网卡型号

2.4查看网卡驱动

lspci -vvv

在这里插入图片描述

这里我截取网卡相关的片段

00:14.3 Network controller: Intel Corporation Device 06f0Subsystem: Intel Corporation Device 0074Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- Kernel driver in use: iwlwifiKernel modules: iwlwifi, wl

2.5显示的当前内核已经加载的模块和驱动

lsmod

在这里插入图片描述

2.6查看网卡驱动版本

2.7单独查看网络设备

2.8查看系统内核

uname -sr 

在这里插入图片描述

2.9查看网络设备情况

sudo lshw -class network

在这里插入图片描述
如果显示network is disabled
可以通过:sudo ifup wlo1的方式去除disable,注意wlo1是我这里的名称
在这里插入图片描述
(如果想把正常的变成disable就可以:sudo ifdown wlo1

$ sudo ifup wlo1
ifup: interface wlo1 already configured

3.一些场景下不能使用WiFi

3.1首次安装ubuntu系统,提示没有WiFi适配器

完全没有安装过网卡的,适合刚刚安装好ubuntu系统,而电脑的网卡不能显示的情况

出现:No Wi-Fi Adapter Found
Make sure you have a Wi-Fi adapter plugged and turn on 

在这里插入图片描述

1.查看自己的网卡型号,这里是ubuntu的查看方式(其它的系统也可能是其它命令):

lspci

lspci -nnk | grep -i net

在这里插入图片描述

得到的结果中:Ethernet Controller 后是以太网卡型号,Network controller 后面的就是无线网卡型号

从windows查看(控制面板–网络和Internet–网络和共享中心 里的 以太网(或者wlan)–详细信息中):
在这里插入图片描述
在这里插入图片描述

3.2ubuntu系统原本有wifi,某天开机不知怎么得突然提示没有WiFi适配器

明确几个问题:
0.网卡的驱动是不是装了(一般原本正常能用wifi,突然某天不能用了,驱动一般是好的!)
1.WiFi有没有被disable或者hardblock

rfkill list all

在这里插入图片描述

0: hci0: Bluetooth 这个是我电脑的蓝牙Soft blocked: noHard blocked: no
1: phy0: Wireless LAN 这个是我电脑内的网卡Soft blocked: noHard blocked: no
2: phy1: Wireless LAN这个是插到电脑上的usb网卡Soft blocked: noHard blocked: no

如果你的Soft blocked 或Hard blocked出现了yes,那你就去查如何把ubuntu的wifi的硬件阻止或者软件阻止开启

2.如果尝试了很多次都没有解决(用了所有方法,都没有修复ubuntu的wifi)
如果在Software & Updates里面(这里的Additional Drivers里面可以让ubuntu自己找缺失的驱动),没法自动识别网卡
如果在Inter corporation:Unknown处显示This device is not working
在这里插入图片描述
接下来你考虑:
换一下ubuntu的软件中的系统源(如果觉得自己sudo apt-get install *app,之类的下载安装东西觉得自己网速慢了,那就可以试试换一下源,有时候不一定是清华的源比阿里的好…):
1.备份
备份/etc/apt/sources.list文件
mv /etc/apt/sources.list /etc/apt/sourses.list.backup
2.新建
新建/etc/apt/sources.list文件并添加以下内容

sudo gedit /etc/apt/sources.list

2.1 ubuntu18.04阿里源:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

2.2 ubuntu18.04的其它源
#ubuntu18.04清华源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

#ubuntu18.04中科大源

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

3 更新

更改完成之后执行以下命令

sudo apt update
sudo apt upgrade

我完成了这几步后,wifi出现了,但是不能使用,WiFi是一个空心WiFi的形状
在这个界面提示wifi unmanaged
在这里插入图片描述
可以像我这样:

sudo gedit /etc/NetworkManager/NetworkManager.conf

然后把里面内容替换为:

[main]
plugins=ifupdown,keyfile[ifupdown]
managed=true[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:gsm,except:type:cdma,except:type:wwan,except:type:ethernet,except:type:vlan[device]
wifi.scan-rand-mac-address=no

然后重启一下网卡

sudo systemctl restart network-manager

我的WiFi就修好了
在这里插入图片描述
但是之后电脑总是提示"Activation of network connection failed Ubuntu"在这里插入图片描述
试试:sudo apt update && sudo apt install --reinstall openvpn easy-rsa
网上也有说重启路由器、重启电脑能修好的

相关内容

热门资讯

华塑控股:沈云借款纠纷案原告起... 证券之星消息,华塑控股(000509)12月23日在投资者关系平台上答复投资者关心的问题。 投资者提...
央行:建议发挥增量政策和存量政... 钛媒体App 12月24日消息,中国人民银行货币政策委员会2025年第四季度(总第111次)例会于1...
中仑新材:公司已严格遵循法律法... 证券之星消息,中仑新材(301565)12月23日在投资者关系平台上答复投资者关心的问题。 投资者提...
原创 保... 2025年12月24日,保定市人大常委会组织召开市人大制度研究会成立大会暨第一届会员大会第一次会议,...
法援志愿行 (来源:南京晨报) 转自:南京晨报 记者12月23日从司法部获悉,司法部、教育部、共青团中央印发通知...
一审胜诉!ST新亚无需承担大额... 12月24日,ST新亚(002388)发布公告,披露公司及控股子公司、上海分公司涉及的一起大额款项支...
178件地方性法规为首都发展提... 12月24日,北京市人民政府新闻办公室召开首都“十四五”规划高质量收官系列主题新闻发布会,市委依法治...
5起医疗损害责任纠纷典型案例发... 医疗卫生事业与广大人民群众的生活息息相关,和谐医患关系事关社会稳定。近年来,全省法院进一步加强医疗纠...
委内瑞拉通过法案:扣押油轮是犯... 参考消息网12月24日报道据美联社12月23日报道,委内瑞拉议会23日批准一项法案,将妨碍该国航运和...
天风证券融资净偿还55.63万... 雷达财经雷助吧出品 文|林宜采 编|深海 东财Choice金融数据显示,12月23日,天风证券当日融...