PowerCLI

 View Only
  • 1.  Setting a default gateway on a specific VMK

    Posted Jul 09, 2021 10:47 AM

    I have a powercli script to configure additional VMK's during a host build and I need to configure the vMo network with it's own default gateway but I am struggling to find a method that sets just the default gateway on a specific VMK. Can anyone provide any assistance please.



  • 2.  RE: Setting a default gateway on a specific VMK

    Posted Jul 09, 2021 11:22 AM

    Do you happen to have multiple VMK on the same network stack?
    There is only 1 default gateway per stack afaik



  • 3.  RE: Setting a default gateway on a specific VMK

    Posted Jul 09, 2021 11:26 AM

    Online research seems to suggest the same, only 1 DG per stack. However if I edit the VMK and choose the "Override default gateway for this adapter" option I can manually set an alternate IP address for that VMK and it all works fine. I would just like to try and script this instead of having to remember to add it manually each time.

    Surely there must be a way to set a DG on a specific VMK using Powercli...



  • 4.  RE: Setting a default gateway on a specific VMK

    Posted Jul 09, 2021 11:39 AM

    Yes, there is, but the end effect might not be what you expect from it.
    For the method see Solved: override default gateway for vmkernel adapter (vsp... - VMware Technology Network VMTN
    but read that thread till the end to see what to expect



  • 5.  RE: Setting a default gateway on a specific VMK

    Posted Jul 09, 2021 12:17 PM

    It's a dedicated vMo VMK so I don't think it's an issue and I currently have 8 hosts configured this way and it's working. Never the less, I should probably reconfigure them to start using the vMotion stack.



  • 6.  RE: Setting a default gateway on a specific VMK

    Posted Jul 09, 2021 01:01 PM

    Then you should be able to use the snippet I posted in that thread