VMware Cloud Community
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Create VMK with vSphere Replication Enabled

Hi all,

As I was creating vmk’s i found that I could enable vsan traffic, vmotion and management traffic but nothing there for vSphere replication and NFC, any ideas on how I might be able to do this with powercli?

Nicholas
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

$esxName = 'MyEsx'

$vssName = 'MyVSS'

$pgName = 'MyPG'

$ipAddr = '192.168.1.1'

$ipMask = '255.255.255.0'

$esx = Get-VMHost -Name $esxName

$vmk = New-VMHostNetworkAdapter -VMHost $esx -PortGroup $pgName -IP $ipAddr -SubnetMask $ipMask -VirtualSwitch $vssName

$vnicMgr = Get-View -Id $esx.ExtensionData.ConfigManager.VirtualNicManager

$vnicMgr.SelectVnicForNicType('vSphereReplication',$vmk.Name)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

$esxName = 'MyEsx'

$vssName = 'MyVSS'

$pgName = 'MyPG'

$ipAddr = '192.168.1.1'

$ipMask = '255.255.255.0'

$esx = Get-VMHost -Name $esxName

$vmk = New-VMHostNetworkAdapter -VMHost $esx -PortGroup $pgName -IP $ipAddr -SubnetMask $ipMask -VirtualSwitch $vssName

$vnicMgr = Get-View -Id $esx.ExtensionData.ConfigManager.VirtualNicManager

$vnicMgr.SelectVnicForNicType('vSphereReplication',$vmk.Name)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Thanks Luc,

million dolllar question.. can we do this on a DVS?

Nicholas
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, use the name of a VDS switch where there is $vssName, and use a portgroup on that VDS switch.

Code stays the same


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
coolsung
Contributor
Contributor
Jump to solution

Dear LucD

I want to setup Replication and NFC together on the same vmk.

Thank you.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Provided MultiSelectAllowed is $true (which is the default), you just need to another call.

Like this

$esxName = 'MyEsx'

$vssName = 'MyVSS'

$pgName = 'MyPG'

$ipAddr = '192.168.1.1'

$ipMask = '255.255.255.0'

$esx = Get-VMHost -Name $esxName

$vmk = New-VMHostNetworkAdapter -VMHost $esx -PortGroup $pgName -IP $ipAddr -SubnetMask $ipMask -VirtualSwitch $vssName

$vnicMgr = Get-View -Id $esx.ExtensionData.ConfigManager.VirtualNicManager

$vnicMgr.SelectVnicForNicType('vSphereReplication',$vmk.Name)

$vnicMgr.SelectVnicForNicType('vSphereReplicationNFC',$vmk.Name)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos