Ubuntu 22.04-有线网卡被禁用的解决方案
1.使用root账号
su - root
2.查询有线网卡型号
命令行输入lspci来查看网卡型号
lspci | grep Ethernet
05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL810xE PCI Express Fast Ethernet controller (rev 07)
说明:
查到以太网控制器:Ethernet controller: Realtek Semiconductor (RTL810xE)
3.查询网卡
ifconfig
ifconfig -a
ip addr
ip link show
说明:
若 ifconfig -a 能查询到有线网卡,而 ifconfig 查询不到,则大概率网卡被禁用
4. 查询网卡是否被禁用
lshw -C network
*-network DISABLED
description: Ethernet interface
product: RTL810xE PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:05:00.0
logical name: enp5s0
version: 07
serial: 00:e0:4c:50:07:7c
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd cap_list ethernet physical
configuration: broadcast=yes driver=r8169 driverversion=6.8.0-64-generic latency=0 link=no multicast= yes
resources: iomemory:38380-3837f irq:19 ioport:e000(size=256) memory:fb000000-fb000fff memory:38382000 0000-383820003fff
*-network
description: Wireless interface
physical id: 4
bus info: firewire@3
logical name: wlx4cb7e05cfb7e
serial: 4c:b7:e0:5c:fb:7e
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=usb driverversion=6.8.0-64-generic ip=10.100.108.123 multicast=ye s wireless=IEEE 802.11ax
5. 解决方案
(1)分析:
lspci | grep Ethernet, 能查到网卡型号信息,说明有线网卡已被机器识别
ifconfig -a; ip addr; ip link show; 这些命令都能查到有线网卡enp5s0
ifconfig 命令查不到有线网卡enp5s0
lshw -C network 命令查到Ethernet interface网卡状态为-network DISABLED,说明其被禁用
(2)原因分析:
貌似上次改有线网卡配置后,应用netplan apply不成功所致
netplan apply
出错提示:
Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
(3)解决方案:
ifconfig -a
ifconfig
apt install netplan.io
netplan apply
Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
cd /etc/netplan/
ll
-rw-r--r-- 1 root root 469 7月 25 15:38 01-network-manager-all.yaml
# 最关键之处(修改配置文件用户权限)
chmod 0600 01-network-manager-all.yaml
netplan apply
ifconfig
关键之处:
要保证netplan apply能运行,以保存网络配置。
若修改了文件01-network-manager-all.yaml,但netplan apply没运行成功,则有线网卡被DISABLED,
解决的方法就是使命令netplan apply成功运行。

浙公网安备 33010602011771号