Hi luc,
good morning .
there is a requirement of
1:creating two distributed port groups
2:and two vmkernel adapters (for vmotion and replication) per esxi in three node cluster.
i thought of doing as below .could you modify orange code so that we can iterate over ips of vmotion and replication .
function create-vmkernelport
{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
[string]$clustername,
[Parameter(Mandatory=$true)]
[string]$distributedswitch,
[Parameter(Mandatory=$true)]
[string]$vlanvmotion,
[Parameter(Mandatory=$true)]
[string]$vlanreplication,
[Parameter(Mandatory=$true)]
[string]$subnetmask
)
$cluster=Get-Cluster $clustername
$vmhosts=get-vmhost -Location $cluster
$ipvmotion = "172.16.8.21","172.16.8.22","172.16.8.23"
$ipreplication = "172.16.9.21","172.16.9.22","172.16.9.21"
$vmotion=New-VDPortgroup -name "vmotion_112" -VDSwitch $distributedswitch -VlanId 112 -PortBinding Static -NumPorts 8
$replication=New-VDPortgroup -name "replication_113" -VDSwitch $distributedswitch -VlanId 113 -PortBinding Static -NumPorts 8
foreach($vmhost in $vmhosts)
{
New-VMHostNetworkAdapter -VMHost $vmhost -PortGroup $vmotion
-VirtualSwitch $distributedswitch -IP $ipvmotion[$i] -SubnetMask $subnetmask
New-VMHostNetworkAdapter -VMHost $vmhost -PortGroup $replication
-VirtualSwitch $distributedswitch -IP $ipreplication [$i] -SubnetMask $subnetmask
}
}
You have to use the resulting object from Get-VMHostNetwork on the Network parameter, not a string.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
if i do like below
it will change vmkernel gateway for the entire tcp/ip stack .
since i m not able to create individual tcp/ipstack for vmtion and replication it might cause problem.
Why can't you create a new TCPIP stack?
Is that a policy you have to follow?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
well i followed the code from one your similar post (as suggested by you).
it thows error to check vmkernellogs.
also from vmware docs we can create only one default stack which is already there .it says we need to add static routes if we want traffic segregation for vmotion and replication.
If you want to go with routes, you can use the New-VMHostRoute cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
i think i can start a new thred for this .