系统环境为centos7.9,快照恢复后,ifconfig不显示配置的静态IP,查看onboot是否配置yes

[root@anhui ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 169  bytes 19024 (18.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 169  bytes 19024 (18.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:1e:3e:41  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

重启网络后,提示查看网络状态

[root@anhui ~]# service network restart 
Restarting network (via systemctl):  Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
                                                           [FAILED]
[root@anhui ~]# 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 Mon 2022-09-19 15:39:59 CST; 11s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 73871 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
  Process: 74879 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

Sep 19 15:39:59 anhui network[74879]: RTNETLINK answers: File exists
Sep 19 15:39:59 anhui network[74879]: RTNETLINK answers: File exists
Sep 19 15:39:59 anhui network[74879]: RTNETLINK answers: File exists
Sep 19 15:39:59 anhui network[74879]: RTNETLINK answers: File exists
Sep 19 15:39:59 anhui network[74879]: RTNETLINK answers: File exists
Sep 19 15:39:59 anhui network[74879]: RTNETLINK answers: File exists
Sep 19 15:39:59 anhui systemd[1]: network.service: control process exited, ...=1
Sep 19 15:39:59 anhui systemd[1]: Failed to start LSB: Bring up/down networking.
Sep 19 15:39:59 anhui systemd[1]: Unit network.service entered failed state.
Sep 19 15:39:59 anhui systemd[1]: network.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

解决方法

[root@anhui ~]# systemctl stop NetworkManager
[root@anhui ~]# systemctl restart  network
直接禁用
NetworkManager,centos有两个网络服务,network和NetworkManager,两者存在一个即可

[root@anhui ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.


[root@anhui ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.132  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::20c:29ff:fe56:fad4  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:56:fa:d4  txqueuelen 1000  (Ethernet)
        RX packets 5025196  bytes 6992327681 (6.5 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 759594  bytes 930698578 (887.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 169  bytes 19024 (18.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 169  bytes 19024 (18.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

posted on 2022-09-19 15:54  牛肉丨火锅  阅读(89)  评论(0编辑  收藏  举报