VMware Cloud Community
jacktu
VMware Employee
VMware Employee
Jump to solution

How to set the gateway for a specified vmk device via PowerCLI

Hi Gurus,

How to set the gateway for a specified vmk device via PowerCLI?

Like the following location in the picture.

vmk gateway.jpg

I tried with the following command line

get-cluster -name $clustername | Get-VMHost | Get-VMHostNetwork | Set-VMHostNetwork -VMkernelGateway '10.181.129.1' -VMkernelGatewayDevice 'vmk2'

But failed with error

Set-VMHostNetwork : 2020/4/9 17:57:51Set-VMHostNetwork  An error occurred during host configuration. Operation failed, diagnostics report: Unable to set VMkernel gateway address to 10.181.129.1 as there are no VMkernel interfaces on the same network with that IP address.

+ Get-Cluster -Name $clustername | Get-VMHost | Get-VMHostNetwork | Set-V ...

+                                                                      ~~~~~
+ CategoryInfo    : NotSpecified: (:) [Set-VMHostNetwork], PlatformConfigFault
+ FullyQualifiedErrorId : Client20_VirtualNetworkServiceImpl_UpdateIpRouteConfig_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.SetVMHostNetwork

Appriciate if any help.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

This is a known issue, see KB1002662

On which subnets do you have VMKernels defined?

$clustername = 'cluster'

Get-Cluster -name $clustername |

Get-VMHost |

Get-VMHostNetworkAdapter -VMKernel


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

This is a known issue, see KB1002662

On which subnets do you have VMKernels defined?

$clustername = 'cluster'

Get-Cluster -name $clustername |

Get-VMHost |

Get-VMHostNetworkAdapter -VMKernel


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

Reply
0 Kudos
jacktu
VMware Employee
VMware Employee
Jump to solution

Thanks,LucD

Reply
0 Kudos