CentOS 7无法启动network.service

环境说明

  • 操作系统:CentOS Linux release 7.9.2009 (Core)

错误日志

[root@localhost install_bash_V2.4.0_202310270903]# systemctl status network.service
● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since 二 2023-10-31 10:09:33 CST; 31s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 19843 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
    Tasks: 1
   Memory: 108.0K
   CGroup: /system.slice/network.service
           └─1185 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-bd226a60-55be-49a5-965b-d3f1224b29bb-eno1.lease -pf /var/run/dhclient-eno1.pid eno1

10月 31 10:09:33 localhost.localdomain network[19843]: RTNETLINK answers: File exists
10月 31 10:09:33 localhost.localdomain network[19843]: RTNETLINK answers: File exists
10月 31 10:09:33 localhost.localdomain network[19843]: RTNETLINK answers: File exists
10月 31 10:09:33 localhost.localdomain network[19843]: RTNETLINK answers: File exists
10月 31 10:09:33 localhost.localdomain network[19843]: RTNETLINK answers: File exists
10月 31 10:09:33 localhost.localdomain network[19843]: RTNETLINK answers: File exists
10月 31 10:09:33 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
10月 31 10:09:33 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
10月 31 10:09:33 localhost.localdomain systemd[1]: Unit network.service entered failed state.
10月 31 10:09:33 localhost.localdomain systemd[1]: network.service failed.
[root@localhost install_bash_V2.4.0_202310270903]# systemctl restart network.service
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
[root@localhost install_bash_V2.4.0_202310270903]# journalctl -xe
10月 31 10:12:07 localhost.localdomain network[20027]: This version of ISC DHCP is based on the release available
10月 31 10:12:07 localhost.localdomain network[20027]: on ftp.isc.org.  Features have been added and other changes
10月 31 10:12:07 localhost.localdomain network[20027]: have been made to the base software release in order to make
10月 31 10:12:07 localhost.localdomain network[20027]: it work better with this distribution.
10月 31 10:12:07 localhost.localdomain network[20027]: Please report for this software via the CentOS Bugs Database:
10月 31 10:12:07 localhost.localdomain network[20027]: http://bugs.centos.org/
10月 31 10:12:07 localhost.localdomain network[20027]: exiting.
10月 31 10:12:07 localhost.localdomain dhclient[20164]: 
10月 31 10:12:07 localhost.localdomain network[20027]: 失败。
10月 31 10:12:07 localhost.localdomain dhclient[20164]: This version of ISC DHCP is based on the release available
10月 31 10:12:07 localhost.localdomain dhclient[20164]: on ftp.isc.org.  Features have been added and other changes
10月 31 10:12:07 localhost.localdomain dhclient[20164]: have been made to the base software release in order to make
10月 31 10:12:07 localhost.localdomain network[20027]: [失败]
10月 31 10:12:07 localhost.localdomain dhclient[20164]: it work better with this distribution.
10月 31 10:12:07 localhost.localdomain dhclient[20164]: 
10月 31 10:12:07 localhost.localdomain dhclient[20164]: Please report for this software via the CentOS Bugs Database:
10月 31 10:12:07 localhost.localdomain dhclient[20164]:     http://bugs.centos.org/
10月 31 10:12:07 localhost.localdomain dhclient[20164]: 
10月 31 10:12:07 localhost.localdomain dhclient[20164]: exiting.
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain network[20027]: RTNETLINK answers: File exists
10月 31 10:12:07 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
10月 31 10:12:07 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
-- Subject: Unit network.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit network.service has failed.
-- 
-- The result is failed.
10月 31 10:12:07 localhost.localdomain systemd[1]: Unit network.service entered failed state.
10月 31 10:12:07 localhost.localdomain systemd[1]: network.service failed.
10月 31 10:12:07 localhost.localdomain polkitd[761]: Unregistered Authentication Agent for unix-process:20021:32157145 (system bus name :1.559, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, loca

原因分析

通过日志可以看到有关DHCP的一些信息,可以去看下网卡对应的配置文件(/etc/sysconfig/network-scripts/ifcfg-eno1)是否存在问题。一般服务器IP都是static固定的,发现是有人误操作变成DHCP导致出现问题。

解决方案

编辑(/etc/sysconfig/network-scripts/ifcfg-eno1)网卡配置文件,修改成规划的static配置,例如:BOOTPROTO=static

posted @ 2023-11-01 14:59  小舟杂笔  阅读(232)  评论(0)    收藏  举报