Hello,
My need is to reconfigure VMotion netstack with a specific route. I wrote these few lines
$esxi = Get-VMHost -Name myHost
$esxcli = $esxi | Get-EsxCli -V2
$arguments = $esxcli.network.ip.route.ipv4.add.CreateArgs()
$arguments.netstack="vmotion"
$arguments.gateway="192.168.0.1"
$arguments.network="192.168.0/24"
$esxcli.network.ip.route.ipv4.add.Invoke($arguments)
and I got this error message, it is like my route already exist :
Message: Duplicate route to network 192.168.0/24 found. Please delete the old route first.
InnerText: Duplicate route to network 192.168.0/24 found. Please delete the old route first.
EsxCLI.CLIFault.summary
At setTCPIProute.ps1:7 char:1
+ $esxcli.network.ip.route.ipv4.add.Invoke($arguments)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ViError
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViError
When I run "esxcli network ip route ipv4 list" that route is not displayed.
Any idea?
Thanks
Fred
Which vSphere and PowerCLI versions?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It could be that the same route is already generated based on the IP and netmask defined on one of the VMKernel adapter.
Check with
Get-VMHostNetworkAdapter -VMHost $esxi -VMKernel
Normally it says so when you try to do
$arguments.netstack="vmotion"
$arguments.gateway="192.168.0.1"
$arguments.network="192.168.0/24"
$esxcli.network.ip.route.ipv4.remove.Invoke($arguments)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
I am using PowerCLI 6.3 release 1; should I upgrade?
Get-VMHostNetworkAdapter -VMHost $esxi -VMKernel
indeed returns routes of each VMkernels but not the one I want to add.
Well an upgrade would be advisable, there are a number of fixes in the later releases.
Did you get the error I mentioned when you try the remove?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks Im gonna upgrade PowerCLI ASAP
here is the error message I got when trying to remove:
Message: Unable to delete route to 192.168.0/24 this route is automatically created based on the IP address and netmask of one of the VMkernel
TCP/IP interfaces
;
InnerText: Unable to delete route to 192.168.0/24 this route is automatically created based on the IP address and netmask of one of the VMkernel
TCP/IP interfaces
EsxCLI.CLIFault.summary
At setTCPIProute.ps1:10 char:1
+ $esxcli.network.ip.route.ipv4.remove.Invoke($arguments)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ViError
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViError
Yes, that's the message I mean.
I also get that with PowerCLI 10, so the upgrade will probably not fix that.
Do you have a VMKernel configured on that subnet?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
no VMkernel configured with that subnet, I even ran:
$esxcli = $esxi | Get-EsxCli -V2
$esxcli.network.ip.route.ipv4.list.Invoke()
looks like a bug is hiding somewhere :smileyconfused:
I'm starting to doubt if one can have routes through other netstacks besides "Default".
If I'm setting a default gateway on a vmkernel that has for example only vmotion, I don't see that gateway appearing in the list of routes.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Just curious, are the vmkernel adapters added to the netstack before attempting to add a gateway? There has to be at least one adapter on the other stack before a gateway can be added.
A vmk is always added to a netstack, if you don't specify one it is the Default netstack.
Not sure what you mean by "other stack"?
A vmk has a default gateway (dhcp or static), which you can override in the netstack used by that vmk.
For a netstack that has no vmk defined/attached, you can't specify a default gateway.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Last sentence was what I was getting at.
Probably misinterpreted the mention on doubt of routes on stacks other than "default".