0 Replies Latest reply on Jul 24, 2019 5:24 AM by NikhilPathak

    Identify END IP  to create a ORG VDC Network

    NikhilPathak Novice

      I have Gateway IP, StartIP and Netmask and based on this information, have to create a ORG VDC network.. I am able to get the values correct for netmask "255.255.255.0". But is doesnt work correct for other values.. Can anyone help.

       

      The purpose here is to delete the existing orgvdc network and recreate it with different range..

       

       

      [IPAddress]$Gateway = "10.78.215.11"

      [IPAddress]$StartIP = "10.78.215.1"

      [IPAddress]$Netmask = "255.255.248.0"

      [IPAddress]$EndIP = "0.0.0.0"

      [IPAddress]$EndIP1 = "0.0.0.0"

      [IPAddress]$subtract = "0.0.0.0"

      $subtract.Address = -bnot $Netmask.Address

       

       

      [IPAddress]$previousip = "0.0.0.0"

      [IPAddress]$nextip = "0.0.0.0"

      [IPAddress]$add = "0.0.0.1"

      $previousip.Address = $Gateway.Address - $add.Address

      $nextip.Address = $Gateway.Address + $add.Address

      $endip1.address = $startip.Address -bor $subtract.Address

      $EndIP.Address = $EndIP1.Address - $add.Address

       

      #Array for Network Range on ORG VDC Network

      $A = @(5)

      $A[0] = $StartIP.IPAddressToString + "-$($previousip.IPAddressToString)"

      $A += "$($nextip.IPAddressToString)" +"-$($EndIP.IPAddressToString)"

       

      #New Orgvdc network

      New-OrgVdcNetwork -Name $currentorgnetwork.Name  -EdgeGateway $edge.Name -OrgVdc $orgvdc.Name -Gateway $Gateway.IPAddressToString -Netmask $Netmask.IPAddressToString -StaticIPPool $A -Routed