Reply to Message

View discussion in a popup

Replying to:
cliffcahill
Enthusiast
Enthusiast

Hi tjurgens

Thanks for the reply - I have no issue creating vMotion on the any vSphere version that is Pre 6.0.

Issue only arises when i need to create and new TCP/IP stack and assign that stack to the vMotion VMK - This is to allow for L3 vMotion

Attached is sample of what i used to create vMotion VMk currently on anything pre vSphere6.0

##########################################################

# Add vMotion VMkernel port for all servers in a cluster

#

##########################################################

#

# VERSION - 1.2

#

param(  

  [Parameter(Mandatory=$true)]$vcenter,

  $Subnet = "255.255.255.0",

  $vMotionVLAN = "25",

  $vMotionName = "Vmotion",

  $vmotion_ip_start = "192.168.25.100",

  $VMhost ="*",

  $clusterName = '*'

)

##########################################################   

$server = connect-viserver $vcenter

# Start Creating vMotion Network #############################

$vmotion_ip_start_int=$vmotion_ip_start.split('.')

$vmotion_ip_start_int=[int]$vmotion_ip_start_int[3]

Write-Host -ForegroundColor Yellow "Start Creating vMotion Network".ToUpper()

ForEach ($VMhostname in ($cluster | Get-VMHost -name $VMhost)| sort)

{

  if ($VMhostname | Get-VMHostNetworkAdapter -VMKernel | where {$_.PortGroupName -match $vMotionName}) {

  Write-host -ForegroundColor yellow "WARNING : $VMhostname already has a VMkernel port named $vMotionName - Skipping"

  }

  else {

  write-host -ForegroundColor green "Creating vMotion port group for $VMhostname"

  $netIP = $vmotion_ip_start.split('.')

  $IP = $netIP[0] + '.' + $netIP[1] + '.' + $netIP[2] + '.' + $vmotion_ip_start_int

  $null = New-VMHostNetworkAdapter -VMHost $VMhostname -PortGroup $vMotionName -VirtualSwitch $(Get-VirtualSwitch -VMHost $VMhostname) -IP $IP -SubnetMask $Subnet -VMotionEnabled $true

  $null = Get-VirtualPortGroup -Name $vMotionName -VMHost $VMhostname | Set-VirtualPortGroup -VLanId $vMotionVLAN

  $vmotion_ip_start_int = $vmotion_ip_start_int +1

  }

  }

  Write-Host -ForegroundColor Green "End Creating vMotion Network".ToUpper()

 

# End Creating vMotion Network ###############################

Reply
0 Kudos