网络被禁用该如何修复?

网络被禁用该如何修复?

我不知道这里发生了什么,但我无法使用以太网/LAN 连接到互联网。

当我运行时lshw -C net我得到了这个结果:

root@ubntnginx:/etc/netplan# lshw -C net
  *-network DISABLED        
       description: Ethernet interface
       product: RTL810xE PCI Express Fast Ethernet controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: ens33
       version: 02
       serial: 18:a9:05:1a:b7:c1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list rom ethernet physical
       configuration: broadcast=yes driver=r8169 latency=0 link=no multicast=yes
       resources: irq:17 ioport:e800(size=256) memory:feaff000-feafffff memory:fdff0000-fdffffff memory:feac0000-feadffff

这是ifconfig命令的结果:

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 9840  bytes 721798 (721.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9840  bytes 721798 (721.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

这是cat /etc/netplan

cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens2:
      dhcp4: true
  version: 2

这是来自ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 18:a9:05:1a:b7:c1 brd ff:ff:ff:ff:ff:ff

当我使用网络管理器检查状态时,我收到警告,说未找到sudo service network-manager status文件。与此答案不同的是:etc/network/interfaces这里,我没有文件/var/lib/NetworkManager/NetworkManager.state

知道如何修复此问题吗?

答案1

看来您的活动网络适配器已被命名ens33- 您的 netplan 配置应该进行调整以适应这一点:

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      dhcp4: true
  version: 2

现在运行sudo netplan apply。这有望为您的接口提供ens33来自 DHCP 服务器的 IP 地址。

相关内容