当前位置:网站首页>Under the same WiFi, the notebook is connected to the virtual machine on the desktop

Under the same WiFi, the notebook is connected to the virtual machine on the desktop

2022-06-25 17:28:00 jaffe—fly

The virtual machine must be in Bridge Street mode

 Insert picture description here

Vmware You must select the host network card in the virtual network editor of

 Insert picture description here

 Insert picture description here
 Insert picture description here
Don't select auto here
Don't select auto here
Don't select auto here

Choose the one on your host that accesses the Internet wifi network card

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

The problem is , Why change to bridge mode , The host machine ping No virtual machine , Virtual machine also ping No host , Virtual machine also ping no www.baidu.com,
That's the problem

Network segment

The same network segment means multiple IP If they have the same network address, they are considered to be in the same network segment . Illustration :192.168.1.60 and 192.168.1.70 Two IP If the mask is used, it is 255.255.255.0 Words , The same network address is 192.168.1.0 Well, the two one. IP On the same network segment . But if two IP The mask used is 255.255.255.192 Then their network addresses are 192.168.1.0 and 192.168.1.64 了 , These are two Ip It is not in a network segment .
So... With the same network address IP In the same segment , Computers in the same network segment can communicate directly , The gateway is required for host communication between different network segments .

Because virtual machines used to be NAT Pattern , Later, in order to connect desktop computers with notebooks , The mode of the virtual machine must be set to bridge , Although the settings have been changed , however ip The address is still reserved before NAT Of ip, So you need to check the host computer ip And gateway , The virtual machine is changed to be the same as the host
The host machine ipconfig see
 Insert picture description here
IPv4 Address , Subnet mask , The default gateway All three are important

gateway (Gateway)

For host computer route print, For virtual machines route -n, View gateway routes

Set up

The virtual machine ip Change the address to 192.168.3.xxx
The virtual machine mask remains the same as the host
The gateway is set to the same
Use command vim /etc/sysconfig/network-scripts/ifcfg-ens33

IPADDR=192.168.3.100
NETMASK=255.255.255.0
GATEWAY=192.168.3.1

Remember... After the change service network restart

Get it done , Toss about 2 Hours , You can happily use your laptop to toss around your desktop , Mainly to build k8s

原网站

版权声明
本文为[jaffe—fly]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251708206497.html