1. Information

2. External

Google on: move windows 11 host behind hyper-v switch

Moving a Windows 11 host behind a Hyper-V virtual switch means connecting your host’s networking through a virtual NIC created by Hyper-V, effectively putting the host in the same network segment as your virtual machines (VMs). This is done by configuring an External Virtual Switch and allowing the management operating system to share the network adapter.

Important Considerations * IP Address Changes: The host’s network connection will likely lose its IP address and DHCP will assign a new one, or you may need to reconfigure a static IP on the new virtual adapter. * Loss of Connectivity: As warned, the host will lose network connectivity during the changeover. * Alternative (NAT): If you are trying to isolate the host for security rather than join the VM network, consider creating an Internal Switch and configuring NAT (Network Address Translation) via PowerShell. * Wi-Fi Issues: While this works for Ethernet, creating external switches on Wi-Fi adapters can sometimes be unstable in Windows 11.

Steps to Move Host Behind a Hyper-V Switch

  • Open Hyper-V Manager: Search for "Hyper-V Manager" in your Start menu.

  • Open Virtual Switch Manager: In the right-hand Actions pane, click on Virtual Switch Manager.

  • Create a New Switch:

  • Select New virtual network switch.

  • Select External and click Create Virtual Switch.

  • Give it a name (e.g., "External-Host-Switch").

  • Configure Network Connection:

  • Under "Connection Type," ensure External network is selected.

  • Select the physical network adapter (Ethernet or Wi-Fi) that is connected to your network.

  • Enable Management Sharing (Crucial Step):

  • Check Allow management operating system to share this network adapter.

  • Warning: This will briefly disconnect your host from the network.

  • Apply Settings: Click Apply and then Yes to the warning prompt.

Once completed, a new virtual network adapter ("vEthernet (Switch Name)") will appear in your host network connections, and the host will be behind that switch.

3. Internal

Alternative (NAT): If you are trying to isolate the host for security rather than join the VM network, consider creating an Internal Switch and configuring NAT (Network Address Translation) via PowerShell.

Google on: move windows 11 host behind hyper-v internal switch

Important Notes Isolation: Internal switches isolate the VMs and the host from the outside network, but allow communication between them. Alternative for Internet Access (NAT): If you need the VMs to access the internet via the host while still being "behind" a switch, you must use PowerShell to create a NAT network, as it is not available directly in the UI. Troubleshooting: If the network fails after a Windows update, consider checking and removing the "Microsoft Azure VFP Switch Filter Extension" in the virtual switch extensions.

Steps to Configure

  • Create an Internal Virtual Switch.

  • Open Hyper-V Manager.

  • Click on Virtual Switch Manager in the Actions pane.

  • Select New virtual network switch.

  • Choose Internal and click Create Virtual Switch.

  • Name it (e.g., "Internal-Network") and ensure the connection type is set to Internal network.

  • Click Apply.

  • Configure Host Network Adapter.

  • Open Control Panel → Network and Internet → Network and Sharing Center → Change adapter settings.

  • Locate the new vEthernet adapter corresponding to your Internal Switch.

  • Right-click the adapter and select Properties.

  • Select Internet Protocol Version 4 (TCP/IPv4) and click Properties.

  • Set a static IP address (e.g., 192.168.100.1, subnet mask 255.255.255.0). Do not set a default gateway.

  • Assign VMs to the Internal Switch.

  • In Hyper-V Manager, right-click your VM and go to Settings.

  • Select the Network Adapter and change the Virtual Switch to the new "Internal-Network".

  • Inside the VM, configure a static IP address within the same subnet (e.g., 192.168.100.2, subnet 255.255.255.0, gateway 192.168.100.1).

4. PowerShell

5. NAT

Berno           192.168.2/24
Grendel         10.1.7.0/24
Japke           192.168.1/24

Internal        10.10.1.0/24
  • See https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/setup-nat-network.

    # Create an internal virtual switch.
    $SwitchName = "Internal Switch"
    New-VMSwitch -SwitchName $SwitchName  -SwitchType Internal
    Get-VMSwitch
    Get-VMSwitch -Name $SwitchName | Select-Object -ExpandProperty AllowManagementOS
    
    # Find the interface index (ifIndex) of the virtual switch just created.
    $InterfaceIndex = Get-NetAdapter -Name "vEthernet ($SwitchName)" | Select-Object -ExpandProperty ifIndex
    
    # Create the NAT Gateway.
    Get-NetIPAddress -AddressFamily IPv4 -InterfaceIndex $InterfaceIndex
    $Null = New-NetIPAddress -IPAddress 10.10.1.1        -PrefixLength 24                         -InterfaceIndex $InterfaceIndex
    Get-NetIPAddress -AddressFamily IPv4 -InterfaceIndex $InterfaceIndex
    
    # Configure the NAT network.
    $Null = New-NetNat -Name MyNATnetwork     -InternalIPInterfaceAddressPrefix 10.10.1.0/24
    Get-NetNat

To connect a virtual machine to your new NAT network, connect the internal switch you created in the first step of this article to your virtual machine using the VM Settings menu.

Get-VMSwitch -Name "Default Switch"

Enable Routing and Remote Access service in Services (services.msc).

  • Open Services (Control Panel > Administrative Tools > Services) (services.msc).

  • Right-click Routing and Remote Access and select Properties.

  • Select Automatic (Delayed Start) for the Startup type.

  • Click Apply.

  • Click Start.

  • Click OK.

  • Quit Services.

  • Right-click Wi-Fi in Network Connection and select Properties.

  • Select the Sharing tab.

  • Check Allow other network users to connect through this computer’s Internet connection.

  • Select the vEthernet (Internal Switch) for the Home networking connection.

  • Click OK.