How to configure the linux under the virtual machine and the wireless network card in the same network segment?

there are two network cards on the physical machine, one wired network card connected to internet and one wireless network card opening WIFI as a hot spot.
now I want to enable the virtual machine to be on the same network segment as the wireless network card, but I don"t know how to implement it

.

try to set up two virtual network cards, one is bridging to the wireless network card and the other is wired network card, and the IP with two network cards inside the virtual machine
now the virtual machine can ping each other with the IP of the wired network card, but the IP of the wireless network card and the IP of the wireless network card cannot ping each other

clipboard.png

clipboard.png
PS:

clipboard.png

clipboard.png

pingping

clipboard.png

clipboard.png

PS:192.168.191.1 is the address of the wireless network card seen on the physical machine


as a hot spot, you don't need an IP. You can tie it to the cable and have an IP as a whole.


I succeeded, but I used NAT mode. The ip segment of my home wireless network is 0 (192.168.0.A), so I set the segment of NAT subnet to 0 (192.168.0.0) in the lower left corner. Change the setting, select the NAT mode, and then click into the NAT settings to set the network segment of the gateway and the IP address of the virtual machine to 0, which is consistent with WLAN. Confirm to return. At this point, the ens33 inet address in the Linux system is changed to (192.168.0.B). You can change the property of VMnet8 in the windows system network adapter option-the ip address in Ipv4 to (192.168.0.C). Note that the values of A, B and C are not the same.
at this time, Win and Linux can ping each other (provided that you have already communicated with each other before you change these). I found that in this case, the three network segments are the same, and there is no pressure to surf the Internet. But later, in order to verify whether the network segment is the same so I can go to the wireless network, I changed the network segment back. After connecting the virtual machine and the physical machine, it is found that the Internet is as good as before, so it is possible that the internet on the WLAN has nothing to do with whether the network segment is the same or not.
I checked other materials and found that the bridge itself can only connect virtual machines and physical machines to internet, and if you want to connect both to internet, you should use NAT

Menu