VPN Tunnels
VPN tunnels are IPSec connections within a VPN connection that define the actual encrypted channel between endpoints. Each tunnel specifies local and remote addresses, IPSec configuration, and authentication settings.
List tunnels
Returns a list of tunnels for a VPN connection.
Request
curl -X GET https://api.upcloud.com/1.3/gateway/04b87f79-1a17-4f64-ad8e-33bd4c3f5c1b/connections/1085d477-8d8f-4c97-9bef-731933187538/tunnels \
-u your_username:your_password
Get tunnel details
Returns details of a specific tunnel including IPSec configuration and health status.
Tunnel operational states
| State | Description |
|---|---|
| idle | Connection is idle |
| connecting | Connection is being initiated |
| established | Connection is fully established |
| destroying | Connection is being destroyed |
| unknown | Connection state is unknown |
Request
curl -X GET https://api.upcloud.com/1.3/gateway/04b87f79-1a17-4f64-ad8e-33bd4c3f5c1b/connections/1085d477-8d8f-4c97-9bef-731933187538/tunnels/1085d477-8d8f-4c97-9bef-731933187777 \
-u your_username:your_password
Create tunnel
Creates a new IPSec tunnel for a VPN connection.
Attributes
- Name
name- Type
- string
- Description
Tunnel name (1-64 chars). Must be unique within the gateway.
- Name
local_address- Type
- object
- Description
Local address object with
namereferencing a gateway address.
- Name
remote_address- Type
- object
- Description
Remote address object with
addresscontaining the peer IP.
- Name
ipsec- Type
- object
- Description
IPSec configuration including authentication.
- Name
tunnel_internal_ip- Type
- string
- Description
Tunnel link-local address for internal pinger (169.254.17.x/30).
- Name
internal_peer_ping_interval- Type
- integer
- Description
Peer ping interval in seconds (0 = disabled, or >= 5).
IPSec authentication
- Name
authentication- Type
- string
- Description
Authentication type. Currently only "psk" is supported.
- Name
psk- Type
- string
- Description
Pre-shared key (8-64 chars). Required when creating.
Request
curl -X POST https://api.upcloud.com/1.3/gateway/04b87f79-1a17-4f64-ad8e-33bd4c3f5c1b/connections/1085d477-8d8f-4c97-9bef-731933187538/tunnels \
-u your_username:your_password \
-H "Content-Type: application/json" \
-d '{
"name": "secondary-tunnel",
"local_address": {
"name": "public-ip-1"
},
"remote_address": {
"address": "203.0.113.100"
},
"ipsec": {
"authentication": {
"authentication": "psk",
"psk": "your-secure-pre-shared-key"
}
},
"tunnel_internal_ip": "169.254.17.5",
"internal_peer_ping_interval": 10
}'
Modify tunnel
Modifies an existing IPSec tunnel configuration.
Attributes
- Name
name- Type
- string
- Description
Updated tunnel name.
- Name
local_address- Type
- object
- Description
Updated local address.
- Name
remote_address- Type
- object
- Description
Updated remote address.
- Name
ipsec- Type
- object
- Description
Updated IPSec configuration.
- Name
tunnel_internal_ip- Type
- string
- Description
Updated tunnel internal IP.
- Name
internal_peer_ping_interval- Type
- integer
- Description
Updated ping interval.
Request
curl -X PATCH https://api.upcloud.com/1.3/gateway/04b87f79-1a17-4f64-ad8e-33bd4c3f5c1b/connections/1085d477-8d8f-4c97-9bef-731933187538/tunnels/1085d477-8d8f-4c97-9bef-731933187777 \
-u your_username:your_password \
-H "Content-Type: application/json" \
-d '{
"remote_address": {
"address": "203.0.113.200"
}
}'
Delete tunnel
Deletes a tunnel from a VPN connection.
Request
curl -X DELETE https://api.upcloud.com/1.3/gateway/04b87f79-1a17-4f64-ad8e-33bd4c3f5c1b/connections/1085d477-8d8f-4c97-9bef-731933187538/tunnels/1085d477-8d8f-4c97-9bef-731933187777 \
-u your_username:your_password
Get metrics
Returns metrics for a network gateway including NAT gateway statistics and IPSec tunnel metrics.
Response attributes
Gateway metrics:
active_connections: Current active NAT connectionstotal_accepted_connections: Total connections acceptedtotal_rejected_connections: Total connections rejected
IPSec metrics:
ike_sas: IKE Security Association informationchild_sas: Child SA traffic statistics (bytes, packets)heuristic_state: Tunnel health and diagnostic info
Request
curl -X GET https://api.upcloud.com/1.3/gateway/04b87f79-1a17-4f64-ad8e-33bd4c3f5c1b/metrics \
-u your_username:your_password