{"id":12609,"date":"2012-05-31T09:00:00","date_gmt":"2012-05-31T08:00:00","guid":{"rendered":"https:\/\/aidanfinn.com\/?p=12609"},"modified":"2012-05-31T09:00:00","modified_gmt":"2012-05-31T08:00:00","slug":"powershell-script-to-create-a-windows-server-2012-converged-fabric","status":"publish","type":"post","link":"https:\/\/aidanfinn.com\/?p=12609","title":{"rendered":"PowerShell Script To Create A Converged Fabric For Clustered Windows Server 2012 Hyper-V Host"},"content":{"rendered":"<p><em>Note: This post was originally written using the Windows Server &#8220;8&#8221; (aka 2012) Beta.\u00a0 The PowerShell cmdlets have changed in the Release Candidate and this code has been corrected to suit it.<\/em><\/p>\n<p>After the posts of the last few weeks, I thought I\u2019d share a script that I am using to build a converged fabric hosts in the lab.\u00a0 Some notes:<\/p>\n<ol>\n<li>You have installed Windows Server 2012 on the machine.<\/li>\n<li>You are either on the console or using something like iLO\/DRAC to get KVM access.<\/li>\n<li>All NICs on the host will be used for the converged fabric.\u00a0 You can tweak this.<\/li>\n<li>This will not create a virtual NIC in the management OS (parent partition or host OS).<\/li>\n<li>You will make a different copy of the script for each host in the cluster to change the IPs.<\/li>\n<li>You could strip out all but the Host-Parent NIC to create converged fabric for standalone host with 2 or 4 * 1 GbE NICs<\/li>\n<\/ol>\n<p>And finally \u2026. MSFT has not published best practices yet.\u00a0 This is still a beta release.\u00a0 Please verify that you are following best practices before you use this script.<\/p>\n<p>OK\u2026. here we go.\u00a0 Watch out for the line breaks if you copy &amp; paste:<\/p>\n<p>write-host &#8220;Creating virtual switch with QoS enabled&#8221;<br \/>\nNew-VMSwitch &#8220;ConvergedNetSwitch&#8221; -MinimumBandwidthMode weight -NetAdapterName &#8220;ConvergedNetTeam&#8221; -AllowManagementOS 0<\/p>\n<p>write-host &#8220;Setting default QoS policy&#8221;<br \/>\nSet-VMSwitch &#8220;ConvergedNetSwitch&#8221; -DefaultFlowMinimumBandwidthWeight 10<\/p>\n<p>write-host &#8220;Creating virtual NICs for the management OS&#8221;<br \/>\nAdd-VMNetworkAdapter -ManagementOS -Name &#8220;Host-Parent&#8221; -SwitchName &#8220;ConvergedNetSwitch&#8221;<br \/>\nSet-VMNetworkAdapter -ManagementOS -Name &#8220;Host-Parent&#8221; -MinimumBandwidthWeight 10<\/p>\n<p>Add-VMNetworkAdapter -ManagementOS -Name &#8220;Host-Cluster&#8221; -SwitchName &#8220;ConvergedNetSwitch&#8221;<br \/>\nSet-VMNetworkAdapter -ManagementOS -Name &#8220;Host-Cluster&#8221; -MinimumBandwidthWeight 10<\/p>\n<p>Add-VMNetworkAdapter -ManagementOS -Name &#8220;Host-LiveMigration&#8221; -SwitchName &#8220;ConvergedNetSwitch&#8221;<br \/>\nSet-VMNetworkAdapter -ManagementOS -Name &#8220;Host-LiveMigration&#8221; -MinimumBandwidthWeight 10<\/p>\n<p>Add-VMNetworkAdapter -ManagementOS -Name &#8220;Host-iSCSI1&#8221; -SwitchName &#8220;ConvergedNetSwitch&#8221;<br \/>\nSet-VMNetworkAdapter -ManagementOS -Name &#8220;Host-iSCSI1&#8221; -MinimumBandwidthWeight 10<\/p>\n<p>#Add-VMNetworkAdapter -ManagementOS -Name &#8220;Host-iSCSI2&#8221; -SwitchName &#8220;ConvergedNetSwitch&#8221;<br \/>\n#Set-VMNetworkAdapter -ManagementOS -Name &#8220;Host-iSCSI2&#8221; -MinimumBandwidthWeight 15<\/p>\n<p>write-host &#8220;Waiting 30 seconds for virtual devices to initialise&#8221;<br \/>\nStart-Sleep -s 30<\/p>\n<p>write-host &#8220;Configuring IPv4 addresses for the management OS virtual NICs&#8221;<br \/>\nNew-NetIPAddress -InterfaceAlias &#8220;vEthernet (Host-Parent)&#8221; -IPAddress 192.168.1.51 -PrefixLength 24 -DefaultGateway 192.168.1.1<br \/>\nSet-DnsClientServerAddress -InterfaceAlias &#8220;vEthernet (Host-Parent)&#8221; -ServerAddresses &#8220;192.168.1.40&#8221;<\/p>\n<p>New-NetIPAddress -InterfaceAlias &#8220;vEthernet (Host-Cluster)&#8221; -IPAddress 172.16.1.1 -PrefixLength &#8220;24&#8221;<\/p>\n<p>New-NetIPAddress -InterfaceAlias &#8220;vEthernet (Host-LiveMigration)&#8221; -IPAddress 172.16.2.1 -PrefixLength &#8220;24&#8221;<\/p>\n<p>New-NetIPAddress -InterfaceAlias &#8220;vEthernet (Host-iSCSI1)&#8221; -IPAddress 10.0.1.55 -PrefixLength &#8220;24&#8221;<\/p>\n<p>#New-NetIPAddress -InterfaceAlias &#8220;vEthernet (Host-iSCSI2)&#8221; -IPAddress 10.0.1.56 -PrefixLength &#8220;24&#8221;<\/p>\n<p>That will set up the following architecture:<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/05\/image14.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/05\/image_thumb13.png\" border=\"0\" alt=\"image\" width=\"404\" height=\"442\" \/><\/a><\/p>\n<p>QoS is set up as follows:<\/p>\n<ul>\n<li>The default (unspecified links) is 10% minimum<\/li>\n<li>Parent: 10%<\/li>\n<li>Cluster: 10%<\/li>\n<li>Live Migration: 20%<\/li>\n<\/ul>\n<p>My lab has a single VLAN network.\u00a0 In production, you should have VLANs and trunk the physical switch ports.\u00a0 Then (I believe), you\u2019ll need to add a line for each virtual NIC in the management OS (host) to specify the right VLAN (I&#8217;ve not tested this line yet on the RC release of WS2012 &#8211; watch out for teh VMNetowrkAdaptername parameter):<\/p>\n<p>Set-VMNetworkAdapterVLAN \u2013ManagementOS \u2013VMNetworkAdapterName &#8220;vEthernet (Host-Parent)&#8221; \u2013Trunk \u2013AllowedVLANList 101<\/p>\n<p>Now you have all the cluster connections you need, with NIC teaming, using maybe 2 * 10 GbE, 4 * 1 GbE, or maybe even 4 * 10 GbE if you\u2019re lucky.<\/p>\n<div id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a50b3ba5-f43f-4bb6-ba4a-fc0257b6b949\" class=\"wlWriterEditableSmartContent\" style=\"margin: 0px; display: inline; float: none; padding: 0px;\">Technorati Tags: <a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/PowerShell\">PowerShell<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Windows+Server+2012\">Windows Server 2012<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Hyper-V\">Hyper-V<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Virtualisation\">Virtualisation<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Networking\">Networking<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Note: This post was originally written using the Windows Server &#8220;8&#8221; (aka 2012) Beta.\u00a0 The PowerShell cmdlets have changed in the Release Candidate and this code has been corrected to suit it. After the posts of the last few weeks, I thought I\u2019d share a script that I am using to build a converged fabric &hellip; <a href=\"https:\/\/aidanfinn.com\/?p=12609\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;PowerShell Script To Create A Converged Fabric For Clustered Windows Server 2012 Hyper-V Host&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[20],"tags":[181,80,87,195,118],"class_list":["post-12609","post","type-post","status-publish","format-standard","hentry","category-hyper-v","tag-hyper-v","tag-networking","tag-powershell","tag-virtualisation","tag-windows-server-2012"],"aioseo_notices":[],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/12609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12609"}],"version-history":[{"count":0,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/12609\/revisions"}],"wp:attachment":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}