The virtual machine cannot be connected to the Internet and cannot automatically obtain an IP

Suddenly one day the development could not connect to the virtual machine. When I opened the virtual machine, I found that I couldn’t connect to the Internet. Later, ifconfig didn’t even have an IP, only one 127.0.0.1

I searched a lot on the Internet, and then used

dhclient -v

You can get the IP again, but you need to do this every time you reboot, which is definitely not possible

Then nmcli turned on the network device to help me solve the problem, so that I can automatically obtain the IP after booting

查看托管状态
nmcli n
显示 disabled 则为本文遇到的问题,如果是 enabled 则可以不用往下看了
开启 托管
nmcli n on

Guess you like

Origin blog.csdn.net/weixin_62264287/article/details/132625008