I need my VM to have internet access through my Mac's network connection (wifi in my case) and I get this with "Share with my Mac" which uses NAT.
When I **disconnect** my Mac from a wifi network (note: wifi is still **on**), the VM is naturally disconnected from the LAN, however the VM is also **disconnected** from the host. This means that I'm no longer able to, for example SSH into the VM from my Mac host, which is a **major** problem when I'm in a location (e.g. airplane) where I don't want to connect to a wifi network.
My setup:
* MBA with wifi only
* macOS 12.3
* Linux VM
* VM's network adapter configured as "Share with my Mac"
How can I achieve a NAT connection, but when the host wifi is off or disabled I still have the **local host to VM** connection?
This surely can't be an unusual situation and there must be users who work on an airplane without wifi and use VMs for development or other technical work.
Maybe something has changed in later versions of macOS because I don't recall the requirement to be connected to a wifi network for a VM to be accessible from the Mac host when using "Share with my Mac" 🤔
I believe you'll need to change the VM to be 'host only' networking in that case.
That's not very convenient. I don't understand why using "Share with my mac" stops working when wifi is disconnected.Terrible user-experience 😞
Well, the other option is to use a full-duplex loopback dongle in your RJ45 port, and point to that "NIC".
If your computer doesn't have network access, then why would you expect a setting which SHARES that access to work?
If it's something you encounter frequently, it's probably easier to add a second virtual NIC to the VM as host-only, and toggle which NIC is disabled (via the toolbar icons) to tell the guest which NIC to use.
> If your computer doesn't have network access, then why would you expect a setting which SHARES that access to work?
I don't think it unreasonable to expect that **disconnecting** from a wifi network doesn't **also** disconnect the VM from your Mac host. I mean logically the VM is getting an IP lease from the internal DHCP server, so why wouldn't host-VM communication continue?
No, no it isn't. If you are using bridged mode, then the VM is getting it's IP, etc., from your external source. If that external source goes away, how would you expect the networking to continue to work?
Exactly, the network stack that the shared access connects to is the Mac's stack. When the wifi network drops, that stack no longer exists.
But NAT is different than bridge networking.
I can see @cookieme 's thought here. If you think of NAT as a network router that's got connectivity to a "local" network (the NAT network segment) and "remote" connectivity (the Mac's external network), one could expect that if the "remote" side is unavailable, the "local" network should still work. The Mac has an address on that "local" segment, and it should theoretically still be accessible.
If you have a wireless router, you don't lose your internal network should the external uplink go offline, do you? No. You just lose the gateway to the outside world.
Ahh, sorry. As a power user, the nomenclature on Macs still confuses me, as they try to dumb down the user interface. I thought OP was using bridged mode.
Yes, I would agree that I would also expect a NAT connection to still maintain the internal networking connection if the external interface goes down.
I wonder if this is because it uses the apple networking stack now for external access, and the host OS brings it down when the connection is lost?
Just ran a test. There didn't appear to be any change in the macOS networking status (examined through ifconfig) of the bridge or associated vmenet interfaces created by Fusion between when I had the WiFi on or off. The IP address of the Mac on the NAT network also is able to be ping'ed.
@Technogeezer you explained it perfectly!
I also did some more testing with an older macOS (10.14.6) and VMware Fusion (11.5.7) version. Disconnecting from a wifi network on the host or turning off wifi altogether **does not** disable the host-VM network connection.
Something has definitely changed and unless I've missed an announcement or known issue in a newer VMware Fusion release, this is a pretty big deal IMO.
Maybe as @ColoradoMarmot suggests the recent behaviour change is due to VMware using Apple's Hypervisor framework. Regardless, there should be a workaround or known issue explaining that disconnecting from a wifi network or turning off wifi will render the VM isolated from the host!
@Mikero can you please comment?
@Technogeezer wrote:Just ran a test. There didn't appear to be any change in the macOS networking status (examined through ifconfig) of the bridge or associated vmenet interfaces created by Fusion between when I had the WiFi on or off. The IP address of the Mac on the NAT network also is able to be ping'ed.
I observed the same on the macOS side, I can ping the NAT gateway, however the VM's network adapter does not receive an IP lease from the macOS DHCP server.
Did you see the same @Technogeezer?
I thought I'd try and set a static IP in the VM (same ip as DHCP lease) and then bring up the interface. Bringing up the interface fails in the linux VM. Nothing in the linux logs indicates any errors.
Bumping this.
It seems that things changed when VMware moved to using Apple's DHCP server and AFAIK there's no official known issue about how the "Share with my Mac" network connection has changed from previous macOS and VMware Fusion versions!
It would be great to hear from VMware on this issue which I regard as quite critical to many users' workflows. cc @Mikero
Bumping this thread again in the hope that someone from VMware might respond with a solution to what it is a really frustrating issue.
If NAT does not work - use a second hostonly network to connect host and VM.
Ulli