Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 226966

Configure default gateway on vmotion TCP/IP stack

$
0
0

Hoping this one is easy. I'm trying this, from one of LucD's scripts I found:

 

    $stackName = 'vmotion'

    $ipGateway = '192.168.0.1'

    $ipDevice = 'vmk2'

        

    $esx = Get-VMHost -Name $VMHost

    $netSys = Get-View -Id $esx.ExtensionData.ConfigManager.NetworkSystem

    $stack = $esx.ExtensionData.Config.Network.NetStackInstance | where{$_.Key -eq 'vmotion'}

    

   

    $config = New-Object VMware.Vim.HostNetworkConfig

    $spec = New-Object VMware.Vim.HostNetworkConfigNetStackSpec

    $spec.Operation = [VMware.Vim.ConfigSpecOperation]::edit

    $spec.NetStackInstance = $stack

    $spec.NetStackInstance.RouteTableConfig = New-Object VMware.Vim.HostIpRouteTableConfig

    $route = New-Object VMware.vim.HostIpRouteConfig

    $route.defaultGateway = $ipGateway

    $route.gatewayDevice = $ipDevice

    $spec.NetStackInstance.ipRouteConfig = $route

    $config.NetStackSpec += $spec

    $netsys.UpdateNetworkConfig($config,[VMware.Vim.HostConfigChangeMode]::modify)

 

Getting this error:

 

Exception calling "UpdateNetworkConfig" with "2" argument(s): "A specified parameter was not correct:

Vim.Host.IpRouteConfig.DefaultGateway"

 

+     $netsys.UpdateNetworkConfig($config,[VMware.Vim.HostConfigChangeM ...

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : VimException

 

 

vmk2 is already created and moved to a VDS, with the IP configured and vMotion tcp/ip stack selected. All I'm trying to do is stuff the default gateway into the vMotion tcp/ip stack.  Any ideas?


Viewing all articles
Browse latest Browse all 226966

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>