Creating virtual switches
Figure 3
shows the New Virtual Network Switch page of the Virtual Switch
Manager dialog box for a Hyper-V host.
Clicking Create Virtual Switch, shown in Figure 3, creates a new
virtual switch of the type selected (here, External), and the
properties of the new virtual switch can now be configured as shown
in Figure 4. The key
properties to configure are these:
-
Specifying a descriptive name for the new switch
-
Selecting the connection type (External, Internal, or
Private) if you decide to change your initial choice
If you select External as the connection type, you must assign
a physical network adapter on the host to the new switch. In that
case, you also have the option of allowing the management operating
system on the host to share the selected network adapter. If you are
using a separate physical network for host management, and the host
has another physical network adapter connected to the management
network, you can clear the check box shown as selected in Figure 3. Additionally,
you also have the option of enabling single-root I/O virtualization
(SR-IOV) if the selected network adapter supports this feature.
Finally, if you are using
virtual local area networks (VLANs) to segment traffic on your
production network, you can enable this feature and specify a VLAN
identifier here.
Note
Network connections and virtual switches
Creating a new virtual switch of type External also creates
a new network connection in the Network Connections folder on the
server, which can be displayed using the Network And Internet
utility in Control Panel. The new network connection is typically
named “vEthernet (<name of virtual
switch>), and the TCP/IP settings assigned to the
physical network adapter associated with the switch become the
TCP/IP settings of the new connection.
You can also use the New-VMSwitch cmdlet to create new virtual
switches using Windows PowerShell. For example, the following
command could be used to create the CONTOSO Virtual Switch shown in
Figure 4:
New-VMSwitch -Name "CONTOSO Virtual Switch" `
-NetAdapterName "Broadcom NetXtreme Gigabit Ethernet #2" -ComputerName HOST4
For help with the syntax of this cmdlet, use the Get-Help
New-VMSwitch command.
Important
Network connectivity with the host
Creating or reconfiguring a virtual switch results in
changes that might disrupt network connectivity with the host. If
you are managing the host remotely using Remote Desktop
Connection, you might need to close and re-open the connection
after making such changes. In addition, loss of network
connectivity by the host when the changes are applied might affect
any network operations in progress.
In addition to creating and configuring virtual switches on
your hosts, you can also configure the range of media access control
(MAC) addresses that the host can use to dynamically assign MAC
addresses to the virtual network adapters of virtual machines on the
host. Figure 5
shows the default range of MAC addresses used for this purpose.
Although this default range might suffice when only a few hosts are
being deployed, it’s generally a good idea to assign a different MAC
address range to each host to ensure that duplicate MAC addresses
cannot be assigned to virtual machines on different hosts, which
could cause network problems for the guest operating systems of such
virtual machines.
You can also use the Set-VMHost cmdlet to configure the range
of MAC addresses that the host can assign to virtual network
adapters of virtual machines on the host. For example, you can use
the following command to change the MAC address range on HOST4 to
span from 00-00-04-00-00-00 to 00-00-04-FF-FF-FF:
Set-VMHost -ComputerName HOST4 -MacAddressMinimum 000004000000 `
-MacAddressMaximum 000004FFFFFF
Other configuration steps
Additional steps needed for configuring your Hyper-V hosts
depend on what types of functionality you want to enable on them.
For example, by using the Hyper-V Settings dialog box, you
can:
You can also use Windows PowerShell to perform these
additional configuration steps on your hosts. For example, you can
use the Set-VMHost cmdlet to enable live migration, configure it to
use CredSSP for authentication, and configure it to allow incoming
live migrations using any available network as follows: