Ubuntu Server 20.4.1 *-网络已禁用

Ubuntu Server 20.4.1 *-网络已禁用

今天早上我的服务器还在运行。我想应用最新的设置更新,但在应用之前,我决定重启一下以清理一下。

重启后,网络没有恢复。我从 USB 启动,可以访问网络。所以我知道这不是卡、电缆或外部的问题。

以下是 lshw -C 网络的输出:

  *-network DISABLED
   description: Ethernet interface
   product: 82579LM Gigabit Network Connection (Lewisville)
   vendor: Intel Corporation
   physical id: 19
   bus info: pci@0000:00:19.0
   logical name: eth1
   version: 04
   serial: 34:17:eb:a1:64:a1
   capacity: 1Gbit/s
   width: 32 bits
   clock: 33MHz
   capabilities: pm msi 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-4 latency=0 link=no multicast=yes port=twisted pair
   resources: irq:27 memory:f7d00000-f7d1ffff memory:f7d39000-f7d39fff ioport:f080(size=32)


*-network DISABLED
       description: Ethernet interface
       product: DGE-528T Gigabit Ethernet Adapter
       vendor: D-Link System Inc
       physical id: 2
       bus info: pci@0000:01:02.0
       logical name: eth0
       version: 10
       serial: c4:12:f5:33:9b:5f
       width: 32 bits
       clock: 66MHz
       capabilities: pm bus_master cap_list rom ethernet physical
       configuration: broadcast=yes driver=r8169 latency=32 link=no maxlatency=64 mingnt=32 multicast=yes
       resources: irq:18 ioport:e000(size=256) memory:f7c20000-f7c200ff memory:f7c00000-f7c1ffff

以下是我从“ip a”获得的结果:

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: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether c4:12:f5:33:9b:5f brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 34:17:eb:a1:64:a1 brd ff:ff:ff:ff:ff:ff

如果我执行“ip link set eth0 up”和“ip link set eth1 up”然后执行“ifconfig”,看起来我得到了一个 IPv6 地址,但没有 IPV4。

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet6 fe80::c612:f5ff:fe33:9b5f  prefixlen 64  scopeid 0x20<link>
    ether c4:12:f5:33:9b:5f  txqueuelen 1000  (Ethernet)
    RX packets 192  bytes 20095 (20.0 KB)
    RX errors 0  dropped 12  overruns 0  frame 0
    TX packets 6  bytes 516 (516.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 34:17:eb:a1:64:a1  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf7d00000-f7d20000  

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 7768  bytes 551888 (551.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7768  bytes 551888 (551.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

这是我的 /etc/netplan/ 文件

# This is the network config written by 'subiquity'
network:
  version: 2
  renderer: networkd
  ethernets:
    enp1:
      dhcp4: true
      dhcp6: false

任何知道到底发生了什么事(顺便说一句...如果我重新启动,它就会回到被禁用的状态)。

答案1

请注意,您的以太网接口是 eth0 和 eth1;这对于 Ubuntu 20.04 来说相当不寻常。还请注意,netplan 文件尝试配置更常见的 enp1。请更改 netplan 文件以将 eth0 替换为 enp1。接下来,执行

sudo netplan generate
sudo netplan apply

查看:

ip addr show

有改善吗?

答案2

我将 .yaml 文件更改为以下内容:

网络:版本:2 渲染器:networkd 以太网:enp1:dhcp4:true 匹配:macaddress:c4:12:f5:33:9b:5f 设置名称:enp1

这是我知道有电缆的接口的 MAC 地址。这有效。重启后,我顺利获得了我的 IPV4 地址。不知道是什么改变了它无法找到几周前连接的接口。

相关内容