Create VLAN Interface in Win10
Run your power shell with admin
NOTE: All the test is basd on USB ASIX AX88179A USB Ethernet adapter
Create Virtual Switch
1
| New-VMSwitch -name VS0 -NetAdapterName DLINK100 -AllowManagementOS $false
|
Create Virtual Interface
We can add more virtual interfaces on each virtual switch
Add iface and set mac
1 2
| Add-VMNetworkAdapter -Switch VS0 -ManagementOS -Name "DLINK_V45" -StaticMacAddress 02-04-00-00-00-22
|
Set VLAN ID
1
| Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "DLINK_V45" -Access -VlanID 45
|
Management comand
Get all virtual switch
1 2 3 4 5 6
| get-vmnetworkadapter -managementos
Name IsManagementOs VMName SwitchName MacAddress Status IPAddresses ---- -------------- ------ ---------- ---------- ------ ----------- Container NIC 63053bc9 True Default Switch 00155D870D43 {Ok} DLINK_V45 True VS0 020600000022 {Ok}
|
Delete virtual interface
1
| remove-vmnetworkadapter -managementos -name "DLINK_V45"
|
Check status of virtual interface
1 2 3 4 5
| Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "DLINK_V45"
VMName VMNetworkAdapterName Mode VlanList ------ -------------------- ---- -------- DLINK_V45 Access 45
|
Delete Virtual Switch
1
| Remove-VMSwitch -name "VS0" -Force -Confirm
|
Whole flow
Add All
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| New-VMSwitch -name VS0 -NetAdapterName DLINK100 -AllowManagementOS $false Add-VMNetworkAdapter -Switch VS0 -ManagementOS -Name "VLAN45" -StaticMacAddress 02-04-00-00-00-22 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VLAN45" -Access -VlanID 45
Add-VMNetworkAdapter -Switch VS0 -ManagementOS -Name "VLAN65" -StaticMacAddress 02-04-00-00-00-44 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VLAN65" -Access -VlanID 65
Get-VMNetworkAdapterVlan -ManagementOS get-vmnetworkadapter -managementos
New-VMSwitch -name VS0 -NetAdapterName ASIX1000 -AllowManagementOS $true Add-VMNetworkAdapter -Switch VS0 -ManagementOS -Name "VLAN45" -StaticMacAddress 02-04-00-00-00-22 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VLAN45" -Access -VlanID 45 Get-VMNetworkAdapterVlan -ManagementOS get-vmnetworkadapter -managementos
New-VMSwitch -name VS0 -NetAdapterName Ethernet -AllowManagementOS $false
Add-VMNetworkAdapter -Switch VS0 -ManagementOS -Name "VLAN45" -StaticMacAddress 02-04-00-00-00-22 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VLAN45" -Access -VlanID 45 Add-VMNetworkAdapter -Switch VS0 -ManagementOS -Name "TRUNK" -StaticMacAddress 02-04-00-00-00-33 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "TRUNK" -Trunk -AllowedVlanIdList 2-100 -NativeVlanId 1 Get-VMNetworkAdapterVlan -ManagementOS get-vmnetworkadapter -managementos
Add-VMNetworkAdapter -Switch VS1 -ManagementOS -Name "TRUNK" -StaticMacAddress 02-04-00-00-00-33 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "TRUNK" -Trunk -AllowedVlanIdList 1-4094 -NativeVlanId 1
Add-VMNetworkAdapter -Switch VS1 -ManagementOS -Name "VLAN45" -StaticMacAddress 02-04-00-00-00-22 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VLAN45" -Access -VlanID 45
|
Check all
1 2 3 4
| Get-VMNetworkAdapterVlan -ManagementOS Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VLAN45" get-vmnetworkadapter -managementos
|
Delete ALL
1 2 3 4
| remove-vmnetworkadapter -managementos -name "VLAN45" remove-vmnetworkadapter -managementos -name "TRUNK" Remove-VMSwitch -name "VS0" -Force
|