Introduction
Hyper-V virtual switches are a key component for network interaction between virtual machines and the physical network, as well as between the VMs themselves. Without a properly configured virtual switch, virtual machines cannot access the internet, local resources, or communicate with each other. This guide will help you create and configure a virtual switch in Hyper-V on Windows 10, 11, or Windows Server, covering all three switch types and ensuring stable network operation.
Prerequisites
Before you begin, ensure the following conditions are met:
- Hyper-V role installed on your system. On client versions of Windows (10/11), this can be done via "Control Panel" → "Programs and Features" → "Turn Windows features on or off" by checking "Hyper-V". On Windows Server, use Server Manager.
- Administrator privileges to modify system settings.
- Physical network adapter (Ethernet or Wi-Fi) to create an External switch. The adapter must be active and not used by other virtual switches.
- Recommended: Update network adapter drivers to the latest version via Device Manager or the manufacturer's website to avoid conflicts.
Step-by-Step Instructions
Step 1: Launch Hyper-V Manager with Administrator Rights
⚠️ Important: Creating and configuring virtual switches is impossible without administrator rights. Always run Hyper-V Manager as an administrator.
- Click the Start button or press the
Winkey. - Type
Hyper-V Managerin the search box. - In the search results, right-click on "Hyper-V Manager" and select "Run as administrator".
- Confirm the User Account Control (UAC) prompt if it appears.
Step 2: Open the Virtual Switch Manager
- In the Hyper-V Manager window (main window), locate the "Actions" pane on the right side of the window.
- Under the "Hyper-V Manager" section, click the link "Virtual Switch Manager...".
- A new "Virtual Switch Manager" window will open, displaying current switches (if any) and management buttons.
Step 3: Create a New Virtual Switch
- In the Virtual Switch Manager window, click the "Create Virtual Switch" button in the right-hand pane.
- The virtual switch creation wizard will appear. The first step is to choose the switch type. Three options are available:
- External: Connects virtual machines directly to the physical network via the selected network adapter. The host system can also use this adapter (if configured). This type allows VMs to access the internet and local network.
- Internal: Creates a network where only virtual machines and the host system itself can communicate. No external access. Useful for isolated test environments.
- Private: Provides connectivity only between virtual machines connected to this switch. The host system does not participate in this network segment. Used for creating completely isolated clusters.
- Select the appropriate type and click "OK".
Step 4: Configure Settings (External Switch Only)
If you selected External, a window with additional settings will appear:
- Under "Connect to:", select the physical network adapter from the dropdown list to which the switch should be bound (e.g., "Ethernet" or "Wireless Network").
- Adapters already used by other Hyper-V virtual switches will be marked and unavailable for selection.
- Check or uncheck "Allow management operating system to share this network adapter":
- ✅ Checked (default for External): The host system will use this same physical adapter through the virtual switch. This is the standard setting, allowing both the host and VMs to be on the network.
- ❌ Unchecked: The host system will lose network access via this adapter. Only VMs will be able to use it. Used in specific scenarios.
- For Internal and Private types, no additional settings are required—simply confirm the selection.
Step 5: Apply Changes and Complete Creation
- After configuring the parameters (or immediately after selecting the type for Internal/Private), click "OK" in the switch creation window.
- The system may display a warning: "Network services will be restarted. Continue?". This is normal, as Hyper-V reconfigures network adapters. Click "Yes".
- Wait for the process to complete (usually a few seconds). If an error occurs, see the "Possible Issues" section.
- The new switch will appear in the list of virtual switches in the manager, showing its type and name (default is "Virtual Switch").
Step 6: Verify Switch Operation
Now you need to ensure the switch is functioning correctly:
- Connect the switch to a virtual machine:
- If you already have a VM, open its Settings (in Hyper-V Manager, right-click the VM → "Settings").
- In the "Network Adapter" section (or "Hardware" → "Network Adapter"), select your created virtual switch from the list.
- Click "OK".
- If you don't have a VM, create a new one via "Action" → "New" → "Virtual Machine", and during the network setup step, select your switch.
- Start the virtual machine and log into its operating system.
- Check network connectivity:
- For an External switch: open Command Prompt (
cmd) or PowerShell and run:
Successful replies indicate internet access. Also check IP address acquisition viaping 8.8.8.8ipconfig /all—the address should be from your physical network's subnet (or from DHCP). - For an Internal switch: on the host (main system), open Command Prompt and run
ipconfig, locate the adapter named "Hyper-V Virtual Ethernet Adapter". Note its IP address (e.g., 192.168.0.1). In the VM, assign an IP in the same subnet (e.g., 192.168.0.2) and ping the host's address. - For a Private switch: run two VMs connected to the same Private switch. Assign them IPs in the same subnet (e.g., 10.0.0.10/24 and 10.0.0.11/24) and check connectivity via
ping.
- For an External switch: open Command Prompt (
Verification
You have successfully created a Hyper-V virtual switch if:
- The switch appears in the Virtual Switch Manager in Hyper-V.
- Virtual machines connected to the switch have working network connectivity:
- For External: the VM obtains an IP address (via DHCP or statically) and can reach external resources (e.g.,
ping ya.ru). - For Internal: the VM and host system can exchange packets (ping between them succeeds).
- For Private: VMs on the same switch can see each other (ping between their IP addresses succeeds).
- For External: the VM obtains an IP address (via DHCP or statically) and can reach external resources (e.g.,
- In Task Manager (Performance tab → Ethernet), the network adapter corresponding to the switch is active and shows data transfer when the VM is active.
Possible Issues
Error: "Failed to create virtual switch. The action was not completed."
- Cause: The selected physical adapter is already used by another Hyper-V virtual switch or is blocked by the system (e.g., used for a bridge or other software).
- Solution:
- Remove any existing virtual switches using this adapter (via the Virtual Switch Manager).
- Restart Hyper-V Manager as administrator.
- Select a different free physical adapter or free up the needed one by disconnecting it from other configurations.
Error: "Access denied" or "Administrator privileges required"
- Cause: Hyper-V Manager was launched without elevated privileges.
- Solution: Close Hyper-V Manager and restart it by selecting "Run as administrator" (see Step 1).
Host system lost network access after creating an External switch
- Cause: During External switch creation, the "Allow management operating system to share this network adapter" checkbox was not checked, and the host was disconnected from the physical adapter.
- Solution:
- Open the Virtual Switch Manager.
- Select the problematic External switch and click "Properties" (or delete and recreate it).
- Check "Allow management operating system to share this network adapter" and click "OK".
- Restart the host system or restart network services (
net stop vmms && net start vmmsin an elevated Command Prompt).
Virtual machine does not obtain an IP address (for External switch)
- Cause: The DHCP server on the physical network is unavailable, not responding, or blocking requests from the virtual adapter. Also possible that DHCP client is disabled on the VM.
- Solution:
- On the VM, open Command Prompt and run
ipconfig /release, thenipconfig /renewto force an IP request. - If that doesn't work, configure a static IP address in the same subnet as the physical network (e.g., if the host has 192.168.1.100/24, assign the VM 192.168.1.101/24, gateway 192.168.1.1, DNS same as host).
- Check if a firewall on the host or network is blocking DHCP requests (Hyper-V does not block this by default, but third-party software might).
- On the VM, open Command Prompt and run
Other VMs are not visible on Internal/Private networks
- Cause: Virtual machines are in different IP subnets or have incorrect IP address settings. For an Internal switch, the host system must also be in the same subnet.
- Solution:
- For Internal: On the host, find the "Hyper-V Virtual Ethernet Adapter" (via
ipconfig), assign it a static IP (e.g., 192.168.0.1/24). On each VM in this network, assign an IP from that subnet (192.168.0.2, 192.168.0.3, etc.)—no gateway required. - For Private: Assign IP addresses to VMs in the same subnet (e.g., 10.0.0.10/24 and 10.0.0.11/24). Gateway and DNS are not needed unless external access is required.
- Ensure the network adapter is enabled on the VMs and temporarily disable the firewall for testing (ping).
- For Internal: On the host, find the "Hyper-V Virtual Ethernet Adapter" (via