- kube-scheduler: The Kubernetes scheduler - Fri, Sep 29 2023
- Kubernetes logs: Pod logs, container logs, Docker logs, kubelet logs, and master node logs - Mon, Sep 25 2023
- Kubernetes DaemonSets - Wed, Sep 6 2023
Virtual switch types
The type of virtual switch you'll create totally depends upon how you want your virtual machines to communicate over the network. Hyper-V allows you to create three types of virtual switches:
- Private—The VMs connected to a private virtual switch can communicate with each other on the same Hyper-V server but not with the external network (such as the Internet or Intranet). The VMs cannot even communicate with the host operating system running the Hyper-V hypervisor.
- Internal—The VMs connected to an internal virtual switch can communicate with each other and with the host operating system. Since this virtual switch is not bound to the physical network interface of the host system, the VMs connected to an internal virtual switch cannot access external network resources. However, you could set up a "NAT network" to get Internet access on the VMs.
- External—The VMs connected to an external virtual switch can fully communicate with each other, with the host, with the external network, and with the Internet. This virtual switch is bound to the physical network interface of the host system. The physical network interface can be either a single NIC or a team interface (multiple NICs acting as a team).
Create a virtual switch
To create an external virtual switch, we need to specify a physical network adapter with which to bind so that it can connect to a network. You can use the following command to get a list of all the physical network adapters available on your Hyper-V host:
Get-NetAdapter | ft ifIndex, Name, Status -Auto
We will use the Ethernet interface to bind with the external virtual switch.
To create the new external virtual switch, use the following command:
New-VMSwitch -Name "vEthernet" -NetAdapterName Ethernet -AllowManagementOS:$true
This command creates a new virtual switch with the name vEthernet. The -NetAdapterName parameter is used to specify the physical network adapter to bind. The -AllowManagementOS parameter with a $true value is used to allow the host OS to share the virtual switch and physical NIC with the VMs.
If you want to create an internal or private virtual switch, you can use the -SwitchType parameter with a value of either internal or private, as shown in the following commands:
New-VMSwitch -Name "InternalSwitch" -SwitchType Internal
This command creates an internal virtual switch with the name InternalSwitch.
New-VMSwitch -Name "PrivateSwitch" -SwitchType Private
This command creates a private virtual switch with the name PrivateSwitch.
View virtual switches
You can use the following command to list one or more virtual switches on the host:
Subscribe to 4sysops newsletter!
This command lists all the virtual switches created on the Hyper-V host server. On my server, I have created only one external virtual switch with the name vEthernet. We will connect the VMs that we will create in the next section to this virtual switch.