Ubuntu 20.04 eth 适配器在启动时关闭,与租约刷新配合使用

Ubuntu 20.04 eth 适配器在启动时关闭,与租约刷新配合使用

这有点奇怪。断电了,一切恢复正常(没有物理损坏)后,这个 Ubuntu 盒子启动时默认/唯一的 eth 适配器关闭。强制刷新 dhclient 租约后,它又恢复正常了。

相关输出如下。有人遇到过这种情况吗?:

初始状态:

    ifconfig -a
enp4s0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether ff:ff:ff:ff:ff:ff  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

运行 dhclient -v 来获取该租约:

 sudo dhclient -v enp4s0
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/enp4s0/ff:ff:ff:ff:ff:ff
Sending on   LPF/enp4s0/ff:ff:ff:ff:ff:ff
Sending on   Socket/fallback
DHCPREQUEST for 192.168.0.6 on enp4s0 to 255.255.255.255 port 67 (xid=0x45190571)
DHCPREQUEST for 192.168.0.6 on enp4s0 to 255.255.255.255 port 67 (xid=0x45190571)
DHCPREQUEST for 192.168.0.6 on enp4s0 to 255.255.255.255 port 67 (xid=0x45190571)
DHCPACK of 192.168.0.6 from 192.168.0.1 (xid=0x71051945)
bound to 192.168.0.6 -- renewal in 39989 seconds.

之后...一切都正常运行:

ifconfig -a
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.6  netmask 255.255.255.0  broadcast 192.168.0.255
        ether ff:ff:ff:ff:ff:ff  txqueuelen 1000  (Ethernet)
        RX packets 206  bytes 202417 (202.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 116  bytes 10053 (10.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

寻找永久的解决方案。

如果有帮助的话,这个盒子没有安装 netplan。我知道大多数人都安装了。

答案1

我不确定究竟是什么变化破坏了适配器的配置,但在安装 netplan.io 之后,适配器在启动时会从 dhcp 服务器获得租约,正如预期的那样。

我知道 netplan 是目前 Ubuntu 上公认的网络管理工具。但我不明白的是之前是什么在管理它,又是什么改变了它,导致它失效了。

相关内容