ssh access to the vmware virtual machine (open up the network between the local host and the virtual machine)

Accessing a virtual machine through ssh is quite simple, but if you are not familiar with it, it will take a lot of time. It took me a long time to build a network for the first time. Today, I suddenly had a whim to record how to configure it so that the local can access the vmware virtual machine.

Here is my vm:

It takes about five steps to connect to ssh:

The first step is to set up the virtual machine and the local use of NAT mode

The second step is to set and check the local ip, and set the configuration of the virtual machine network preferences (it is recommended to fix the ip, otherwise it needs to be configured every time, which is very painful, and the method is in the text)

The third step is to modify the virtual machine ip

The fourth step is to set or close the firewall.

Take my centos-7 as an example, note that only vmware professional version can realize ssh remote connection (non-professional version I will not):

Step 1: Set the virtual machine network mode to bridge mode:

Step 2: Check the local ip and configure the virtual machine network preferences

 Open and run (you can search for "run" in the search box), enter cmd, enter ipconfig, and check the ip and subnet mask of vmware network adapter vmnet8:

 Interlude:

You can go to Control Panel -> Network and Internet -> Network and Sharing Center -> Change Adapter Settings -> Right-click VM8 -> Click Properties -> Find `Internet Protocol Version 4 (TCP/IPv4) Properties` in the network of properties ( It may be in English), and then set the network ip, fix the virtual network card ip, and do not need to modify the ip next time

Use the virtual network editor to set up the network of the virtual machine:

 The third step is to modify the virtual machine ip:

Check the network card:

Discovery is ens33 

Modify the /etc/sysconfig/network-scripts/ifcfg-ens33 file:

IP and gateway need to be in the same subnet. 

 Restart the network: systemctl restart network

Check the network (ip addr) again and find that the ip of ens33 is the ip we expect

The fifth step is to close the firewall

systemctl stop firewalld

Then we found that pinging our expected ip on the physical machine (as shown in the figure is 192.168.64.4) can ping through

 

 

 

Guess you like

Origin blog.csdn.net/MrBlind/article/details/129209810