<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>multi-nic Archives - LucD notes</title>
	<atom:link href="https://www.lucd.info/category/vsphere/vmotion/multi-nic/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/category/vsphere/vmotion/multi-nic/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Wed, 08 Apr 2020 11:03:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.lucd.info/wp-content/uploads/2018/12/cropped-120px-Tibetan_Dharmacakra-32x32.png</url>
	<title>multi-nic Archives - LucD notes</title>
	<link>https://www.lucd.info/category/vsphere/vmotion/multi-nic/</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>vSphere 5 Top 10 &#8211; vMotion</title>
		<link>https://www.lucd.info/2011/12/15/vsphere-5-top-10-vmotion/</link>
					<comments>https://www.lucd.info/2011/12/15/vsphere-5-top-10-vmotion/#respond</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Wed, 14 Dec 2011 23:12:36 +0000</pubDate>
				<category><![CDATA[2011]]></category>
		<category><![CDATA[Dutch]]></category>
		<category><![CDATA[multi-nic]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[vMotion]]></category>
		<category><![CDATA[VMUG]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=3734</guid>

					<description><![CDATA[Another post coming from our Dutch VMUG Event 2011 presentation. On position number [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Another post coming from our <a href="https://vmug.nl/cms/index.php?option=com_content&amp;view=section&amp;layout=blog&amp;id=5&amp;Itemid=55" target="_blank" rel="noopener noreferrer">Dutch VMUG Event 2011 presentation</a>. On position number <strong>10</strong>, we find the <strong>vMotion Enhancements</strong> that were introduced with <strong>vSphere 5</strong>.</p>
<p>A single vMotion can now<strong> scale</strong> over multiple NICs. This feature can use a <strong>regular vSwitch</strong> or <strong>distributed vSwitch</strong>.On YouTube there are 2 videos, uploaded by <a href="https://www.youtube.com/user/VMwareKB" target="_blank" rel="noopener noreferrer">VMwareKB</a>, that show how to configure such a vMotion enabled multi-NIC vSwitch, regular and distributed.</p>
<p>Very useful videos, but as you can imagine, I wanted to automate this. No GUI clicking for me  <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><span id="more-3734"></span></p>
<h2>The script</h2>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function Set-vMotionMultiNic{
&lt;#
.SYNOPSIS  Configure multi-NIC vMotion
.DESCRIPTION The function will configure multi-NIC vMotion
  enabled portgroups on a regular vSwitch 
.NOTES  Author:  Luc Dekens
.PARAMETER VMHost
  The ESXi host where the vMotion enabled portgroups shall be
  configured.
  The parameter accepts a string or the object returned by the
  Get-VMHost cmdlet.
.PARAMETER VirtualSwitch
  The virtual switch on which the vMotion enabled portgroups
  shall be configured.
  The parameter accepts a string or the object returned by the
  Get-VirtualSwitch cmdlet.
.PARAMETER pNic
  An array with the vnics that shall be used to configure the
  portgroups. Depending on the number of provided vnics, the
  function will create the optimal number of portgroups.
  The arrays on pNic, IPaddress and SubnetMask shall have the
  same number of elements.
.PARAMETER IpAddress
  An array with the IP addresses that shall be used on the
  portgroups
.PARAMETER SubnetMask
  An array with the subnetmasks.
.EXAMPLE
  PS&gt; Set-vMotionMultiNic -VMHost MyESX -VSwitch MyvSw `
  PS&gt;&gt;   -pNic &quot;vmnic2&quot;,&quot;vmnic3&quot;,&quot;vmnic4&quot; `
  PS&gt;&gt;   -IpAddress &quot;192.168.1.1&quot;,&quot;192.168.1.2&quot;,&quot;192.168.1.3&quot; `
  PS&gt;&gt;   -SubnetMask (,&quot;255.255.255.0&quot; * 3)
#&gt;
  param(
    [psobject]$VMHost,
    [psobject]$VirtualSwitch,
    [string[]]$pNic,
    [string[]]$IpAddress,
    [string[]]$SubnetMask
  )56
  
  if($VMHost.getType().Name -eq &quot;string&quot;){
    $VMHost = Get-VMHost -Name $VMHost
  }
  if($VMHost.ApiVersion.Split('.')[0] -lt 5){
    Write-Warning &quot;MultiNic for vMotion requires at least ESXi 5.0&quot;
    exit
  }

  if($VirtualSwitch.getType().Name -eq &quot;string&quot;){
    $VirtualSwitch = $VMHost | Get-VirtualSwitch -Name $VirtualSwitch
  }
  $indices = 0..($pNic.Count - 1)
  foreach($i in $indices){
    $pg = New-VirtualPortGroup -Name (&quot;vMotion-{0:d2}&quot; -f ($i + 1)) -VirtualSwitch $VirtualSwitch
    New-VMHostNetworkAdapter -VMHost $VMHost -VirtualSwitch $VirtualSwitch -PortGroup $pg -IP $IpAddress[$i] -SubnetMask $SubnetMask[$i] -VMotionEnabled:$true | Out-Null
    Get-NicTeamingPolicy -VirtualPortGroup $pg | 
    Set-NicTeamingPolicy -MakeNicActive $pNic[$i] -MakeNicStandby $pNic[($indices | where {$_ -ne $i})] |Out-Null
  }
}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 42-44</strong>: A simple Object By Name (OBN) implementation for the ESXi host</p>
<p><strong>Line 45-48</strong>: A check if we are configuring this for at least a vSphere 5 server</p>
<p><strong>Line 50-52</strong>: A simple Object By Name (OBN) implementation for the regular vSwitch</p>
<p><strong>Line 53</strong>: When the function is called with &#8216;n&#8217; vnics, it will have to create &#8216;n&#8217; portgroups. This calculation creates the list of suffixes that will be used on the portgroup names.</p>
<p><strong>Line 55</strong>: The creation of the portgroup. Note how the function adds a 2 digit suffix with the -format operator to the basename (&#8216;vMotion&#8217;)</p>
<p><strong>Line 56</strong>: Set the IP address and subnetmask</p>
<p><strong>Line 57-58</strong>: The Teaming is configured in the same way the VMwareKB video demonstrates.</p>
<h2>Sample use</h2>
<p>To demonstrate the function, I will use a simple configuration. We have 1 regular vSwitch that has 3 vnics connected to it.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/vMotion-vsw-before.png"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-3740" title="vMotion-vsw-before" src="https://lucd.info/wp-content/uploads/2011/12/vMotion-vsw-before.png" alt="" width="476" height="172" srcset="https://www.lucd.info/wp-content/uploads/2011/12/vMotion-vsw-before.png 476w, https://www.lucd.info/wp-content/uploads/2011/12/vMotion-vsw-before-300x108.png 300w" sizes="(max-width: 476px) 100vw, 476px" /></a></p>
<p>We call the function</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$IP = &quot;192.168.0.210&quot;,&quot;192.168.0.211&quot;,&quot;192.168.0.212&quot;
$MASK = &quot;255.255.255.0&quot;,&quot;255.255.255.0&quot;,&quot;255.255.255.0&quot;
$NIC = &quot;vmnic1&quot;,&quot;vmnic2&quot;,&quot;vmnic3&quot;

Set-vMotionMultiNic -VMHost 192.168.0.107 -VirtualSwitch vSwitch1 -pNic $NIC -IPAddress $IP -SubnetMask $MASK</pre><p></p>
<p>The function creates the vMotion portgroups (in the same way as the VMwareKB video shows).</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/vMotion-vsw-after.png"><img decoding="async" class="alignnone size-full wp-image-3742" title="vMotion-vsw-after" src="https://lucd.info/wp-content/uploads/2011/12/vMotion-vsw-after.png" alt="" width="587" height="222" srcset="https://www.lucd.info/wp-content/uploads/2011/12/vMotion-vsw-after.png 587w, https://www.lucd.info/wp-content/uploads/2011/12/vMotion-vsw-after-300x113.png 300w" sizes="(max-width: 587px) 100vw, 587px" /></a></p>
<p>And each of these vMotion enabled portgroups is configured similar to the method shown in the video.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/vMotion-vsw-detail.png"><img decoding="async" class="alignnone size-full wp-image-3743" title="vMotion-vsw-detail" src="https://lucd.info/wp-content/uploads/2011/12/vMotion-vsw-detail.png" alt="" width="254" height="439" srcset="https://www.lucd.info/wp-content/uploads/2011/12/vMotion-vsw-detail.png 423w, https://www.lucd.info/wp-content/uploads/2011/12/vMotion-vsw-detail-173x300.png 173w" sizes="(max-width: 254px) 100vw, 254px" /></a></p>
<p>In a following post I will show how this can be done for a dvSwitch.</p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2011/12/15/vsphere-5-top-10-vmotion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
