hey,
I am using vsphere 6.5u3 enterprise plus.
I need to add additional vmkernel adapter to 100+ hosts for vsphere replication traffic. The additional vmkernel adapter will be in a dedicated L3 subnet.
I want to use powercli/api to achieve this. So far I was able to create vmkernel and enable vsphere replication traffic using PS, but i am struggling to override default gateway on vmk.
I've researched this and it seems that nobody provided the solution to this yet. All solutions were based on changing default gateway for default tcp/ip stack, or creating new tcp/ip stack.
I came across a potential method, but i don't know how to proceed further. Any help would be appreciated!
$esx=get-vmhost$hostname
$vmk=$esx.ExtensionData.Config.Network.Vnic |wheredevice-eq"vmk2"
$vmk.Spec.IpRouteSpec.IpRouteConfig.DefaultGateway # this seems to be the setting to modify, but how?
$gw=New-Objectvmware.vim.HostVirtualNicIpRouteSpec
$gw.IpRouteConfig.DefaultGateway = "X.X.X.X" # error: The property 'DefaultGateway' cannot be found on this object. Verify that the property exists and can be set.
?
reference: