Get Virtualizor

Add IPv6 Subnet

Virtualizor makes it possible to make and assign IPv6 Subnets to VPSes e.g. You can break a /64 IPv6 subnet (assigned to your dedicated server) into multiple /112 subnets and assign them to the VPSes. Use the Add IPv6 Subnet API to add the IPv6 subnet on your server. The API response will contain "done" as "1" on successful creation of the subnet.

For more information about IPv6 subnets, please refer this IPv6 Subnets guide.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
submitipGETaddiprangeIf set the IPv6 Subnet will be generatedYes
netmaskPOSTIntThe Desired Netmask (48,64,80,96,112)Yes
input_netmaskPOSTIntThe input netmask will be used to generate the subnet, valid values can be from 32 to 108 with increments of 4Yes
ips6POSTarrayThe multidimensional array to generate single ipv6 subnetsNo
ipv6_1POSTtextThe 1st ipv6 subnet bitsYes
ipv6_2POSTtextThe 2nd ipv6 subnet bitsYes
ipv6_3POSTtextThe 3rd ipv6 subnet bits (Required for input_netmask values 36-108)No
ipv6_4POSTtextThe 4th ipv6 subnet bits (Required for input_netmask values 52-108)No
ipv6_5POSTtextThe 5th ipv6 subnet bits (Required for input_netmask values 68-108)No
ipv6_6POSTtextThe 6th ipv6 subnet bits (Required for input_netmask values 84-108)No
ipv6_7POSTtextThe 7th ipv6 subnet bits (Required for input_netmask values 100-108)No
ipv6_numPOSTIntThe number of ipv6 subnets that will be generatedYes
ippidPOSTIntThe IP Pool ID to which the subnet has to be addedNo

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['submitip'] = 1;
    $post['netmask'] = 48;
    $post['input_netmask'] = 40;
    $post['ips6'] = array(array('1234','0f0f','0f0f','0123','1000','0000','eca7','071f'));
    $post['ipv6_1'] = '102f';
    $post['ipv6_2'] = '4526';
    $post['ipv6_3'] = '1f25';
    $post['ipv6_4'] = '';
    $post['ipv6_5'] = '';
    $post['ipv6_6'] = '';
    $post['ipv6_7'] = '';
    $post['ipv6_num'] = 50;
    $post['ippid'] = 750;

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

    print_r(json_encode($output));

?>

Output

{
  "title": "Add IPv6 Subnet",
  "done": {
    "range": {
      "539": "102f:4526:1f25be:0000:0000:0000:0000:0001",
      "540": "102f:4526:1f250d:0000:0000:0000:0000:0001",
      "541": "102f:4526:1f258b:0000:0000:0000:0000:0001",
      "542": "102f:4526:1f2585:0000:0000:0000:0000:0001",
      "543": "102f:4526:1f2570:0000:0000:0000:0000:0001",
      "544": "102f:4526:1f25c5:0000:0000:0000:0000:0001",
      "545": "102f:4526:1f2502:0000:0000:0000:0000:0001",
      "546": "102f:4526:1f2591:0000:0000:0000:0000:0001",
      "547": "102f:4526:1f2590:0000:0000:0000:0000:0001"
    },
    "done": 1
  },
  "timenow": 1535398935,
  "time_taken": "0.216"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list