Hyper-V 5 min de leitura

Investigate a virtual switch after a host network change

Este artigo ainda não foi traduzido — está a ver a versão em inglês.

Nesta página
  1. Verify mandatory virtual switch extensions
  2. Check the management operating system sharing
  3. Confirm the virtual switch binding
  4. Verify VLAN configuration
  5. Test connectivity

You changed a physical network adapter on a Windows Server 2025 Hyper-V host, and now virtual machines are losing connectivity or the host itself has dropped off the network. The first thing to check is not the virtual machines, but the virtual switch configuration and the mandatory extensions that sit between the VMs and the physical hardware.

Hyper-V Virtual Switch is a software-based layer-2 Ethernet network switch that provides the connectivity for virtual machines to external networks Hyper-V Virtual Switch. When the underlying physical network changes, the virtual switch must be reconfigured to bind to the correct adapter, and any extensions that enforce security or isolation must remain active. If an extension is missing or disabled, network traffic can be blocked entirely Ensure that all mandatory virtual switch extensions are available.

Verify mandatory virtual switch extensions

Virtual Switch Extensions are plug-ins that provide enhanced networking and security capabilities, such as tenant isolation, traffic shaping, and protection against malicious VMs Hyper-V Virtual Switch. These extensions are listed in the Virtual Switch Manager and can be managed programmatically. Some extensions are mandatory for the virtual switch to function correctly for connected virtual network adapters.

If a mandatory extension is disabled or not installed, network traffic is blocked on the affected virtual network adapters Ensure that all mandatory virtual switch extensions are available. This is a common cause of sudden connectivity loss after a host reboot or a network adapter replacement, as the extension service may not start in time or may fail to load.

To verify the status of extensions:

  1. Open Hyper-V Manager.
  2. From the Actions pane, select Virtual Switch Manager.
  3. Select the virtual switch in question.
  4. Review the list of extensions. If any are marked as disabled or missing, you need to enable or reinstall them.

You can also use PowerShell to check and enable extensions. The Enable-VMSwitchExtension cmdlet allows you to enable a disabled extension Ensure that all mandatory virtual switch extensions are available. If the extension is not installed, you must install it first. The Best Practices Analyzer can also scan for this issue, reporting a warning if mandatory extensions are unavailable Ensure that all mandatory virtual switch extensions are available.

Check the management operating system sharing

An external virtual switch allows virtual machines to connect to an external network. You can also allow the management operating system (the host itself) to share the same network adapter Create and configure a virtual switch with Hyper-V. This is crucial because if you change the physical adapter and the management OS is no longer bound to the virtual switch, you may lose remote management capabilities, making further troubleshooting difficult.

If you have recently changed the physical network adapter, ensure that the management OS is still allowed to share the new adapter. In Hyper-V Manager, select the virtual switch, check the box Allow management operating system to share this network adapter, and select OK Create and configure a virtual switch with Hyper-V. You will be prompted with a warning that the change may disrupt your network connectivity; select Yes if you are prepared to continue.

In PowerShell, you can verify and set this using the Set-VMSwitch cmdlet:

Set-VMSwitch -Name Examplevmswitchname -AllowManagementOS $true

Replace <vmswitch name> with the name of your virtual switch. This command ensures that the host’s management network is attached to the virtual switch, allowing it to communicate through the new physical adapter Create and configure a virtual switch with Hyper-V.

Confirm the virtual switch binding

When you change the physical network adapter, the virtual switch must be reconfigured to use the new adapter. If the virtual switch is still bound to the old adapter, or if the new adapter is not correctly assigned, VMs will not have network access.

To verify the binding:

  1. Open Hyper-V Manager.
  2. From the Actions pane, select Virtual Switch Manager.
  3. Select the virtual switch.
  4. Check the External network section. Ensure that the correct physical network adapter is selected.

If the adapter is not listed, it may not be available or may be disabled. You can also use PowerShell to create or modify the virtual switch. To create an external virtual switch, use the New-VMSwitch cmdlet with the NetAdapterName parameter:

New-VMSwitch -Name Exampleswitchname -NetAdapterName Examplenetadaptername

This command implicitly sets the type of the virtual switch to external Create and configure a virtual switch with Hyper-V. If you need to modify an existing switch, you may need to delete and recreate it, or use the Hyper-V Manager UI to change the binding.

Verify VLAN configuration

If your network uses VLANs, ensure that the virtual switch and the management OS are configured with the correct VLAN ID. Incorrect VLAN configuration can cause traffic to be dropped by the physical switch.

In Hyper-V Manager, select the virtual switch, check the box Enable virtual LAN identification for management operating system, and enter the correct VLAN ID Create and configure a virtual switch with Hyper-V. You can also configure VLAN settings for virtual network adapters using PowerShell.

To set the VLAN ID for the management OS, use the Set-VMNetworkAdapterVlan cmdlet:

Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName Examplevmswitchname -Access -VlanId Exampleid

This command sets the port mode to access and assigns the specified VLAN ID to the management OS network adapter Create and configure a virtual switch with Hyper-V. For trunk mode, you can use splatting to pass multiple parameters:

$parameters = @{
    ManagementOS = $true
    VMNetworkAdapterName = Examplevmswitchname
    Trunk = $true
    NativeVlanId = Exampleid
    AllowedVlanIdList = Exampleallowedids
}
Set-VMNetworkAdapterVlan @parameters

This example uses splatting to pass parameter values from the $parameters variable to the command Create and configure a virtual switch with Hyper-V.

Test connectivity

After verifying the extensions, management OS sharing, binding, and VLAN configuration, test connectivity from both the host and the virtual machines. Use ping to test connectivity to the default gateway and external resources. If connectivity is still failing, check the physical switch configuration to ensure that the new adapter is correctly configured and that the VLAN settings match.

If the issue persists, review the Hyper-V logs and the Best Practices Analyzer results for any additional warnings or errors Ensure that all mandatory virtual switch extensions are available. Ensure that all mandatory extensions are installed and enabled, and that the virtual switch is correctly bound to the new physical adapter.

By systematically checking these components, you can identify and resolve the cause of network connectivity issues after a host network change.

Pesquisar