Get Virtualizor

Edit IP 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 Edit IP Pool API allows you to edit an IP pool present on your server. You can update parameters like the netmask, gateways and the name servers for the IP pool using this API. The API response will return "done" as "1" on successful update of the IP pool.

See also : Add IP Pool Guide.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETeditippoolThe action specified to perform an operation and will return "done" as "1" after the IP pool has been successfully updatedYes
ippidGETIntID of the IP PoolYes
ippool_namePOSTtextName of the IP PoolYes
editippoolPOST1/0If set then the IP Pool will be editedYes
gatewayPOSTIntThe Gateway addressYes
netmaskPOSTIntNetmask AddressYes
ns1POSTIntName Server Address 1Yes
ns2POSTIntName Server Address 2Yes
seridPOSTIntServer IDYes
natPOST1/0This will be used for NAT ips. Not to be used with IPv6No
routingPOST1/0Set/Unset this optionNo
mtuPOSTIntSet the maximum transfer unit for the IP PoolNo
uidPOSTIntSpecify the User ID for which you want to assign the pool (Only cloud user can be assigned with billing enabled, internal pool cannot be assigned) (since 3.1.3.1)No

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['ippool_name'] = 'dummyips';
    $post['gateway'] = '192.168.1.200';
    $post['gateway'] = '1234:0f:0f:1';          //For IPv6 
    $post['netmask'] = '255.255.255.0';
    $post['netmask'] = 48                       //For IPv6 Pool
    $post['nat'] = 1;                       //For IPv4 only
    $post['ns1'] = '8.8.8.8';
    $post['ns2'] = '8.8.4.4';
    $post['ns1'] = '2001:4860:4860::8888';     // For IPv6
    $post['ns2'] = '2001:4860:4860::8844';      // Pool
    $post['serid'] = 0;
    $post['ippid'] = '1';
    $post['routing'] = 0;
    $post['mtu'] = 0;

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

    print_r(json_encode($output));
?>

Output

{
    "title": "Edit IP Pool",
    "done": "1",
    "ippool": {
        "ippid": "546",
        "ipp_serid": "0",
        "ippool_name": "dummyips",
        "gateway": "192.168.1.1",
        "netmask": "255.255.255.0",
        "ns1": "8.8.8.8",
        "ns2": "8.8.4.4",
        "ipv6": "0",
        "nat": "0",
        "nat_name": "",
        "routing": "0",
        "internal": "0",
        "bridge": "",
        "mtu": "0",
        "serid": "0"
    },
    "ippid": "546",
    "ippool_servers": {
        "546|-1|-2": {
            "ippid": "546",
            "serid": "-1",
            "sgid": "-2"
        }
    },
    "timenow": "1477462513",
    "time_taken": "0.082"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list