Bryan_Erwin
Enthusiast
Enthusiast

Reclaim an IP from the IP Pool allocated for ESXi VTEP

Jump to solution

I had an IP Pool of 5 addresses all of which were allocated to my 5 ESXi hosts. I then screwed up the VTEP vmkernel port on one of the ESXi hosts. I was only able to correct it by adding another IP to the IP Pool range of addresses and then Forcing a Synch. Now I have an IP Pool that show 6 of 6 IP addresses allocated when in reality I only have 5 of 6 allocated to ESXi hosts. Is there any way for me to reclaim the 6th IP address in the pool that is still showing Allocated?

Thanks

1 Solution

Accepted Solutions
SRoland
VMware Employee
VMware Employee

Try the REST API call

DELETE https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>/ipaddresses/<allocated-ip-address>

its in the API doc page 106. Of course you will need the pool ID first. Let me know if you need help with the steps.

HTH,

Roland

View solution in original post

0 Kudos
5 Replies
SRoland
VMware Employee
VMware Employee

Try the REST API call

DELETE https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>/ipaddresses/<allocated-ip-address>

its in the API doc page 106. Of course you will need the pool ID first. Let me know if you need help with the steps.

HTH,

Roland

0 Kudos
Bryan_Erwin
Enthusiast
Enthusiast

OK, I have a REST client installed and looking at the API Guide you provided it looks pretty straight forward, My only remaining question is how to determine the "pool-id" that's required in the command line. Do you know where I can find the "pool-id"?

Thanks

0 Kudos
SRoland
VMware Employee
VMware Employee

Hi,

Just for the public I am putting it here as well:

run a GET in REST client on

https://<nsx-mgr>/api/2.0//services/ipam/pools/scope/globalroot-0

This will give you the list of pools defined on the manager.

HTH,

Roland

0 Kudos
Bryan_Erwin
Enthusiast
Enthusiast

The commands you provided worked perfect. My IP Pool in NSX Manager now says 5 of 6 allocated. At first it still wasn't obvious what the pool-id was after running the command https://<nsxmgr-ip>/api/2.0/services/ipam/pools/scope/globalroot-0. However, under <ipamAddressPools><ipamAddressPool> is <objectId> and its that objectid that is the pool-id needed for the command https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-id>/ipaddresses/<ipaddress>

Thanks

0 Kudos

I know it's pretty old post but when I read this thought of adding some additional details:

First get the details using :  https://<nsx-mgr>/api/2.0//services/ipam/pools/scope/globalroot-0

Sample output is:

?xml version="1.0" encoding="UTF-8"?>

<ipamAddressPools>

    <ipamAddressPool>

        <objectId>ipaddresspool-2</objectId>

        <objectTypeName>IpAddressPool</objectTypeName>

        <vsmUuid>420D4BE6-0EBD-4739-90D4-9148CDCF63D5</vsmUuid>

        <nodeId>1adef85e-7816-420c-b269-5c24f5fe2c37</nodeId>

        <revision>1</revision>

        <type>

            <typeName>IpAddressPool</typeName>

        </type>

        <name>VTEP-Pool-new</name>

        <scope>

            <id>globalroot-0</id>

            <objectTypeName>GlobalRoot</objectTypeName>

            <name>Global</name>

        </scope>

        <clientHandle></clientHandle>

        <extendedAttributes/>

        <isUniversal>false</isUniversal>

        <universalRevision>0</universalRevision>

        <totalAddressCount>7</totalAddressCount>

        <usedAddressCount>7</usedAddressCount>

        <usedPercentage>100</usedPercentage>

        <prefixLength>22</prefixLength>

        <gateway>___________</gateway>

        <dnsSuffix>dcs.hgst.com</dnsSuffix>

        <dnsServer1>___________</dnsServer1>

        <dnsServer2></dnsServer2>

        <ipPoolType>ipv4</ipPoolType>

        <ipRanges>

            <ipRangeDto>

                <id>iprange-5</id>

                <startAddress>________</startAddress>

                <endAddress>_________</endAddress>

            </ipRangeDto>

        </ipRanges>

        <subnetId>subnet-5</subnetId>

Now you have required values like pool ID :   ipaddresspool-2

DELETE https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>/ipaddresses/<allocated-ip-address>

Replace the NSXMANAGER & ACTUALIPVALUE based on your Infrastructure values -->

https://NSXMANAGER/api/2.0/services/ipam/pools/ipaddresspool-2/ipaddresses/ACTUALIPVALUE

------------------------------------------------------------------------- Follow me @ www.vmwareguruz.com Please consider marking this answer "correct" or "helpful" if you found it useful T. Sateesh VCIX-NV, VCAP 5-DCA/DCD,VCP 6-NV,VCP 5 DCV/Cloud/DT, ZCP IBM India Pvt. Ltd
0 Kudos