Add Internal IP Pool

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

NameMethodValueDescriptionRequired
actGETaddippoolThe action specified to carry out the operation and will return “done” as “1” after ip pool has been addedYes
iptypePOSTInt4 for IPv4, 6 for IPv6Yes
seridPOSTarrayAn array containing server IDsYes
ippool_namePOSTtextThe name for the IP PoolYes
gatewayPOSTIntThe ip of the gatewayYes
netmaskPOSTIntThe netmask addressYes
ns1POSTIntName server address 1Yes
ns2POSTIntName server address 2 if anyYes
firstipPOSTIntThe first IP of the IP rangeYes
lastipPOSTIntThe last IP of the IP rangeYes
ipsPOSTarrayAn array containing ips to be addedips
macsPOSTarrayAn array containing mac addresses for the ipsNo
internalPOST1/0Set this flag if you are adding internal ipYes
internal_bridgePOST1/0IF set then the pool will be addedYes
mtuPOSTIntSpecify the Maximum Transmission Unit in bytesNo

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"
}
Was this helpful to you?