Short Description:
Fixed Hyper‑V VM connectivity by creating an external virtual switch.
I was experiencing a loss of Internet connectivity in a Windows virtual machine running on Hyper‑V. Although the VM received an IP address via the Default Switch, it could not reach the Internet—the gateway (172.29.128.1), external IP addresses (e.g., 8.8.8.8), or HTTPS endpoints were unreachable.
-
Diagnostics from Inside the VM:
ipconfig /all
showed an assigned IP (172.29.137.218), subnet mask, DHCP default gateway, and DNS.- Pinging the default gateway (
172.29.128.1
) and external IPs timed out. tracert
to 8.8.8.8 did not progress beyond the initial hops.Test-NetConnection dev.azure.com -Port 443
failed, confirming no TCP connectivity.
-
Routing and Adapter Checks:
- The routing table contained a default route via the gateway (172.29.128.1), yet packets were not leaving the virtual network.
- DNS resolution occurred properly (validated with
nslookup
), hinting that basic DHCP functions were working.
After reviewing the network configuration inside the VM and analyzing the Hyper‑V Default Switch behavior, I opted to bypass the troublesome NAT configuration by creating an external virtual switch.
-
Access Hyper‑V Manager on the Host:
Open the Hyper‑V Manager and go to Virtual Switch Manager. -
Create a New External Virtual Switch:
- Select External Network.
- Choose the active physical network adapter (e.g., the one providing Wi‑Fi or wired connectivity—avoid using VPN-specific adapters unless intended).
- Ensure that "Allow management operating system to share this network adapter" is enabled.
- Click OK to create the switch.
-
Reassign the VM’s Network Adapter:
- Open the settings for the affected VM.
- Change the network adapter’s connection from the Default Switch to the newly created external virtual switch.
- Restart the VM.
-
Confirm Connectivity Inside the VM:
- Run
ipconfig
to verify that a new IP address appropriate for your network is assigned. - Use
ping 8.8.8.8
,tracert
, andTest-NetConnection
commands to confirm that the VM is now able to reach external addresses.
- Run
Creating an external virtual switch allowed the VM to bridge directly to the physical network adapter, bypassing the NAT limitations of the Default Switch. This resolution restored full Internet connectivity in the VM.
Documented as a reference for troubleshooting similar Hyper‑V networking issues.