Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, March 30, 2015 10:09 AM
Hi all
I'm having some trouble with Powershell commands that will set up vlan trunking mode to a specific VM's network adaptor, and I was wondering if you may be able to help please? I should note that what I am trying is new to me, so it's possible that I do not understand it or that what I am trying / hoping to achieve is not possible.
Essentially, I have a generation 2 VM on Hyper-V, that I need to be able to speak over 9 vlans. The maximum number of vNIC's as I understand it are 8 (whereas you can have 12 on generation 1). The VM as it is now has 8 x vNIC's. Within the list of vlans that I need comms over, there is a range of 2214-2217.
In a lab environment, I have attempted the following command which completes successfully, but I can't see how the below is targeting or set on a specific vNIC, suggesting its global to all the vNIC's?
Set-VMNetworkAdapterVlan -VMName test1 -Trunk -AllowedVlanIdList "1-5" -NativeVlanId 6
I understand it that you must set the native vlan ID outside of what you wish that VM to access.
My problem is that I cannot get the above command to target a specific vNIC, and I am concerned that it would break all connectivity, when all I really to need to achieve is vNIC 8 speking over range 2214-2217.
Would anyone have any advice on how to get this working, or suggest a better way perhaps?
Thanks
Paul
All replies (2)
Monday, March 30, 2015 3:16 PM âś…Answered | 3 votes
Hi all
I posted this question in the Hyper-V forum too, as it may have been more suitable there. Anyway, I have an answer to the problem now - it can be seen in more detail here:
The final command that allowed me to target a specific adaptor on a VM and put it in trunk mode is below:
Get-VMNetworkAdapter -VMName <VMname here> | Where-Object -Property MacAddress -eq "<MAC address here>" | Set-VMNetworkAdapterVlan -Trunk -AllowedVlanIdList "x-x" -NativeVlanId x
(You have to set a native vlan ID, and it has to be outside of your required vlan list. The x depicts the vlan ID required and a range of vlans)
Tuesday, March 31, 2015 9:44 AM
Hi Baoth,
Thanks for sharing the solution =)
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]