Get Virtualizor

Add IPv6 Pool

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 Add IPv6 IP Pool API allows you to create an IPv6 IP pool on your server. You can define parameters like the netmask, gateways and name Servers for the IP pool using this API. The API response will return "done" as "1" on successful creation of the IP pool.

For more information, you can refer this Add IP Pool guide.

HTTP Request

https://hostname:4085/index.php?act=addippool

Parameters

NameMethodValueDescriptionRequired
actGETaddippoolThe action specified to carry out operation return success 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
ipv6_1POSTtextThe first field of the Ipv6 addressYes
ipv6_2POSTtextThe second field of the Ipv6 addressYes
ipv6_3POSTtextThe third field of the Ipv6 addressYes
ipv6_4POSTtextThe fourth field of the Ipv6 addressYes
ipv6_5POSTtextThe fifth field of the Ipv6 addressYes
ipv6_6POSTtextThe sixth field of the Ipv6 addressYes
ipv6_numPOSTIntThe number of Ipv6 addressesYes
vlanPOST1/0If checked, vlan networking will be usedNo
vlan_bridgePOSTtextName of the vlan bridgeNo
routingPOST1/0If set then the routing option for the ip pool will be enabledNo
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'] = 6;
    $post['serid'] = 0;
    $post['ippool_name'] = 'test_api_ipv6';
    $post['gateway'] = '1234:0f:0f:1';
    $post['netmask'] = '48';
    $post['ns1'] = '2001:4860:4860::8888';
    $post['ns2'] = '2001:4860:4860::8844';
    $post['routing'] = 1;
    $post['ipv6_1'] = '1234';
    $post['ipv6_2'] = '0f0f';
    $post['ipv6_3'] = '0f0f';
    $post['ipv6_4'] = '0123';
    $post['ipv6_5'] = '1000';
    $post['ipv6_6'] = '0000';
    $post['ipv6_num'] = 50;

    $output = $admin->addippool($post); 

    print_r(json_encode($output));
?>

Output

{
  "title": "Add IP Pool",
  "done": {
    "ippid": "10",
    "range": {
      "486": "1234:0f0f:0f0f:0123:1000:0000:dcce:c541",
      "487": "1234:0f0f:0f0f:0123:1000:0000:14fe:e29b",
      "488": "1234:0f0f:0f0f:0123:1000:0000:3223:fc89",
      "489": "1234:0f0f:0f0f:0123:1000:0000:19c5:d4a1",
      "490": "1234:0f0f:0f0f:0123:1000:0000:7c59:8f0f",
      "491": "1234:0f0f:0f0f:0123:1000:0000:964e:e407",
      "492": "1234:0f0f:0f0f:0123:1000:0000:c911:c013",
      "493": "1234:0f0f:0f0f:0123:1000:0000:f3f2:ef9c",
      "494": "1234:0f0f:0f0f:0123:1000:0000:25b0:b26a",
      "495": "1234:0f0f:0f0f:0123:1000:0000:f1f3:b51d",
      "496": "1234:0f0f:0f0f:0123:1000:0000:4956:fc04",
      "497": "1234:0f0f:0f0f:0123:1000:0000:65ca:bcc3",
      "498": "1234:0f0f:0f0f:0123:1000:0000:7ea8:769c"

    },
    "done": 1,
    "ipv6_subnet": "10"
  },
  "timenow": 1535374529,
  "time_taken": "0.227"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list