The virtual machine CentOS wired connection icon disappears directly, the network connection cannot be connected, and the solution to the network connection failure (personal test is effective)

Table of contents

1. Method 1: The wired connection in the upper right corner of centos disappears directly. Centos cannot connect to the network, causing the remote SSH connection to fail. Change the NetworkManager file.

1.1 Enter the following command on the terminal command line to change the NetworkManager file

1.2 Restart the virtual machine and check whether it recovers

1.3 It has not recovered yet. Enter the next restart network command in the terminal to check whether it has recovered.

2. Method 2: The virtual machine centOs cannot connect to the Internet, and the network icon has disappeared. Consider clearing the network cache command and restarting it.



1. Method 1: The wired connection in the upper right corner of centos disappears directly. Centos cannot connect to the network, causing the remote SSH connection to fail. Change the NetworkManager file.

1.1 Enter the following command on the terminal command line to change the NetworkManager file

【question】

【Order】

mv /var/lib/NetworkManager /var/lib/NetworkManager.bak

[Schematic diagram]

1.2 Restart the virtual machine and check whether it is restored

1.3 It has not recovered yet. Enter the next restart network command in the terminal to check whether it has recovered.

【Order】

systemctl start NetworkManager.service

2. Method 2: The virtual machine centOs cannot connect to the Internet, and the network icon has disappeared. Consider clearing the network cache command and restarting it.

【question】

  • The virtual machine cannot connect to the network, and the network icon in the upper right corner has disappeared;
  • Enter the command ifconfig and find that the ens33 network card is not displayed;
  • It may be due to some configuration errors when shutting down the virtual machine last time, causing the ens33 network card to fail to start successfully.

[Solution] Right-click the mouse to open the terminal, enter the clear network cache command, and restart the network card.

【Order】

# 关闭网络服务
systemctl stop NetworkManager.service

# 清除网络缓存
rm /var/lib/NetworkManager/NetworkManager.state

# 打开网络服务
systemctl start NetworkManager.service

[Note: Other Linux system commands may be different, you may consider entering the following commands]

sudo service network-manager stop

sudo rm /var/lib/NetworkManager/NetworkManager.state

sudo service network-manager start

【Example】

[root@localhost ~]# systemctl stop NetworkManager.service
[root@localhost ~]# rm /var/lib/NetworkManager/NetworkManager.state
rm:是否删除普通文件 "/var/lib/NetworkManager/NetworkManager.state"?y
[root@localhost ~]# rm /var/lib/NetworkManager/NetworkManager.state
rm: 无法删除"/var/lib/NetworkManager/NetworkManager.state": 没有那个文件或目录
[root@localhost ~]# systemctl start NetworkManager.service

[Schematic diagram]

Guess you like

Origin blog.csdn.net/chaojichunshen/article/details/132673639