List 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. After creating the subnets you can use the List IPv6 API to list all the IPv6 subnets. The list will contain the all details about the subnets, listed according to the IDs of the subnets. You can limit the size of the list by passing using the “page” and “reslen” parameters as shown.

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

HTTP Request

https://hostname:4085/index.php?act=ipranges&page=PAGE&reslen=RESLEN

Parameters

NameMethodValueDescriptionRequired
actGETiprangesThe action specified to carry out operation and retrieve data of the iprangesYes
pagePOSTIntIf not specified, then only first 50 records are returnedYes
reslenPOSTIntNumber of records to be returned, default is 50Yes

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();
    $page = 1;
    $reslen = 50;

    $output = $admin->iprange($page, $reslen, $post);

    print_r(json_encode($output));

?>

Output

{
  "title": "IPv6 Subnets",
  "ips": {
    "538": {
      "ipid": "538",
      "ippid": "3",
      "ip_serid": "0",
      "vpsid": "0",
      "ip": "1234:0f0f:0f0f:0123:1000:0000:ecf7:0001",
      "ipv6": "1",
      "ipr_netmask": "112",
      "primary": "0",
      "ipr_ips": null,
      "mac_addr": null,
      "locked": "0",
      "note": null,
      "ipp_serid": "0",
      "ippool_name": "Live IPv6",
      "gateway": "2607:fa98:30:1::1",
      "netmask": "64",
      "ns1": "2001:4860:4860::8888",
      "ns2": "2001:4860:4860::8844",
      "nat": "0",
      "nat_name": "",
      "routing": "1",
      "internal": "0",
      "bridge": "",
      "mtu": "0",
      "vlan": "0",
      "hostname": null
    }
  },
  "timenow": 1535394732,
  "time_taken": "0.216"
}
Was this helpful to you?