How to set physics port in host(not virtual machice) of hyper-v External switch as trunk mode?

某某 0 Reputation points
2023-08-01T03:48:46.88+00:00

I hava a physics switch that contains some vlan, and its trunk port is connected to physics port in host(not virtual machice) of hyper-v switch. hyper-v switch contains also some vlan  corresponding to physics switch.

In order for them to communicate, I must set the hyperv switch physical port connected to the physical switch to trunk mode, but I don't know how do it.

There is a command 'Set-VMNetAdapterVlan', but it seems that it can only set adapter on VM not physics port on host.

In other words, I need to specify some tags, and when Ethernet frames with these tags pass through the physical port of the hyperv switch, these frames need to pass through the physical port intact(frames will not be losted and tag will not be losted), whether in or out.

Can hyper-v switch do it? if yes, how do it?

It seems that when creating a Hyper V External switch, a virtual NIC with the same name as the virtual switch being created is created. The Set-VMNetworkAdapterVlan command can only set the virtual NIC (that more accurately is not virtual NIC but virtual port on the virtual switch that connects to this virtual NIC) to trunk mode, but can't set the physical port of External switch to trunk mode. So, can I set physical port(that host's physical NIC become to) of virtual Switch to trunk? If yes? how do?

Windows for business | Windows Client for IT Pros | Storage high availability | Virtualization and Hyper-V
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 44,766 Reputation points
    2023-08-01T10:45:41.04+00:00

    Hello there,

    Microsoft's Hyper-V switch does not have a built-in feature to directly set a physical port in trunk mode. Hyper-V is primarily designed to create and manage virtual machines, and the virtual switches used by Hyper-V operate at Layer 2, which means they don't have direct control over physical port settings like a physical network switch does.

    However, if you need to configure a physical port on the host machine to operate as a trunk port (i.e., carry traffic for multiple VLANs), you can typically achieve this using the following steps:

    Configure Trunk Mode on the Physical Network Switch: Firstly, ensure that the physical network switch to which the Hyper-V host is connected is configured to support and allow trunking. The specific configuration steps will vary depending on the make and model of the switch.

    Create Virtual Switches for Each VLAN: Inside Hyper-V Manager, create individual virtual switches for each VLAN you want to pass through the trunk port. Each virtual switch will be associated with a separate VLAN.

    Bind Virtual Switches to the Host's Physical Network Adapter: Associate each virtual switch with the physical network adapter of the host machine. This can be done in the Hyper-V Manager under "Virtual Switch Manager."

    Configure VM Network Adapters: For each virtual machine, configure their network adapters to connect to the appropriate virtual switch based on the desired VLAN.

    Allow VLANs on the Physical Network Adapter: On the host's physical network adapter properties, you might need to allow the specific VLANs you want to pass through the trunk port. This setting is usually found in the "Advanced" settings of the network adapter.

    By following these steps, the Hyper-V virtual machines will be able to communicate over the specified VLANs using the trunk port on the physical network adapter

    I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer--


  2. 某某 0 Reputation points
    2023-08-02T16:24:35.62+00:00

    I use ovs did what I want to do, so I closed this question.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.