为ubuntu配置WiFi
创始人
2024-03-08 12:30:59
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
网上也有说重启路由器、重启电脑能修好的

相关内容

热门资讯

AWSECS:访问外部网络时出... 如果您在AWS ECS中部署了应用程序,并且该应用程序需要访问外部网络,但是无法正常访问,可能是因为...
AWSElasticBeans... 在Dockerfile中手动配置nginx反向代理。例如,在Dockerfile中添加以下代码:FR...
银河麒麟V10SP1高级服务器... 银河麒麟高级服务器操作系统简介: 银河麒麟高级服务器操作系统V10是针对企业级关键业务...
北信源内网安全管理卸载 北信源内网安全管理是一款网络安全管理软件,主要用于保护内网安全。在日常使用过程中,卸载该软件是一种常...
AWR报告解读 WORKLOAD REPOSITORY PDB report (PDB snapshots) AW...
AWS管理控制台菜单和权限 要在AWS管理控制台中创建菜单和权限,您可以使用AWS Identity and Access Ma...
​ToDesk 远程工具安装及... 目录 前言 ToDesk 优势 ToDesk 下载安装 ToDesk 功能展示 文件传输 设备链接 ...
群晖外网访问终极解决方法:IP... 写在前面的话 受够了群晖的quickconnet的小水管了,急需一个新的解决方法&#x...
不能访问光猫的的管理页面 光猫是现代家庭宽带网络的重要组成部分,它可以提供高速稳定的网络连接。但是,有时候我们会遇到不能访问光...
Azure构建流程(Power... 这可能是由于配置错误导致的问题。请检查构建流程任务中的“发布构建制品”步骤,确保正确配置了“Arti...