Virtual switch on Hyper-V could be configured with one of these three connections type.
- External Network: connected to a physical network. Allows the VMs to use your real NIC to communicate with the rest of the world just like a regular computer on your network would.
- Internal Network: not connected to a physical network. Lets the VMs on the server communicate with each other, and the server.
- Private network: not connected to a physical network. Lets the VMs on the server communicate with each other.
Use the Get-NetAdapter cmdlet to get the list of network adapters connected to the Host.
Now use the New-VMSwitch cmdlet to create the virtual switch.
Here I’m creating an External Network with a switch named External VM Switch.
The AllowManagementOS parameter specifies whether the management OS is to have access to the physical NIC bound to the virtual switch to be created.
The Name parameter specifies the name of the switch to be created.
The NetAdapterName parameter specifies the name of the network adapter to be bound to the switch to be created. When you use NetAdapterName parameter, it implicitly set the type of the virtual switch to External.
New-VMSwitch –Name “External VM Switch” –AllowManagement $True –NetAdapterName “Local Area Connection”
You can use Get-VMSwitch cmdlet to get the status of the vm switch.
The first virtual switch is here.
To remove the vm switch, use the Remove-VMSwitch cmdlet.
Remove-VMSwitch “External VM Switch”