Muokkaa

Jaa


Create and configure a virtual switch with Hyper-V

Windows Server 2019, Microsoft Hyper-V Server 2019

This article shows you how to create and configure your virtual switch using Hyper-V Manager or PowerShell. A virtual switch allows virtual machines created on Hyper-V hosts to communicate with other computers. When you first install the Hyper-V role on Windows Server, you can optionally create a virtual switch at the same time. To learn more about virtual switches, see Hyper-V Virtual Switch.

For more information about how you can set up your networking infrastructure with Windows Server, review the Networking documentation.

Prerequisites

Before you can create and configure your virtual switch, your computer must meet the following prerequisites:

Create a virtual switch

Once you've completed the prerequisites, you'll be ready to create your virtual switch. In this section, we'll create a basic virtual switch by following these steps.

Here's how to create a virtual switch using Hyper-V Manager.

  1. Open Hyper-V Manager.

  2. From the Actions pane, select Virtual Switch Manager.

  3. Choose the type of virtual switch, then select Create Virtual Switch.

  4. Enter a name for the virtual switch, then perform one of the following steps.

    1. If you selected external, choose the network adapter (NIC) that you want to use, then select OK.

      You'll be prompted with a warning that the change may disrupt your network connectivity; select Yes if you're happy to continue.

    2. If you selected internal or private, select OK.

Management Operating System sharing

An external virtual switch allows your virtual machines to connect to an external network. You can also allow the management operating system to share the same selected network adapter. To begin, follow these steps.

Here's how to allow the management operating system to share the selected network adapter switch using Hyper-V Manager.

  1. Open Hyper-V Manager.

  2. From the Actions pane, select Virtual Switch Manager.

  3. Select the virtual switch you wish to configure, check the Allow management operating system to share this network adapter and select OK.

    You'll be prompted with a warning that the change may disrupt your network connectivity; select Yes if you're happy to continue.

Virtual LAN (VLAN) identification

You can specify the VLAN identification (ID) used by virtual machines network adapters and virtual switches. For virtual switches connected to either an external or internal network you can specify the (VLAN) ID. The VLAN ID number is used by the management operating system and virtual machines communicating through this virtual switch.

You can also configure your virtual switch with other VLAN options, such port mode and the native VLAN ID. For these options, you'll need to use PowerShell and ensure the configuration is compatible with your networks configuration.

To configure the VLAN identification for the switch, follow these steps.

Here's how to specify the VLAN ID using the Hyper-V Manager.

  1. Open Hyper-V Manager.

  2. From the Actions pane, select Virtual Switch Manager.

  3. Select the virtual switch you wish to configure, check the Enable virtual LAN identification for management operating system.

    1. You can enter any VLAN ID number or leave the default, then select OK.

      You'll be prompted to warn you that the change may disrupt your network connectivity, select Yes if you're happy to continue.

VLAN identifiers should be consistent with your network to ensure compatibility between your computer, virtual machines, and other network devices.

Next step

Now you've created and configured your virtual switch, here are other articles to help you continue with Hyper-V.