Friday, September 12, 2014

Virtual NIC's in Hyper-V and how I've been doing it wrong!

My server hardware hasn’t changed

4 x 1GB NIC's on a Quad adapter

2 x 10GB NIC's on a Dual adapter

If you've seen my previous posts you'll see that I created teams in Server Manager
Across from NIC Teaming if you haven’t created a Team this option is marked as Disabled

 Click on Tasks and create a virtual Switch


Select the NIC’s you want to add to the Team, In the above example you can see I left the Additional properties as default

I left the default options under additional properties.

The next step is what I’ve been doing incorrectly for some time, thankfully I got some great advice 
from some friends and I suggest you read his blog.
Credit for script: Aidan Finn - http://www.aidanfinn.com/?p=12609

My network is slightly different so my script is different although I used Aidan’s as a template. 
I have added some additions from Technet article - http://technet.microsoft.com/en-us/library/dn550728.aspx

Storage – Switch and vNIC (283)

Do not put a Virtual Switch on top of the Storage network
Create team and assign vLAN from Windows teaming

**********************

Production Switch and 3 x vNIC’s, MGMT(101), Live Migration (2828) and VMNetwork (102)

New-VMSwitch “ProductionNetSwitch” -NetAdapterName “Production” -AllowManagementOS 0

Add-VMNetworkAdapter -ManagementOS -Name “MGMT” -SwitchName “ProductionNetSwitch”
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "MGMT" -Access -Vlanid 101

Add-VMNetworkAdapter -ManagementOS -Name “VMNetwork” -SwitchName “ProductionNetSwitch”
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VMNetwork" -Access -Vlanid 102

Add-VMNetworkAdapter -ManagementOS -Name “LiveMigration” -SwitchName “ProductionNetSwitch”
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "LiveMigration" -Access -Vlanid 2828


What will I end up with??

This script will give you a virtual switch
ProductionNetSwitch

Then it will give you 4 x vNIC's total
Storage on VLAN 283
VMNetwork 102
MGMT 101
Live Migration 2828

What does that look like in real life?