Sharing Windows WLAN with Hyper-V VM malfunctions
该文章根据 CC-BY-4.0 协议发表,转载请遵循该协议。
本文地址:https://fenying.net/en/post/2025/05/17/windows-wlan-sharing-problem-with-vm-switch/
I have a Hyper-V VM running ArchLinux, and during the setup, I shared a physical network interface with the VM’s virtual switch.
The VM itself works well, but something strange is, the network connection fails inside the VM, after I reboot the host machine.
At the first glance, it seems like a Hyper-V issue, but this problem only occurs on my home PC, not on my work PC. The only difference is that my work PC is connected to a wired network, while my home PC uses a WLAN connection.
The manual solution is simple: disable and re-enable the shared network connection in the Hyper-V settings, then the VM can access the network again.
I think it’s too cumbersome to do this every time I reboot the host machine, so I looked for a more permanent solution.
One of the solutions I was hit is to create a PowerShell script that runs at startup to automatically re-enable the shared connection. However, before I write such a script, I wanted to check if there is a more straightforward solution. And, I got it!
The final solution is quite simple, it turns out to be an issue with Internet Connection Sharing (ICS) in Windows. By default, ICS settings is not persistent, which means it will be lost after a reboot.
1Windows Registry Editor Version 5.00
2
3[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedAccess]
4"EnableRebootPersistConnection"=dword:00000001
Save the registry file as fix-ics-persistent.reg
, then double-click to run it.
This will enable persistent ICS settings, and the shared connection will remain active after a reboot.
All problems gone.