zoukankan      html  css  js  c++  java
  • CentOS 8 重启不能DHCP获取IP的解决方法

    一个执着于技术的公众号

    今天遇到一个神奇的现象,我对CentOS 8系统做初始化之后再重启系统,发现系统不能通过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

    BUG描述链接:
    https://bugzilla.redhat.com/show_bug.cgi?id=1744427
    

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

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

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

    原文链接:https://www.dwhd.org/20200430_044321.html

      往期精彩  

    ◆  必看 | Linux系列学习书籍免费送

    ◆  利用expect批量修改Linux服务器密码

    ◆  Linux运维工程师面试问答录

    ◆  LVM逻辑卷学习

    ◆  Linux网络重点知识总结性梳理

    ◆  抓包工具tcpdump用法说明

    ◆  一文带你速懂虚拟化KVM和XEN

    ◆  实战 | Hadoo大数据集群搭建

    ◆  运维工程师心法:6大技能让你告别背锅

    ◆  亿级web系统负载均衡几种实现方式

    好文和朋友一起看~
    
    十年磨一剑
  • 相关阅读:
    Reverse Integer
    First Bad Version
    Heaters
    Number of Segments in a String
    RPI学习--环境搭建_串口连接
    关键字const
    main函数参数的使用
    Redis 简单使用 and 连接池(python)
    南宁AI项目
    Go part 1 初探
  • 原文地址:https://www.cnblogs.com/qinlulu/p/12891027.html
Copyright © 2011-2022 走看看