Adding IP Address

Use the add operation to add an IP address to the Plesk's server.

Note: In Plesk powered by Virtuozzo, if the specified IP is not in VPS (Virtual Private Server) pool, the attempt to add this address to Plesk database will result in error.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet adding IP address to Plesk server includes the add operation node:

<packet>
<ip>
  <add>
  ...
  </add>
</ip>
</packet>

 

The add node is of type IpInputType type (ip_input.xsd). It has the following graphics representation:

  • The ip_address node is required. It specifies the IP address you want to add to Plesk database. Data type: ip_address (common.xsd).
  • The netmask node is required. It specifies the netmask of the network. Data type: ip_address (common.xsd).
  • The type node is required. It specifies the type of IP address. Data type: string. Allowed values: shared | exclusive.
  • The interface node is required. It specifies the network interface name. Data type: string.
  • The service-node node is optional. It specifies the service node. Data type: serviceNodeSpecType (ip_input.xsd).
  • The public_ip_address node is optional. For Plesk servers behind NAT you can match private IP addresses to corresponding public ones. This node specifies the public IP address corresponding to the IP address that you are adding using the add operation. Data type: ip_address (common.xsd).

Notes

You can add multiple IP addresses in a single packet. Add as many add operations as the number of IPaddresses you want to add.

<ip>
   <add>
   ...
   </add>
   ...
   <add>
   ...
   </add>
</ip>

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 

Response Packet Structure

The add node of the output XML packet is structured as follows:

  • The result node is required. It wraps the response retrieved from the server. Data type: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the add operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the add operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the add operation fails. Data type: string.
  • The id_address node is optional. If the add operation succeeds, it returns the IP address added to the Plesk's database. Data type: ip_address (common.xsd).

 

 

Samples

Adding a single IP address

This request packet adds a single shared IP address to Plesk server.

<packet>
<ip>
   <add>
      <ip_address>192.168.2.18</ip_address>
      <netmask>255.255.0.0</netmask>
      <type>shared</type>
      <interface>Network Connection</interface>
      <public_ip_address>123.123.123.123</public_ip_address>
   </add>
</ip>
</packet>

Response:

<packet>
<ip>
   <add>
      <result>
         <status>ok</status>
         <ip_address>192.168.2.18</ip_address>
      </result>
   </add>
</ip>
</packet>

 

If the IP address is already in the Plesk's database, the response is as follows:

<packet>
<ip>
   <add>
      <result>
         <status>error</status>
         <errcode>1013</errcode>
         <errtext>IP address was already added on the server</errtext>
      </result>
   </add>
</ip>
</packet> 
Adding multiple IP addresses

This request packet adds two exclusive IP addresses to Plesk server.

<packet>
<ip>
   <add>
      <ip_address>192.0.2.17</ip_address>
      <netmask>255.255.255.0</netmask>
      <type>exclusive</type>
      <interface>Network Connection</interface>
   </add>
   <add>
      <ip_address>192.0.2.16</ip_address>
      <netmask>255.255.255.0</netmask>
      <type>exclusive</type>
      <interface>Network Connection</interface>
   </add>
</ip>
</packet>

Response:

<packet version ="1.4.2.0">
<ip>
   <add>
      <result>
         <status>ok</status>
         <ip_address>192.0.2.17</ip_address>
      </result>
   </add>
   <add>
      <result>
         <status>ok</status>
         <ip_address>192.0.2.16</ip_address>
      </result>
   </add>
</ip>
</packet>