Centos7 no IP address solution

Today I used xshell to connect to the virtual machine and found that it could not be connected. I used the ifconfig and ip addr commands in the virtual machine and I couldn't find the IP address. Then I tried to restart it, but it still couldn't be resolved.
Baidu search, the normal solution is:

vi /etc/sysconfig/network-scripts/ifcfg-ens33 

Modify the last row ONBOOTto yes
restart the network:

systemctl restart network

But after these steps, an error is reported:

Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

Then I saw another article:

systemctl stop NetworkManager
systemctl disable NetworkManager

Then restart the network:

systemctl restart network

Finally :

ifconfig

Success

Guess you like

Origin blog.csdn.net/weixin_45936162/article/details/111614517