Add IP (IPv6)

Use the Add IP API to add an IPv6 type of IP address on your server. This IP address can be used for the creation of VPS on the server. You can add single IP address or pass in multiple IP addresses as shown. In addition to that MAC IDs can also be passed which will be binded to the IP address.

You cannot add IPs to an IP Pool which has NAT enabled.

See also: Add IP guide.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETaddipsThe action specified to carry out the operation and return “done” as “1” after the IP(s) have been successfully addedYes
iptypePOSTInt4 for IPv4, 6 for IPv6Yes
ips6POSTarrayAn two dimensional array containing IPv6 addressesYes
macsPOSTtextAn array containing mac addressesNo
ipv6_1POSTtextThe first field of the Ipv6 addressNo
ipv6_2POSTtextThe second field of the Ipv6 addressNo
ipv6_3POSTtextThe third field of the Ipv6 addressNo
ipv6_4POSTtextThe fourth field of the Ipv6 addressNo
ipv6_5POSTtextThe fifth field of the Ipv6 addressNo
ipv6_6POSTtextThe sixth field of the Ipv6 addressNo
ipv6_numPOSTIntThe number of IPv6 addressesNo
ippidPOSTIntThe IP Pool IDNo
ip_seridPOSTIntThe server IDNo

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;            //4 for ipv4 & 6 for ipv6
    $post['ips6'] = array(array('1234','0f0f','0f0f','0123','1000','0000','eca7','071f'));
    $post['macs'] = array('');
    $post['ipv6_1'] = '';
    $post['ipv6_2'] = '';
    $post['ipv6_3'] = '';
    $post['ipv6_4'] = '';
    $post['ipv6_5'] = '';
    $post['ipv6_6'] = '';
    $post['ipv6_num'] = '';
    $post['ippid'] = 3;
    $post['ip_serid'] = '0';

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

    print_r(json_encode($output));
?>

Output

{
    "title": "Add IP",
    "done": {
        "range": {
            "235615": "1234:0f0f:0f0f:0123:1000:0000:eca7:071f"
        },
        "done": 1
    },
    "timenow": 1481873949,
    "time_taken": "0.104"
}
Was this helpful to you?