[root@localhost zlzong]# systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
查看网络状态,发现有Failed to start LSB: Bring up/down networking的提示,但是此时电脑网络感觉并没有异常,可以ssh,也可以联网。
[root@localhost zlzong]# systemctl status network
● 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 Sat 2021-04-17 16:19:20 CST; 8s ago
Docs: man:systemd-sysv-generator(8)
Process: 9166 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Apr 17 16:19:20 localhost.localdomain network[9166]: RTNETLINK answers: File exists
Apr 17 16:19:20 localhost.localdomain network[9166]: RTNETLINK answers: File exists
Apr 17 16:19:20 localhost.localdomain network[9166]: RTNETLINK answers: File exists
Apr 17 16:19:20 localhost.localdomain network[9166]: RTNETLINK answers: File exists
Apr 17 16:19:20 localhost.localdomain network[9166]: RTNETLINK answers: File exists
Apr 17 16:19:20 localhost.localdomain network[9166]: RTNETLINK answers: File exists
Apr 17 16:19:20 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Apr 17 16:19:20 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
Apr 17 16:19:20 localhost.localdomain systemd[1]: Unit network.service entered failed state.
Apr 17 16:19:20 localhost.localdomain systemd[1]: network.service failed.
通过命令journalctl -xe查看详细信息,发现eno2有异常。但是我现在使用的是eno1。
[root@localhost zlzong]# journalctl -xe
Apr 17 16:39:28 localhost.localdomain polkitd[1657]: Registered Authentication Agent for unix-process:5459:75348 (system bus name :1.136 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthApr 17 16:39:28 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking...
-- Subject: Unit network.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit network.service has begun starting up.
Apr 17 16:39:28 localhost.localdomain network[5465]: Bringing up loopback interface: [ OK ]
Apr 17 16:39:28 localhost.localdomain network[5465]: Bringing up interface eno1: RTNETLINK answers: File exists
Apr 17 16:39:28 localhost.localdomain network[5465]: [ OK ]
Apr 17 16:39:28 localhost.localdomain network[5465]: Bringing up interface eno2:
Apr 17 16:39:34 localhost.localdomain network[5465]: Determining IP information for eno2... failed; no link present. Check cable?
Apr 17 16:39:34 localhost.localdomain network[5465]: [FAILED]
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain network[5465]: RTNETLINK answers: File exists
Apr 17 16:39:34 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Apr 17 16:39:34 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.
Apr 17 16:39:34 localhost.localdomain systemd[1]: Unit network.service entered failed state.
Apr 17 16:39:34 localhost.localdomain systemd[1]: network.service failed.
Apr 17 16:39:34 localhost.localdomain polkitd[1657]: Unregistered Authentication Agent for unix-process:5459:75348 (system bus name :1.136, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
查看eno2的配置文件,发现ONBOOT=yes。应该是设置了DHCP,但是网线没有插,导致重启网络后,eno2网卡无法获取到ip地址,然后报错。将ONBOOT设置为no,再重启网络,此时就不会报错了。
vim /etc/sysconfig/network-scripts/ifcfg-eno2
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno2
UUID=8ec0802f-e614-45cd-af07-bc62fd5a8554
DEVICE=eno2
ONBOOT=yes
IPV6_PRIVACY=no