# add_tunnel
The EvoShield add_tunnel POST endpoint creates a new protection tunnel for a specified IP address
Parameters
account
: The account key - which can be found in the Settings area of the Evolution Host client area: https://evolution-host.com/controlPanelservice_key
: The unique key for the particular Evolution Host service being used in this API call - Can be found by using the /list_services API endpointname
: (optional) specify a name for your tunnel to make the tunnel easier for you to identifyip
: The IPv4 address that requires protection via the tunnel (the real IP of your server)protection_ip
: (optional) The EvoShield protection IP address assigned to your service that you would like to use to create the tunnel - A list of the IP addresses assigned to your service can be found using the /list_services API endpoint. If protection_ip
is not specified, the first available IP will be used, or a new IP will be allocated automatically if required. See “Notes” section below for more information.type
: Specify whether the tunnel type should be “gre” or “nat”all_traffic
: A boolean that specifies whether all traffic on the machine should be routed through the tunnel (GRE type only)gre_key
: A boolean that specifies whether to utilize a GRE encryption key for communication between the networks (Other and BSD OS only - Defaults to true for Windows and Linux)os
: Specify whether the machine you are protecting is “windows”, “linux”, “bsd” or “other”Notes
If the protection_ip
parameter is not supplied and there aren't any unused/available IPs currently assigned to the EvoShield service, a new IP address will be allocated automatically if your Evolution Host account has sufficient account balance available to complete the upgrade. If sufficient funds are not available, an ERROR_INSUFFICIENT_FUNDS error will be returned. You can add funds to your account at any time via https://evolution-host.com/topup.php
The cost of allocating an additional IP address will be prorated to the service renewal date. The response will contain upgrade_cost, prorated_cost, new_service_cost and new_balance fields if a new IP has been assigned:
upgrade_cost
: The current monthly cost of a single additional public EvoShield endpoint.prorated_cost
: The cost charged today (prorated to the next renewal date of the service).new_service_cost
: The new total cost of the EvoShield service after the upgrade, per billing cycle.new_balance
: Your remaining Evolution Host account balance after the upgrade.
$url = "https://evolution-host.com/api.php";
$postData = http_build_query([
'account' => 'ypG8T7mXVvr9n2wctbxgdxnDW6PK2zNkQZLhqf3YRBFDDC',
'service_key' => '2gA3IYVEeV9BDSnvxSxzQykfX6R6CEEF',
'action' => 'add_tunnel',
'type' => 'gre',
'name' => 'My EvoShield Tunnel',
'ip' => '1.1.1.1',
'protection_ip' => '336.59.10.124',
'os' => 'Windows',
'all_traffic' => false,
]);
$headers = array(
'http' => array
(
'method' => "POST",
'ignore_errors' => true,
'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
'content' => $postData,
),
);
$api_context = stream_context_create($headers);
$result = file_get_contents($url, false, $api_context);
$non_encoded_result = $result;
$result = json_decode($result);
if($result !== NULL)
{
echo '<pre>' . var_export($result, true) . '</pre>';
}
else
{
echo "json_decode failed/invalid JSON<br>";
echo "<br><br>$non_encoded_result";
}
Example Response
stdClass::__set_state(array(
'status' => 'ok',
'tunnel' =>
stdClass::__set_state(array(
'name' => 'My EvoShield Tunnel',
'as_default_gateway' => false,
'operating_system' => 'Windows',
'id' => 948412728,
'type' => 'GRE',
'evoshield_public_ip' => '336.59.10.124',
'protected_ip' => '1.1.1.1',
'forwarding_endpoints' =>
array (
0 => '14.37.236.128',
1 => '14.37.236.129',
2 => '14.37.236.130',
3 => '14.37.236.131',
4 => '14.37.236.132',
5 => '14.37.236.133',
6 => '14.37.236.134',
7 => '14.37.236.135',
),
'gre' =>
stdClass::__set_state(array(
'network' => '10.0.23.0/30',
'gateway' => '10.0.23.1',
'ip' => '10.0.23.2',
)),
)),
'note' => 'Please allow a few minutes for 146.59.10.116 to begin responding on the network in all locations.'
))