为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
网上也有说重启路由器、重启电脑能修好的

相关内容

热门资讯

保存时出现了1个错误,导致这篇... 当保存文章时出现错误时,可以通过以下步骤解决问题:查看错误信息:查看错误提示信息可以帮助我们了解具体...
汇川伺服电机位置控制模式参数配... 1. 基本控制参数设置 1)设置位置控制模式   2)绝对值位置线性模...
不能访问光猫的的管理页面 光猫是现代家庭宽带网络的重要组成部分,它可以提供高速稳定的网络连接。但是,有时候我们会遇到不能访问光...
表格中数据未显示 当表格中的数据未显示时,可能是由于以下几个原因导致的:HTML代码问题:检查表格的HTML代码是否正...
本地主机上的图像未显示 问题描述:在本地主机上显示图像时,图像未能正常显示。解决方法:以下是一些可能的解决方法,具体取决于问...
表格列调整大小出现问题 问题描述:表格列调整大小出现问题,无法正常调整列宽。解决方法:检查表格的布局方式是否正确。确保表格使...
不一致的条件格式 要解决不一致的条件格式问题,可以按照以下步骤进行:确定条件格式的规则:首先,需要明确条件格式的规则是...
Android|无法访问或保存... 这个问题可能是由于权限设置不正确导致的。您需要在应用程序清单文件中添加以下代码来请求适当的权限:此外...
【NI Multisim 14...   目录 序言 一、工具栏 🍊1.“标准”工具栏 🍊 2.视图工具...
银河麒麟V10SP1高级服务器... 银河麒麟高级服务器操作系统简介: 银河麒麟高级服务器操作系统V10是针对企业级关键业务...