Child pages
  • WHM API 1 Functions - addips

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function adds an IPv4 address or addresses to the server.


When you add an IP address, the system attempts to add an alias of that IP address to the main network interface. This process rebuilds the IP address pool, which resides in the /etc/ipaddrpool file. The system stores IP addresses within the /etc/ips file. The ipaliases service activates those IP addresses when the server starts.  

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleJSON API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/json-api/addips?api.version=1&ips=192.168.0.20&netmask=255.255.255.0



Expand
titleXML API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/xml-api/addips?api.version=1&ips=192.168.0.20&netmask=255.255.255.0



Expand
titleCommand Line


Code Block
languagebash
whmapi1 addips ips=192.168.0.20 netmask=255.255.255.0

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
  "metadata": {
    "version": 1,
    "reason": "Success",
    "output": {
      "messages": [
        "eth0:cp1 is now up. 192.168.0.20/255.255.255.0 broadcast 192.168.0.255 has been added.",
        "1"
      ]
    },
    "result": 1,
    "command": "addips"
  }
}



Expand
titleOutput (XML)


Code Block
languagetext
linenumberstrue
<result>
    <metadata>
        <version>1</version>
        <reason>Success</reason>
        <output>
            <messages>
                eth0:cp1 is now up. 192.168.0.20/255.255.255.0 broadcast 192.168.0.255 has been added.
            </messages>
            <messages>1</messages>
        </output>
        <result>1</result>
        <command>addips</command>
    </metadata>
</result>


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
ipsstring

Required

The IPv4 address or addresses.

A valid IPv4 address or address range in Class C CIDR format.
192.168.0.0

192.168.0.20/28

netmaskstring

Required

The IPv4 address' netmask.

 

A valid IPv4 netmask address.

Note

If the ips parameter is in Class C CIDR format, the range mask must be a value from 24 through 30.


255.255.255.0
excludesstring

An IPv4 address or addresses to exclude.

If you do not specify a value, the function does not exclude any IPv4 addresses.

A comma-delimited list of IPv4 addresses.192.168.0.1,192.168.0.2

Returns

Note
titleNote:

This function outputs these returns in the metadata.


ReturnTypeDescriptionPossible valuesExample
outputhash

A hash of output messages.

The hash includes the messages return.
 

messages

array

An array of the function call's raw output.

The function returns this array in the output hash.

An array of valid strings.


Expand
titleClick to view...
eth0:cp1 is now up. 192.168.0.20/255.255.255.0 broadcast 192.168.0.255 has been added.