Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Basic Hyper-V virtual NIC management

  • June 12, 2018
  • 8 min read
Boris is a Tech Support Engineer at StarWind. He is keen on virtualization and adores playing around with Java and PowerShell.
Boris is a Tech Support Engineer at StarWind. He is keen on virtualization and adores playing around with Java and PowerShell.

Introduction

Working as a StarWind Support engineer is sometimes tricky, as on certain occasions my colleagues and I have to deal with things that go far beyond supporting only the StarWind products. In many cases, it is closely connected with hypervisors, client’s software used in clustered VMs with their storage on StarWind HA disks.

Not so long ago I have come across a situation where the non-conventional use of StarWind disks has taken place, as per the client’s requirements. Instead of configuring pure Cluster Shared Volumes for the Microsoft Failover Cluster with VM’s VHDX disks on top of those CSVs, we had to introduce separate StarWind HA disks directly into the clustered VMs. To better understand the idea, below is the scheme demonstrating this approach.

Alternative scheme of StarWind VSAN setup

Connecting StarWind HA disks directly to the clustered VMs

In my test environment, I am using Windows Server 2016 that is capable of hot-adding the network interfaces to the guest VMs.

As the main thing about configuring this is proper network setup for the VMs to be able to discover the storage provided by StarWind VSAN, I will consider the networking part of the setup, particularly manipulations with the Hyper-V switches that use the physical adapters dedicated to the iSCSI traffic.

For illustration purposes I will use two ways:

  • GUI;
  • Command line.

However, I prefer the latter.

Let’s start with GUI

From GUI, we need to add an external vSwitch in Hyper-V Manager using Virtual Switch Manager as demonstrated in the screenshot below:

Creating a Hyper-V switch

When created, the new virtual switch shall be assigned a network interface:

Configuring a Hyper-V switch

Now, to PowerShell

If I do this using PowerShell, it will take me only a couple of lines of code to perform the same:

I run this on both StarWind nodes if I want the setup to have paths to the storage from both nodes.

Next step is to add the newly created switch into the VMs.

The GUI way implies going into the VM’s settings, clicking on Add Hardware, and selecting Network Adapter to be added:

Adding a NIC to a Hyper-V VM

After this is added, I select the network adapter and assign the vSwitch, to which it is going to connected.

Configurnig a NIC in Hyper-V VM settings

In PowerShell, type the following:

If you need more VMs to be processed, just list them separated with commas:

Sure thing, if you have only one VM, there won’t be any benefit of using PowerShell instead of GUI except for the reason of giving your adapter some custom name. If you compare the two network adapters in the picture below, you’ll definitely see the different names they have. The top one was created using GUI, while the bottom one was created from PowerShell.

Comparison of Nyper-V network adapters created using GUI and PowerShell

After the networking part is done on the Hyper-V hosts, the VMs should be configured to have access to replicated StarWind storage, but it is out of the scope of my today’s post.

At some certain point, anyone reading this may come across the StarWind official documentation that instructs how to configure everything properly, and thus decides to reconfigure the setup by removing the direct connection of the StarWind storage to VMs. Here’s how this should be done then:

From GUI:

In the VM settings, select the network adapter to be removed and click on the Remove button.

Deleting a NIC from a Hyper-V VM

From PowerShell, shoot the following:

Conclusion

Hope this information will be interesting for those following the path of experimenting with networking in non-conventional setups of the StarWind VSAN hyperconverged systems. As we see, Windows Server 2016 offers new possibilities for manipulating network settings for VMs in live environment, with certain features being easily done from both GUI and command line, and some options being available from command line only. Feel free to select the one you prefer and that suits your particular purpose.

Found Boris’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!