Internal IP pool are groups of private IP addresses which the VPSes can use to communicate internally with each other. Virtualizor's IP Pool system supports this on all Virtualization.
Use the Add Internal IP pool API to create an internal IP pool on your server. The IP from the IP pool will be assigned to the VPS when the VPS is started. The VPS will have two network interfaces i.e. one for the public IP addresses and the other for the internal IP network.
For more information, you can refer this Internal Network Guide.
HTTP Request
https://hostname:4085/index.php?act=addippool
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | addippool | The action specified to carry out the operation and will return "done" as "1" after ip pool has been added | Yes |
iptype | POST | Int | 4 for IPv4, 6 for IPv6 | Yes |
serid | POST | array | An array containing server IDs | Yes |
ippool_name | POST | text | The name for the IP Pool | Yes |
gateway | POST | Int | The ip of the gateway | Yes |
netmask | POST | Int | The netmask address | Yes |
ns1 | POST | Int | Name server address 1 | Yes |
ns2 | POST | Int | Name server address 2 if any | Yes |
firstip | POST | Int | The first IP of the IP range | Yes |
lastip | POST | Int | The last IP of the IP range | Yes |
ips | POST | array | An array containing ips to be added | ips |
macs | POST | array | An array containing mac addresses for the ips | No |
internal | POST | 1/0 | Set this flag if you are adding internal ip | Yes |
internal_bridge | POST | 1/0 | IF set then the pool will be added | Yes |
mtu | POST | Int | Specify the Maximum Transmission Unit in bytes | 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['iptype'] = 4;
$post['serid'] = 0;
$post['ippool_name'] = 'test_api_int';
$post['gateway'] = '10.10.1.1';
$post['netmask'] = '255.255.255.0';
$post['ns1'] = '4.2.2.1';
$post['ns2'] = '4.2.2.2';
$post['firstip'] = '10.10.1.3';
$post['lastip'] = '10.10.1.15';
$post['internal'] = 1;
$post['internal_bridge'] = 'intbr0';
$output = $admin->addippool($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add IP Pool",
"done": {
"ippid": "8",
"range": {
"473": "10.10.1.3",
"474": "10.10.1.4",
"475": "10.10.1.5",
"476": "10.10.1.6",
"477": "10.10.1.7",
"478": "10.10.1.8",
"479": "10.10.1.9",
"480": "10.10.1.10",
"481": "10.10.1.11",
"482": "10.10.1.12",
"483": "10.10.1.13",
"484": "10.10.1.14",
"485": "10.10.1.15"
},
"done": 1
},
"timenow": 1535372843,
"time_taken": "0.226"
}