CentOS 8 重启不能DHCP获取IP的解决方法

今天遇到一个神奇的现象,我对CentOS8系统做初始化之后再重启系统发现系统不能通过NetworkManager获取DHCP IP了
查了系统日志发现是

Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.2608] device (ens33): state change: ip-config -> failed (reason 'dhcp-start-failed', sys-iface-state: 'managed')
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191847.2614] device (ens33): Activation: failed for connection 'ens33'
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.2615] device (ens33): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.2718] device (ens33): Activation: starting connection 'ens33' (c96bc909-188e-ec64-3a96-6a90982b08ad)
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.2718] device (ens33): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.2721] device (ens33): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.3385] device (ens33): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.3387] dhcp4 (ens33): activation: beginning transaction (timeout in 45 seconds)
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191847.3387] device (ens33): failure to start DHCP: failed to set DHCP hostname: Invalid argument
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.3387] device (ens33): state change: ip-config -> failed (reason 'dhcp-start-failed', sys-iface-state: 'managed')
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191847.3392] device (ens33): Activation: failed for connection 'ens33'
Apr 30 04:24:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191847.3393] device (ens33): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:22 DS-VM-Node172_17_0_1.cluster.com NetworkManager[949]: <info>  [1588191862.9089] device (ens33): Activation: starting connection 'ens33' (e75e0548-afe3-4900-8233-74ba08573297)
Apr 30 04:24:22 DS-VM-Node172_17_0_1.cluster.com NetworkManager[949]: <info>  [1588191862.9090] device (ens33): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'external')
Apr 30 04:24:22 DS-VM-Node172_17_0_1.cluster.com NetworkManager[949]: <info>  [1588191862.9092] device (ens33): state change: prepare -> config (reason 'none', sys-iface-state: 'external')
Apr 30 04:24:22 DS-VM-Node172_17_0_1.cluster.com NetworkManager[949]: <info>  [1588191862.9093] device (ens33): state change: config -> ip-config (reason 'none', sys-iface-state: 'external')
Apr 30 04:24:22 DS-VM-Node172_17_0_1.cluster.com NetworkManager[949]: <info>  [1588191862.9094] device (ens33): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'external')
Apr 30 04:24:22 DS-VM-Node172_17_0_1.cluster.com NetworkManager[949]: <info>  [1588191862.9144] device (ens33): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'external')
Apr 30 04:24:22 DS-VM-Node172_17_0_1.cluster.com NetworkManager[949]: <info>  [1588191862.9146] device (ens33): state change: secondaries -> activated (reason 'none', sys-iface-state: 'external')
Apr 30 04:24:22 DS-VM-Node172_17_0_1.cluster.com NetworkManager[949]: <info>  [1588191862.9153] device (ens33): Activation: successful, device activated.
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.7576] device (ens33): state change: activated -> deactivating (reason 'user-requested', sys-iface-state: 'external')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.7745] device (ens33): state change: deactivating -> disconnected (reason 'user-requested', sys-iface-state: 'external')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.7850] device (ens33): Activation: starting connection 'ens33' (c96bc909-188e-ec64-3a96-6a90982b08ad)
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.7851] device (ens33): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.7855] device (ens33): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.8564] device (ens33): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.8566] dhcp4 (ens33): activation: beginning transaction (timeout in 45 seconds)
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191883.8567] device (ens33): failure to start DHCP: failed to set DHCP hostname: Invalid argument
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.8567] device (ens33): state change: ip-config -> failed (reason 'dhcp-start-failed', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191883.8574] device (ens33): Activation: failed for connection 'ens33'
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.8575] device (ens33): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.8673] device (ens33): Activation: starting connection 'ens33' (c96bc909-188e-ec64-3a96-6a90982b08ad)
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.8674] device (ens33): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.8677] device (ens33): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.9231] device (ens33): state change: config -> deactivating (reason 'new-activation', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.9238] device (ens33): disconnecting for new activation request.
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.9252] device (ens33): state change: deactivating -> disconnected (reason 'new-activation', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.9352] device (ens33): Activation: starting connection 'ens33' (c96bc909-188e-ec64-3a96-6a90982b08ad)
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.9359] device (ens33): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:43 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191883.9362] device (ens33): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.0351] device (ens33): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.0353] dhcp4 (ens33): activation: beginning transaction (timeout in 45 seconds)
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191884.0354] device (ens33): failure to start DHCP: failed to set DHCP hostname: Invalid argument
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.0354] device (ens33): state change: ip-config -> failed (reason 'dhcp-start-failed', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191884.0360] device (ens33): Activation: failed for connection 'ens33'
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.0362] device (ens33): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.0448] device (ens33): Activation: starting connection 'ens33' (c96bc909-188e-ec64-3a96-6a90982b08ad)
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.0449] device (ens33): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.0452] device (ens33): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1319] device (ens33): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1321] dhcp4 (ens33): activation: beginning transaction (timeout in 45 seconds)
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191884.1321] device (ens33): failure to start DHCP: failed to set DHCP hostname: Invalid argument
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1321] device (ens33): state change: ip-config -> failed (reason 'dhcp-start-failed', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191884.1327] device (ens33): Activation: failed for connection 'ens33'
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1328] device (ens33): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1383] device (ens33): Activation: starting connection 'ens33' (c96bc909-188e-ec64-3a96-6a90982b08ad)
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1383] device (ens33): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1386] device (ens33): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1975] device (ens33): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1978] dhcp4 (ens33): activation: beginning transaction (timeout in 45 seconds)
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191884.1978] device (ens33): failure to start DHCP: failed to set DHCP hostname: Invalid argument
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1978] device (ens33): state change: ip-config -> failed (reason 'dhcp-start-failed', sys-iface-state: 'managed')
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <warn>  [1588191884.1985] device (ens33): Activation: failed for connection 'ens33'
Apr 30 04:24:44 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191884.1986] device (ens33): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 30 04:25:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191907.7422] device (ens33): Activation: starting connection 'ens33' (882e1861-5548-4152-8eb1-04a186290097)
Apr 30 04:25:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191907.7422] device (ens33): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'external')
Apr 30 04:25:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191907.7424] device (ens33): state change: prepare -> config (reason 'none', sys-iface-state: 'external')
Apr 30 04:25:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191907.7440] device (ens33): state change: config -> ip-config (reason 'none', sys-iface-state: 'external')
Apr 30 04:25:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191907.7442] device (ens33): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'external')
Apr 30 04:25:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191907.7660] device (ens33): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'external')
Apr 30 04:25:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191907.7661] device (ens33): state change: secondaries -> activated (reason 'none', sys-iface-state: 'external')
Apr 30 04:25:07 DS-VM-Node172_16_193_132.cluster.com NetworkManager[949]: <info>  [1588191907.7669] device (ens33): Activation: successful, device activated.

通过谷歌搜索发现这是一个NetworkManager的BUG
https://bugzilla.redhat.com/show_bug.cgi?id=1744427

既然知道了是BUG,也知道了早就的原因,在CentOS8还没有对应更新NetworkManager软件包的情况下,我们只能把系统的hostname修改为localhost,来避开这个BUG

for i in static pretty transient; do hostnamectl set-hostname localhost --$i; done

修改完成后就可以重启自动获取DHCP IP了

lookback
  • 本文由 发表于 2020年4月30日04:43:21
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: