Ubuntu 系统不小心删掉一些库, 导致无法使用有线上网,最后排查问题,发现有线网卡被关掉了,在这记录开启有线网卡的方法。

博主博客

一、查询网卡状态

使用 lshw -C network 得到下列信息, 可以发现以太网接口(Ethernet interface) 一直处于关闭(DISABLED)状态。

WARNING: you should run this program as super-user.
  *-network DISABLED        
       description: Ethernet interface
       product: 82579LM Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: enp0s25
       version: 04
       serial: 00:21:cc:cd:28:8f
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k firmware=0.13-3 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:28 memory:f2500000-f251ffff memory:f253b000-f253bfff ioport:6080(size=32)

二、编辑配置文件

vim /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf

把原来的

[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:wwan

修改为

[keyfile]
unmanaged-devices=*,except:type:ethernet,except:type:wifi,except:type:wwan

最后使用 sudo service network-manager restart 重启服务即可。