Search 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. For searching the added subnets you can use the Search IPv6 API. The API response will contain a list of all details about the subnets, listed according to the IDs of the subnets. To filter or limit the size of the list you can pass in one or more query parameters.

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

HTTP Request

https://hostname:4085/index.php?act=ipranges&ipsearch=IPSEARCH&ippoolsearch=IPPOOLSEARCH&lockedsearch=LOCKSEARCH&page=PAGE&reslen=RESLEN

Parameters

NameMethodValueDescriptionRequired
actGETiprangesThe action will return the list of IPv6 SubnetYes
ipsearchGETtextThe ipv6 subnet that needs to be searchedNo
ippoolsearchGETtextThe Subnet will be returned on the basis of the IP Pool to which it belongsNo
lockedsearchGETtextThe Subnet will be searched on the basis whether they are locked or unlocked values are (showlocked/hidelocked)No
pagePOSTIntIf not specified, then only first 50 records are returnedNo
reslenPOSTIntNumber of records to be returned, default is 50No

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);

    $page = 1;
    $reslen = 50;
    $post = array();
    $post['ipsearch'] = '';
    $post['ippoolsearch'] = 'pool7';
    $post['lockedsearch'] = 'hidelocked';

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

    print_r(json_encode($output));

?>

Output

{
    "title": "IPv6 Subnets",
    "ips": {
        "104": {
            "ipid": "104",
            "ippid": "6",
            "ip_serid": "0",
            "vpsid": "2206",
            "ip": "1111:1111:1111:0df0:0000:0000:0000:0001",
            "ipv6": "1",
            "ipr_netmask": "64",
            "primary": "-7",
            "ipr_ips": "null",
            "mac_addr": "null",
            "locked": "0",
            "ipp_serid": "0",
            "ippool_name": "pool7",
            "gateway": "2a06:8ec0::4",
            "netmask": "10",
            "ns1": "8.8.8.8",
            "ns2": "8.8.4.4",
            "nat": "0",
            "nat_name": "",
            "routing": "1",
            "internal": "0",
            "bridge": "",
            "mtu": "0",
            "vlan": "0",
            "hostname": "null"
        },
        "108": {
            "ipid": "108",
            "ippid": "6",
            "ip_serid": "0",
            "vpsid": "2018",
            "ip": "1111:1111:1111:0fec:0000:0000:0000:0001",
            "ipv6": "1",
            "ipr_netmask": "64",
            "primary": "-5",
            "ipr_ips": "null",
            "mac_addr": "null",
            "locked": "0",
            "ipp_serid": "0",
            "ippool_name": "pool7",
            "gateway": "2a06:8ec0::4",
            "netmask": "10",
            "ns1": "8.8.8.8",
            "ns2": "8.8.4.4",
            "nat": "0",
            "nat_name": "",
            "routing": "1",
            "internal": "0",
            "bridge": "",
            "mtu": "0",
            "vlan": "0",
            "hostname": "null"
        }
    },
    "timenow": "1481876010",
    "time_taken": "0.133"
}
Was this helpful to you?