Virtual networks with Hyper-V in Windows Server 2016

Network in a Box

Creating and Configuring Virtual Switches

You create virtual switches on Windows Server 2016 that are generally similar to those in Windows Server  2012 R2. In large environments, you create and manage virtual switches with System Center Virtual Machine Manager 2016 and Network Controller. In medium-sized and small environments, you would work with Hyper-V Manager and PowerShell. In Hyper-V Manager, start by opening the Virtual Switch Manager . Select New virtual network switch to create a virtual switch for the physical network cards in a computer, select the switch type (External , Internal , Private ), and then press the button labeled Create Virtual Switch . In the window, select the physical network adapter that you want to assign to the virtual switch and define what kind of network to assign to the switch:

  • External network : An external network allows the virtual machines to communicate with the entire network and supports communication between virtual machines on the host. In the Hyper-V Manager, you can only create one external network for each available physical network adapter, but multiple virtual machines can share this external network.
  • Internal network : These networks allow communication of virtual machines among themselves on the physical host. The computers cannot communicate with the network, except with the Hyper-V host and other virtual machines on the Hyper-V host. No network card is required for this connection because the connection is virtualized.
  • Private network : These networks allow communication between virtual machines on the host. Communication with the host itself is not possible with this type of network.

If you installed multiple NICs in the Hyper-V host, you can create multiple virtual switches on the basis of these cards. For the virtual switches, you can enable NIC teaming and then, on the virtual servers, create NIC teams; that is, you can connect multiple virtual NICs from different virtual switches. For this configuration to work, you first need to enable the NIC teaming feature on the virtual network cards.

Virtual Switches and PowerShell

You can create and manage virtual switches in PowerShell. The corresponding cmdlets are displayed with:

get-command *vmswitch*

In addition to the switches, you can manage the virtual network adapters in PowerShell. The commands for managing adapters are displayed when you type:

get-command *vmnetworkadapter*

PowerShell displays information on virtual switches when you type Get-VMSwitch. Display the virtual network card settings with:

Get-VMNetworkAdapter -VMName <name of the virtual server> |fl

With this cmdlet, you also see the MAC address and IP address of the virtual server on the Hyper-V host. The command

Get-VM -computername Hyper-V-Host | foreach{(Get-VMNetworkAdapter $_).IPAddresses}

lets you read the IP addresses of the virtual servers on a local Hyper-V host, as well as hosts on the network. You can customize and extend the command to meet your needs.

Virtual Network Cards

When you assign the new virtual network adapters to virtual servers, you can select the virtual switch to which you want to link the cards (Figure  4). You can change this setting at any time, also on the fly. The hardware acceleration features under the settings for the virtual Network Adapter , are also very interesting. In the Hardware Acceleration menu, you can choose to allow the virtual machines to pass on data to the physical network adapter.

Figure 4: You can create virtual switches through Hyper-V Manager in Windows Server 2016.

In the Advanced Features , you will find two settings named DHCP guard and Router guard . These settings are designed to prevent the virtual server from acting as a rogue DHCP server or router. You can also define whether the virtual network card can be configured as a member of a NIC team. Moreover, you can enable port mirroring of virtual servers. Port mirroring allows forwarding of network packets to other virtual servers responsible for monitoring the various virtual servers on the host.

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Protect Hyper-V with on-board resources
    With the right settings and small tools, security in virtual environments can be increased significantly by tweaking the on-board tools.
  • Hyper-V 3.0 in Windows Server 2012

    In the old Hyper-V hypervisor from Microsoft, many features for professional use were missing. The new version 3.0 has been significantly improved and is slowly catching up to VMware.

  • Software-defined networking with Windows Server 2016
    Windows Server 2016 takes a big step toward software-defined networking, with the Network Controller server role handling the centralized management, monitoring, and configuration of network devices and virtual networks. This service can also be controlled with PowerShell and is particularly interesting for Hyper-V infrastructures.
  • Hyper-V containers with Windows Server 2016
    The release of Windows Server 2016 also heralds a new version of Hyper-V, with improved cloud security, flexible virtual hardware, rolling upgrades of Hyper-V clusters, and production checkpoints.
  • Highly available Hyper-V in Windows Server 2016
    Microsoft has extended the failover options for Hyper-V in Windows Server 2016 to include two new cluster modes, as well as the ability to define an Azure Cloud Witness server. We look at how to set up a Hyper-V failover cluster.
comments powered by Disqus