An IP Pool is a collection of IPs which can be used to create VPS. You should create an IP Pool so that there are no connectivity issues for the VPSes that you create.
The Edit IP Pool API allows you to edit an IP pool present on your server. You can update parameters like the netmask, gateways and the name servers for the IP pool using this API. The API response will return "done" as "1" on successful update of the IP pool.
See also : Add IP Pool Guide.
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | editippool | The action specified to perform an operation and will return "done" as "1" after the IP pool has been successfully updated | Yes |
ippid | GET | Int | ID of the IP Pool | Yes |
ippool_name | POST | text | Name of the IP Pool | Yes |
editippool | POST | 1/0 | If set then the IP Pool will be edited | Yes |
gateway | POST | Int | The Gateway address | Yes |
netmask | POST | Int | Netmask Address | Yes |
ns1 | POST | Int | Name Server Address 1 | Yes |
ns2 | POST | Int | Name Server Address 2 | Yes |
serid | POST | Int | Server ID | Yes |
nat | POST | 1/0 | This will be used for NAT ips. Not to be used with IPv6 | No |
routing | POST | 1/0 | Set/Unset this option | No |
mtu | POST | Int | Set the maximum transfer unit for the IP Pool | No |
uid | POST | Int | Specify the User ID for which you want to assign the pool (Only cloud user can be assigned with billing enabled, internal pool cannot be assigned) (since 3.1.3.1) | No |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$post = array();
$post['ippool_name'] = 'dummyips';
$post['gateway'] = '192.168.1.200';
$post['gateway'] = '1234:0f:0f:1'; //For IPv6
$post['netmask'] = '255.255.255.0';
$post['netmask'] = 48 //For IPv6 Pool
$post['nat'] = 1; //For IPv4 only
$post['ns1'] = '8.8.8.8';
$post['ns2'] = '8.8.4.4';
$post['ns1'] = '2001:4860:4860::8888'; // For IPv6
$post['ns2'] = '2001:4860:4860::8844'; // Pool
$post['serid'] = 0;
$post['ippid'] = '1';
$post['routing'] = 0;
$post['mtu'] = 0;
$output = $admin->editippool($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit IP Pool",
"done": "1",
"ippool": {
"ippid": "546",
"ipp_serid": "0",
"ippool_name": "dummyips",
"gateway": "192.168.1.1",
"netmask": "255.255.255.0",
"ns1": "8.8.8.8",
"ns2": "8.8.4.4",
"ipv6": "0",
"nat": "0",
"nat_name": "",
"routing": "0",
"internal": "0",
"bridge": "",
"mtu": "0",
"serid": "0"
},
"ippid": "546",
"ippool_servers": {
"546|-1|-2": {
"ippid": "546",
"serid": "-1",
"sgid": "-2"
}
},
"timenow": "1477462513",
"time_taken": "0.082"
}