Using the Advanced Networking Services API, you can configure DHCP for an edge gateway you have upgraded to manage with Advanced Networking Services.
1 |
Log in to vCloud Air as an administrator. See Log in to vCloud Air for information. |
2 |
Create a login session with vCloud Director. See Create a Session for a Virtual Data Center in a Service for information. |
3 |
Using the vCloud API, query vCloud Director for the ID of the edge gateway that requires DHCP configuration. See Querying the vCloud API for information. |
1 | (Optional) Request the current DHCP configuration for the edge gateway. See List DHCP Configuration. |
2 | Examine the response and update the required elements. For a description of each element of the DHCP schema, see Schema for DHCP Configuration. |
3 | Submit the updated configuration using the following request header and request body: PUT https://serverAddress/hybridity/api/gateways/gatewayId/dhcp/config In the request header, include the OATH token and the Accept header that you obtained when creating a login session: Accept: application/json Content-Type: application/json X-Vcloud-Authorization: "vcloud-auth-token" In the request body, include the schema elements you retrieved and updated from the GET request. The server returns status 204 NO CONTENT in the response header. The server does not return a response body. |
Request Header – Get the DHCP Configuration
GET https://vchs.vmware.com/hybridity/api/gateways/gw-5/dhcp/config Accept: application/json Content-Type: application/json X-Vcloud-Authorization: "d6eFLOqQYfuEn2MJTp7BQ2ISEO+ZYaEgTcqBy8wZQ6js="
Response Body – Get the DHCP Configuration
{ "featureType": "dhcp_4.0", "version": 5, "enabled": false, "staticBindings": { "staticBindings": [] }, "ipPools": { "ipPools": [ { "autoConfigureDNS": false, "defaultGateway": "172.0.0.1", "primaryNameServer": "192.168.10.1", "secondaryNameServer": "192.168.10.2", "leaseTime": "infinite", "poolId": "pool-1", "ipRange": "172.0.0.10-172.0.0.20", "allowHugeRange": false } ] }, "logging": { "enable": false, "logLevel": "info" } }
Request Header – Add a Static Binding
PUT https://vchs.vmware.com/hybridity/api/gateways/gw-5/dhcp/config Accept: application/json Content-Type: application/json X-Vcloud-Authorization: "d6eFLOqQYfuEn2MJTp7BQ2ISEO+ZYaEgTcqBy8wZQ6js="
Request Body – Add a Static Binding
{ "featureType": "dhcp_4.0", "version": 5, "enabled": false, "staticBindings": { "staticBindings": [ { "autoConfigureDNS" : true, "defaultGateway" : "172.0.0.1", "leaseTime" : "infinite", "bindingId" : "binding-1", "hostname" : "vm1", "macAddress" : "00:50:56:00:10:00", "ipAddress" : "172.0.0.34" } ] }, "ipPools": { "ipPools": [ { "autoConfigureDNS": false, "defaultGateway": "172.0.0.1", "primaryNameServer": "192.168.10.1", "secondaryNameServer": "192.168.10.2", "leaseTime": "infinite", "poolId": "pool-1", "ipRange": "172.0.0.10-172.0.0.20", "allowHugeRange": false } ] }, "logging": { "enable": false, "logLevel": "info" } }