Proper Hyper-V Network Configuration for Windows Server 2012?
We just put our first Hyper-V based web solution online about a month ago (Diagram below). We're having intermittent communication issues between Virtual Machines during periods of elevated traffic, for example, during Bing/Google/Baidu/McAfee Secure/etc crawls. The issue lasts a couple minutes and it is not a full blown outage; some requests work perfectly fine while others result in errors. I've looked in the system logs on the VMs and host system but there's nothing indicating failure (other than some ASP.net ODBC errors on the Web VM because it can't reach the database host).
Our old setup with a single 8-year old Windows Server 2k3 web and database server handled all the traffic without a problem, but was limiting our new development abilities. It only had 4GB of RAM and an old 2GHz dual-core processor. Our new server has 32GB of RAM and a quad-core 3.4GHz Xeon. The hardware blows the old stuff out of the water when everything is working. Pages load faster, queries run faster, etc.
The only things I can think of are that traffic is essentially doubled-up on the adapter because the DB and Web are on seperate VMs but share the same Virtual Network, or, there may be a problem with the way our Hyper-V network is configured.
There is a single shared Virtual Switch set up as External. We use a hardware firewall to block ports to the outside world. I've included screenshots of the Network Adapters and current Virtual Switch setup.
I'm not sure which properties should be enabled/disabled on the Host and VMs. The machine has 2 nics, but everything is currently set up on one port. It's been recommended to use one port for admin and the other for the virtual switch, which I'm sure would increase performance when we log into the boxes, but I'm not sure that fixes the current issue.
Can anyone provide guidance on what the Nic properties should be on the host and VMs, or guide me to tweaks to boost network performance?
Solution 1:
In addition to the answer from Bartłomiej, I would also recommend changing the Team load balancing mode to Hyper-V port and set both adapters in the team to active:
This way you utilize both adapters in the team actively.
Solution 2:
I would suggest setup all Hyper-V host networking from powershell not from GUI. The GUI does not give as much control as You would like to.
- clear all the VMswitches / VMAdapters You created. The physical network adapters should be the only one visible in ipconfig on the Hyper-V host (except the tunnel somehting adapters).
- rename You physical adapters to for example "Gi1" and "Gi2" (it will look more clear later what is what)
- check card name - it may be something like "Ethernet 2": Get-NetAdapter
- rename it: Rename-NetAdapter "Old name1" "Gi1"
- rename the second one: Rename-NetAdapter "Old name2" "Gi2"
-
create a switch independent team and check it
- New-NetLbfoTeam -Name Team1 -TeamMembers Gi1,Gi2
- check it - defaults should set a switchindependent Team.
PS C:\> Get-NetLbfoTeam Team1 Name : Team1 Members : {Gi2, Gi1} TeamNics : Team1 TeamingMode : SwitchIndependent LoadBalancingAlgorithm : TransportPorts Status : Up
- You should no longer see Gi1,Gi2 in ipconfig - just Team1 as an IP interface.
- create a VMswitch with Team1 connected to it.
- New-VMSwitch -Name VMSwitch1 -NetAdapterName Team1
- after that step check ipconfig. You should no longer see Team1 but VMswitch1 as IP interface of the Hyper-V host.
- create a virtual network adapter for management and connect it to the Vmswitch1
- Add-VMNetworkAdapter -ManagementOS -VMNetworkAdapterName management -SwitchName VMswitch1
- You should see now in ipconfig "Ethernet adapter vEthernet (management): ..."
- connect Your Virtual machines network adapters to VMSwitch1. This can be done from GUI.
- Final effect is clear:
- More Tweaks - But You should probably leave everything on default:
- have a look at Get-NetAdapterAdvancedProperty
- Or maybe it is not a network problem with performance ?
- what are your VHD / VHDX type used for the database ? Dynamic ? Fixed ?
- integration tools installed / fully updated ?