You allocate IP addresses to an Edge Gateway to make them available for use by that Edge Gateway, such as in NAT rules, firewall rules, and VPN rules.

When you allocate IP addresses to an Edge Gateway, you specify the quantity of IP addresses to be allocated. Optionally, you can specify the external network for the IP addresses if you have more than one external network available for your use.

Verify that you are logged into the vCloud API endpoint as an Account Administrator or a Network Administrator.

Verify that you can retrieve the id for the Edge Gateway.

1

Retrieve the id for the Edge Gateway.

Use a request like this one:

GET https://vcloud.example.com/api/vchs/query?type=edgeGateway
2

Examine the response to locate the VchsEdgeGatewayRecord element for the Edge Gateway.

3

In the VchsEdgeGatewayRecord element, locate the Link element that contains the URL for managing IP addresses of that Edge Gateway.

This element has a rel attribute value of manageExternalIpAddresses.


<Link
   href="https://vcloud.example.com/api/admin/edgeGateway/2000/action/manageExternalIpAddresses"
   rel="manageExternalIpAddresses"/>
4

Create an ExternalIpAddressActionList element.

Allocate a quantity of IP addresses, without specifying the external network. This example specifies the allocation of two IP addresses.


<ExternalIpAddressActionList
   xmlns="http://www.vmware.com/vcloud/networkservice/1.0">
   <Allocation>
      <NumberOfExternalIpAddressesToAllocate>2</NumberOfExternalIpAddressesToAllocate>
   </Allocation>
</ExternalIpAddressActionList>

Allocate a quantity of IP addresses from a specified external network.


<ExternalIpAddressActionList
   xmlns="http://www.vmware.com/vcloud/networkservice/1.0">
   <Allocation>
      <ExternalNetworkName>externlnet</ExternalNetworkName>
      <ExternalNetworkRef>https://vcloud.example.com/api/admin/.../network/1213</ExternalNetworkRef>
      <NumberOfExternalIpAddressesToAllocate>2</NumberOfExternalIpAddressesToAllocate>
   </Allocation>
</ExternalIpAddressActionList>
5

Make a PUT request to the URL in the value of the href attribute of the manageExternalIpAddresses link described in Step 3.

Supply the ExternalIpAddressActionList element as the request body.

Allocate a quantity of IP addresses, without specifying the external network. This example specifies the allocation of two IP addresses.


PUT https://vcloud.example.com/api/admin/edgeGateway/2000/action/manageExternalIpAddresses
Content-Type: application/vnd.vmware.vchs.edgeGatewayIpAllocation.list+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<ExternalIpAddressActionList
   xmlns="http://www.vmware.com/vcloud/networkservice/1.0">
   <Allocation>
      <NumberOfExternalIpAddressesToAllocate>2</NumberOfExternalIpAddressesToAllocate>
   </Allocation>
</ExternalIpAddressActionList>

Allocate a quantity of IP addresses from a specified external network.


PUT https://vcloud.example.com/api/admin/edgeGateway/2000/action/manageExternalIpAddresses
Content-Type: application/vnd.vmware.vchs.edgeGatewayIpAllocation.list+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<ExternalIpAddressActionList
   xmlns="http://www.vmware.com/vcloud/networkservice/1.0">
   <Allocation>
      <ExternalNetworkName>externlnet</ExternalNetworkName>
      <ExternalNetworkRef>https://vcloud.example.com/api/admin/.../network/1213</ExternalNetworkRef>
      <NumberOfExternalIpAddressesToAllocate>2</NumberOfExternalIpAddressesToAllocate>
   </Allocation>
</ExternalIpAddressActionList>

The server takes the requested action and returns a Task element that tracks the progress of the request.

When the task completes successfully, the IP addresses are allocated to the Edge Gateway.

If the action fails, the server returns an ErrorType element. The action can fail If the external network does not have enough available IP addresses to allocate, or an Edge Gateway with the specified id does not exist.