The problem that CentOS7 can't connect to the Internet after assigning ip

When creating a virtual machine, we have set this virtual machine to NAT network mode, the following operations are based on NAT mode

 

Set up a virtual machine snapshot first so you can restore it if necessary

After logging in, check the ip address ip addr first, and you can see that the ip address is 192.168.18.128. This ip address is the ip address I obtained when I logged in to the virtual machine last time. Later, the network segment of the vmware virtual machine was changed, so I couldn’t access the Internet. up

 

 reassign ip address

 View the assigned ip address, you can see that a new ip address has been assigned

 The network is still not connected

 But you can see that the host and the virtual machine are connected

 At this time, you can use secureCRT to connect to the virtual machine remotely. Let's connect to the virtual machine remotely first.

 The external network is still unable to connect, and now we are starting to solve the problem that the external network cannot be connected

 Check the information of the network card ens33, you can find that although the virtual machine has obtained a new ip address, the ip address on the network card is still 192.68.18.128, and it is a static ip. This is because I set the ip of the network card to static last time. ip, so although a new ip address has been obtained through dhcp this time, the address in the network card has not changed. So I can't access the Internet

 Modify the ip address and gateway, and the ip address remains static

 restart network service

 It can be seen that the network is connected

 Check the number of network cards, you can see that there are only two network cards, ens33 and lo

 Add a network card to the virtual machine, and add a network card to CentOS7 in the vmware software

 Question: Using the ls command, you can see that there are still only two network cards, but using the ifconfig command, you can see that there is an extra network card ens37?

 

Guess you like

Origin blog.csdn.net/yanzhenxi/article/details/127332357