Under the same wifi, the laptop is connected to the virtual machine on the desktop

The virtual machine must be in bridge street mode

insert image description here

In the virtual network editor of Vmware, the network card of the host must be selected

insert image description here

insert image description here
insert image description here
Don’t choose automatic here,
don’t choose automatic
here, don’t choose automatic here,

choose the wifi network card of your host computer to access the Internet

The network segment and gateway of the virtual machine must be the same as those of the host

The problem lies in why the host cannot ping the virtual machine after changing to bridge mode, the virtual machine cannot ping the host, and the virtual machine cannot ping, the www.baidu.comproblem
lies here

network segment

The same network segment means that if multiple IPs have the same network address, they are considered to be in the same network segment. Example: If the two IPs of 192.168.1.60 and 192.168.1.70 both use the mask of 255.255.255.0, and the same network address is 192.168.1.0, then the two IPs are in the same network segment. But if the mask used by the two IPs is 255.255.255.192, then their network addresses are 192.168.1.0 and 192.168.1.64 respectively, which means that the two IPs are not in the same network segment.
Therefore, IPs with the same network address are in the same network segment, and computers in the same network segment can communicate directly, but a gateway is required for communication between hosts in different network segments.

Because the virtual machine was in NAT mode before, in order to connect the laptop to the desktop, the mode of the virtual machine must be set to bridging. Although the setting has been changed, the ip address of the previous NAT is still reserved, so you need to check the host machine. The ip and gateway, the virtual machine is changed to be the same as the host,
the host ipconfigchecks
insert image description here
the IPv4 address, the subnet mask, and the default gateway are all important

Gateway

Use it on the host machine route print, use it on the virtual machine route -n, and check the gateway route

set up

Replace the ip address of the virtual machine with 192.168.3.xxx
the mask of the virtual machine to keep the same as the host, and
set the gateway to the same
Use the commandvim /etc/sysconfig/network-scripts/ifcfg-ens33

IPADDR=192.168.3.100
NETMASK=255.255.255.0
GATEWAY=192.168.3.1

remember after changingservice network restart

Done, toss for 2 hours, you can happily use the laptop to toss the desktop, mainly to build k8s

Guess you like

Origin blog.csdn.net/weixin_44831720/article/details/125453917