One computer accesses a virtual machine on another computer

Explanation:
"One computer accesses the virtual machine on another computer" refers to: there are two computers A and B, among which a virtual machine VMWare software is installed on the computer B, and the CentOS7 operating system is installed on the VMWare, and the computer A Now I want to access some service programs running on the CentOS7 operating system on computer B.

Purpose:
Because there is an old laptop in my home, I bought it when I was a part-time job during the holidays when I was in college. However, the configuration of this laptop (ASUS) is still relatively low compared to the current laptops on the market. The only advantage is that this laptop has a disk capacity of 2 TB. Now if I sell this laptop as second-hand, I think no one will want it, so I want to use this laptop for my personal study and use after work, that is, to use it as a personal server. Install a VMWare on this computer, install the CentOS7 operating system on the VMWare, and then install the server I need on CentOS7, such as mysql, nacos, nginx, redis..., and then I will use a new laptop (Lenovo Rescuer) to go to Connect to the server installed on the old laptop. For example, when I write code on a new computer, I need to connect to the Nacos server, and this Nacos server is installed on the CentOS7 operating system of the old computer.

The purpose of writing this article is actually that I want to record this kind of realization process. It is just my personal record. Readers who need it can learn from it. If it is helpful to you, remember to like it!
Illustration:
insert image description here

premise:

  • The two computers A and B need to be in the same LAN, that is, they are connected to the same wireless network
  • Both laptops are Windows OS

step:

1:

First of all, we operate on computer B, install VMware software on computer B, then install CentOS7 and configure the network environment.
The way to install VMware software is not written here. The steps of installing CentOS7 on VMware software and configuring the network environment
can refer to me. blog: https://blog.csdn.net/qq_44316726/article/details/106039804
Note: The network environment steps configured here should be the same as those on the blog, although it will be modified later.

2:

Open the virtual machine in computer B (open it as an administrator), and set the virtual machine in B to bridge mode:
insert image description here
insert image description here
insert image description here

Draw a red box to represent the network card name of the currently connected network (this name is carried out under WiFi), if you don’t know your own network card name, you can check it in the network adapter. The above red box is the network card
insert image description here
name

3:

Open the name of the virtual machine that you want to connect to computer B, and set the bridge mode under its settings. Right-click on the virtual machine to be connected, click Settings, and in the settings, select the bridge mode for the network adapter
insert image description here
insert image description here

4:

Open the cmd window on computer B, and enter the ipconfig command to view the ip of computer B connected to the WiFi network,
insert image description here
pay attention to IP4 and default gateway

5:

Start the virtual machine in computer B, modify the ip of the virtual machine, and the host mapping, and restart the network

(1) Open the virtual machine IP command to view the IP configuration in the ifcfg-ens33 file in the /etc/sysconfig/network-scripts/ directory

cd  /etc/sysconfig/network-scripts/

vim ifcfg-ens33

(2) Modify the virtual machine IP (the number behind the fixed number 192.168.0 ranges from 1 to 255, and the author sets 109 here) (
insert image description here
3) Modify the host mapping
insert image description here
insert image description here
(4) Restart the network

The network card restart method of centos6:

service network restart

The network card restart method of centos7:

systemctl restart network

(5) Restart the virtual machine

reboot

(6) Use FinalShell on computer B to connect to the virtual machine of computer B itself
insert image description here
insert image description here

insert image description here
The above ping means to check whether computer B can access its own host or external network

(7) Use the FinalShell of computer A to connect to the virtual machine on computer B.
insert image description here
Above, we have successfully accessed the virtual machine on computer B using computer A. Next, we can install the nacos server on the virtual machine of computer B, using A The computer has accessed the Nacos server on computer B. The process of installing the ncaos server is omitted, and accessing nacos http://192.168.2.109:8848/nacos
on the virtual machine of computer B on computer A is successfully accessed.

insert image description here

Guess you like

Origin blog.csdn.net/qq_44316726/article/details/127158569