> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/agent/guides/agent-tunnel.md). Agents can also search and read this documentation through its [MCP server](https://docs.devolutions.net/~gitbook/mcp).

# Agent tunnel

Connect Devolutions Agent to Devolutions Gateway with the Agent Tunnel to reach the subnets and DNS names behind the agent without inbound ports.

The Agent Tunnel lets a Devolutions Gateway reach machines in a network it cannot reach directly, such as a branch office or a customer site behind a firewall. **Devolutions Agent, installed in that network, opens an outbound connection to the gateway and advertises the subnets and DNS names it can reach.** When a session's destination matches what an agent advertises, Devolutions Gateway sends the connection through that agent, and the agent opens the connection to the target. No inbound port is opened in the agent's network.

The Agent Tunnel is available in Devolutions Agent on Windows and Linux.

## How it works

<table><thead><tr><th width="220">STEP</th><th>WHAT HAPPENS</th></tr></thead><tbody><tr><td><strong>Enrollment</strong></td><td>An administrator generates an enrollment string for the gateway in Devolutions Server, Devolutions Cloud or Remote Desktop Manager. Devolutions Agent sends it to the gateway over HTTPS, with a certificate request. The agent creates its private key locally; the key never leaves the machine. The gateway returns a client certificate valid for one year and its own certificate authority.</td></tr><tr><td><strong>Tunnel</strong></td><td>Devolutions Agent connects to the gateway with QUIC over UDP, port 4433 by default, with mutual TLS. It checks the gateway certificate against the certificate authority and the key received at enrollment.</td></tr><tr><td><strong>Routes</strong></td><td>Devolutions Agent advertises its subnets (IPv4 CIDR ranges) and DNS routes every 30 seconds and sends a heartbeat every 60 seconds. The gateway marks the agent offline after 90 seconds without traffic.</td></tr><tr><td><strong>Sessions</strong></td><td>For a destination that matches an advertised route, the gateway asks the agent to open a TCP connection to the target. The agent allows a target name that matches a DNS route; any other target must resolve to an address in an advertised subnet. IPv6 targets work only through a DNS route.</td></tr><tr><td><strong>Renewal</strong></td><td>When its certificate expires within 15 days, Devolutions Agent asks the gateway for a new one through the tunnel. An agent that stays connected does not need to enroll again.</td></tr></tbody></table>

## Requirements

<table><thead><tr><th width="280">REQUIREMENT</th><th>DETAILS</th></tr></thead><tbody><tr><td><strong>Devolutions Gateway with the Agent Tunnel enabled</strong></td><td>Devolutions Gateway 2026.3.0 or later, with <code>AgentTunnel.Enabled</code> set to <code>true</code> in <code>gateway.json</code> (the <em><strong>Enable Agent Tunnel</strong></em> option of the Devolutions Gateway installer) and the gateway restarted. An agent enrolled with a gateway older than 2026.3.0 must enroll again. See <a href="https://docs.devolutions.net/gateway/guides/connect/agent-tunnel">Agent tunnel in Devolutions Gateway</a>.</td></tr><tr><td><strong>Network from the agent to the gateway</strong></td><td>HTTPS (TCP) to the gateway web listener, for example port 7171, for the enrollment. UDP to the gateway Agent Tunnel port, 4433 by default, for the tunnel. Nothing inbound on the agent side.</td></tr><tr><td><strong>An enrollment string</strong></td><td>Generated for this gateway by an administrator. It is valid for the lifetime chosen when it was generated.</td></tr><tr><td><strong>Devolutions Agent</strong></td><td>On Windows with the <em><strong>Agent Tunnel</strong></em> feature (<code>F.Tunnel</code>), or on Linux. Run the enrollment as an administrator (Windows) or as root (Linux).</td></tr></tbody></table>

{% hint style="warning" %}
An enrollment string is a secret: anyone who has it can enroll a machine on your gateway until it expires. Generate it with the shortest lifetime that works for you, and do not store it in scripts or tickets.
{% endhint %}

## Generate an enrollment string

{% tabs %}
{% tab title="Devolutions Server" %}

1. In the Devolutions Server web interface, go to ***Administration*** – ***Devolutions Gateway***.
2. Open the row menu of the gateway and select ***Agent tunnel***.
3. Click ***Generate enrollment string***.
4. In ***Name***, enter the name of the agent (required, up to 255 printable ASCII characters).
5. In ***Lifetime***, choose ***1 Hour*** (default), ***4 Hours***, ***24 Hours*** or ***7 Days***.
6. Click ***Generate***, then ***Copy to clipboard*** next to ***Enrollment string***. The dialog also shows the ***QUIC endpoint*** the agent will use and when the string expires.

If the gateway does not have the Agent Tunnel enabled, Devolutions Server shows "Agent Tunnel is not enabled on this Gateway. In gateway.json, set AgentTunnel.Enabled = true and restart the Gateway." An older gateway shows "This Gateway version does not support Agent Tunnel. Upgrade the Gateway to a version that ships the Agent Tunnel API."

Remote Desktop Manager connected to a Devolutions Server workspace offers the same commands on the ***Agent tunnel*** tab of ***Administration*** – ***Devolutions Gateway***.
{% endtab %}

{% tab title="Devolutions Cloud" %}

1. In Devolutions Cloud, go to ***Administration*** – ***Gateways***.
2. Click ***More*** on the row of the gateway and select ***Agent tunnel***.
3. Click ***Generate enrollment string***.
4. Enter a ***Name*** and choose a ***Lifetime***: ***1 hour***, ***4 hours***, ***1 day*** or ***7 days***.
5. Generate the string and copy it. The dialog also shows the ***QUIC endpoint*** and the expiration.

If the gateway cannot be reached, Devolutions Cloud shows "Devolutions Gateway is unreachable. Please make sure it is up and running."
{% endtab %}
{% endtabs %}

## Enroll Devolutions Agent

{% tabs %}
{% tab title="Windows installer" %}

1. Run the Devolutions Agent installer (or run it again and choose ***Change*** on an installed agent).
2. On the feature selection page, select ***Agent Tunnel***.
3. On the ***Agent Tunnel*** page, paste the string in ***Enrollment String (provided by your gateway operator):***.
4. Optionally, fill in the routes:
   * ***Advertise Subnets:*** comma-separated IPv4 CIDR ranges, for example `10.10.0.0/24, 192.168.1.0/24`.
   * ***Advertise DNS Routes:*** comma-separated names. An exact name matches only itself; a wildcard such as `*.example.com` matches its subdomains.
   * When the installer detects the DNS domain of the machine, it offers "The DNS domain {0} was detected. Advertise its subdomains as {1}?" Select it to add that wildcard route.
5. Complete the installation.

The installer enrolls the agent, writes the routes you entered, then tests the UDP connection to the gateway. If the enrollment or the UDP test fails, the installation stops with the reason and nothing is changed, so you can fix the network and run the installer again.

{% hint style="info" %}
Enter the subnets you want to advertise. If you leave ***Advertise Subnets:*** empty, the agent advertises no subnet and only targets that match a DNS route can be reached through it.
{% endhint %}
{% endtab %}

{% tab title="Silent installation" %}
Add `F.Tunnel` to `ADDLOCAL` and pass the enrollment string and the routes as properties:

<table><thead><tr><th width="320">PROPERTY</th><th>VALUE</th></tr></thead><tbody><tr><td><code>AGENT_TUNNEL_ENROLLMENT_STRING</code></td><td>The enrollment string. Required with <code>F.Tunnel</code>.</td></tr><tr><td><code>AGENT_TUNNEL_ADVERTISE_SUBNETS</code></td><td>Comma-separated IPv4 CIDR ranges.</td></tr><tr><td><code>AGENT_TUNNEL_ADVERTISE_DOMAINS</code></td><td>Comma-separated exact names or <code>*.</code> wildcards.</td></tr><tr><td><code>AGENT_TUNNEL_INCLUDE_DETECTED_DOMAIN</code></td><td><code>1</code> to also advertise the detected DNS domain of the machine as a wildcard route. Default <code>0</code>.</td></tr></tbody></table>

```powershell
msiexec /i DevolutionsAgent.msi /qn ADDLOCAL=F.Agent,F.Updater,F.Session,F.Tunnel AGENT_TUNNEL_ENROLLMENT_STRING=<enrollment-string> AGENT_TUNNEL_ADVERTISE_SUBNETS=10.10.0.0/24
```

{% hint style="warning" %}
A value typed on a command line, such as the enrollment string, is visible to other processes on the machine and can be kept by deployment tools in their logs. Use a short-lived enrollment string.
{% endhint %}

Without `AGENT_TUNNEL_ENROLLMENT_STRING`, the installation fails with "An enrollment string is required. Paste the enrollment string provided by your gateway operator, or deselect the Agent Tunnel feature." See [Deploy Devolutions Agent silently](https://docs.devolutions.net/agent/for-administrators/deploy/silent-install.md).
{% endtab %}

{% tab title="Command line (Windows and Linux)" %}
The `up` command enrolls an installed agent. Pass `-` as the enrollment string and paste the string on standard input, so it does not appear on the command line.

On Linux:

```bash
sudo devolutions-agent up --enrollment-string - --advertise-subnets 10.10.0.0/24 --advertise-domains "*.contoso.local"
sudo systemctl restart devolutions-agent
```

On Windows, in an elevated PowerShell:

```powershell
& "C:\Program Files\Devolutions\Agent\DevolutionsAgent.exe" up --enrollment-string - --advertise-subnets 10.10.0.0/24
Restart-Service DevolutionsAgent
```

<table><thead><tr><th width="300">OPTION</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><code>--enrollment-string &#x3C;string></code></td><td>The enrollment string, or <code>-</code> to read it from standard input. Required.</td></tr><tr><td><code>--gateway &#x3C;url></code></td><td>The Devolutions Gateway URL, for example <code>https://gateway.example.com:7171</code>. Optional: by default, the URL contained in the enrollment string is used.</td></tr><tr><td><code>--advertise-subnets &#x3C;cidr,...></code></td><td>Comma-separated IPv4 CIDR ranges. <code>--advertise-routes</code> is accepted as the same option.</td></tr><tr><td><code>--advertise-domains &#x3C;name,...></code></td><td>Comma-separated exact names or <code>*.</code> wildcards. When you enroll an agent again without this option, its existing DNS routes are kept.</td></tr></tbody></table>

To test the UDP path to the gateway with the current configuration, run `devolutions-agent probe` (on Windows, `DevolutionsAgent.exe probe`). It waits up to 15 seconds and reports "Connectivity probe failed" when the gateway does not answer.

Restart the service after the enrollment: Devolutions Agent reads its configuration only when it starts.
{% endtab %}
{% endtabs %}

## Check that the agent is connected

In Devolutions Server or Devolutions Cloud, open the ***Agent tunnel*** dialog of the gateway. The agent appears with its ***Name***, ***Status*** (***Online*** or ***Offline***), ***Subnets***, ***Domains*** and ***Last seen*** time. Click ***Refresh*** to update the list.

On the agent machine, the Devolutions Agent log shows "Gateway QUIC endpoint is reachable" after a successful probe, and "Tunnel connection lost" then "Reconnecting after backoff" when the connection drops. The agent reconnects automatically, waiting from 1 to 60 seconds between attempts.

## Choose the agent for an entry (Devolutions Cloud)

In Devolutions Cloud, an entry that goes through a gateway has an ***Agent*** field:

* ***Automatic***: "The gateway picks the agent whose advertised subnets or domains match the destination."
* A specific agent: "Sessions always go through this agent. If it is offline or cannot reach the destination, the session fails instead of taking another route."

Choosing an agent is not available in these cases:

* The gateway is a farm: "Choosing an agent is not supported when the gateway is a farm. Select a gateway that is not part of a farm."
* The entry uses the default gateway: "Choosing an agent is not supported with the default gateway. Select a specific gateway to choose an agent."

A specific agent works only through the gateway it is enrolled with. Devolutions Cloud warns: "This agent only exists on this gateway. Sessions through an alternate gateway fail."

The Devolutions Server web interface has no ***Agent*** field: the gateway picks the agent whose routes match the destination.

## Settings in agent.json

The enrollment writes the `Tunnel` section of `agent.json` and the certificates in the `certs` folder of the Devolutions Agent data folder (`C:\ProgramData\Devolutions\Agent\certs` on Windows, `/etc/devolutions-agent/certs` on Linux). On Windows, the private key file grants full control to SYSTEM and the Administrators group, and read, write and delete access to NETWORK SERVICE and to the account that ran the enrollment. On Linux, only the owner of the file can read and write it. Protect the private key file: it identifies the agent to Devolutions Gateway. You can change the routes by hand, then restart the service.

<table><thead><tr><th width="300">SETTING</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><code>Tunnel.Enabled</code></td><td>Turns the Agent Tunnel on. Set to <code>true</code> by the enrollment.</td></tr><tr><td><code>Tunnel.GatewayEndpoint</code></td><td>The QUIC endpoint of the gateway, <code>host:port</code>, for example <code>gateway.example.com:4433</code>. An IPv6 address goes in brackets, for example <code>[2001:db8::1]:4433</code>. Written by the enrollment.</td></tr><tr><td><code>Tunnel.AdvertiseSubnets</code></td><td>IPv4 CIDR ranges the agent makes reachable, for example <code>["10.0.0.0/8"]</code>.</td></tr><tr><td><code>Tunnel.AdvertiseDomains</code></td><td>DNS routes, for example <code>["server.contoso.local", "*.contoso.local"]</code>.</td></tr><tr><td><code>Tunnel.AutoDetectDomain</code></td><td>When <code>AdvertiseDomains</code> is empty, advertises the DNS domain of the machine as a wildcard route. The enrollment sets it to <code>false</code>.</td></tr><tr><td><code>Tunnel.HeartbeatIntervalSecs</code>, <code>Tunnel.RouteAdvertiseIntervalSecs</code></td><td>Seconds between heartbeats (default 60) and route advertisements (default 30). Both must be greater than zero, and at least one must be 30 seconds or less.</td></tr><tr><td><code>Tunnel.ClientCertPath</code>, <code>Tunnel.ClientKeyPath</code>, <code>Tunnel.GatewayCaCertPath</code>, <code>Tunnel.ServerSpkiSha256</code></td><td>Certificate files and gateway key written by the enrollment. Do not edit them; enroll again instead.</td></tr></tbody></table>

## Remove an agent

1. In the ***Agent tunnel*** dialog of the gateway, select the agent, click ***Delete*** and confirm "Do you want to delete this agent?".
2. On the agent machine, remove the ***Agent Tunnel*** feature with the installer, or set `Tunnel.Enabled` to `false` in `agent.json` and restart the service.

## Good to know

* **Enroll again** when the agent certificate has expired (the agent stayed disconnected for more than its lifetime), after you delete the agent from the gateway, or when the log shows that the gateway certificate no longer matches the one received at enrollment. Downgrading Devolutions Gateway can also require agents to enroll again.
* **Kerberos through an agent** works only with a `tcp://` KDC address.
* **Proxy settings** in the `Proxy` section of `agent.json` apply to the updater downloads, not to the Agent Tunnel. The agent must reach the gateway directly.
* **Docker:** the `devolutions/devolutions-agent` image rewrites `agent.json` at every start, so an enrollment made inside a container is lost when it restarts.

## Messages

<table><thead><tr><th width="360">MESSAGE</th><th>WHAT TO DO</th></tr></thead><tbody><tr><td>"Agent tunnel enrollment timed out. Verify your Devolutions Gateway is reachable from this machine."</td><td>Check HTTPS access from the agent machine to the gateway URL.</td></tr><tr><td>"Agent tunnel enrollment failed: {detail}"</td><td>Read the detail. An expired or already used enrollment string, or an agent name already registered on the gateway, is refused: generate a new string.</td></tr><tr><td>"Agent tunnel connectivity probe timed out. The agent can't reach the Devolutions Gateway over UDP/QUIC (port 4433); check that the firewall allows it."</td><td>Allow outbound UDP from the agent to the gateway Agent Tunnel port, and inbound UDP on the gateway.</td></tr><tr><td>"Agent tunnel connectivity probe failed: the agent could not establish the QUIC/UDP tunnel to the Devolutions Gateway (port 4433). If UDP is blocked, open it on the firewall. {detail}"</td><td>Allow outbound UDP from the agent to the gateway Agent Tunnel port, and inbound UDP on the gateway. Read the detail for the cause.</td></tr><tr><td>"The installer was asked to advertise the detected DNS domain, but no DNS domain could be detected on this machine."</td><td>Remove <code>AGENT_TUNNEL_INCLUDE_DETECTED_DOMAIN=1</code> and list the DNS routes in <code>AGENT_TUNNEL_ADVERTISE_DOMAINS</code>.</td></tr><tr><td>"Invalid advertised DNS route: {route}"</td><td>Use exact names or <code>*.</code> wildcards, separated by commas.</td></tr><tr><td>"[ERROR] Enrollment failed: …"</td><td>The command-line enrollment failed. Read the detail.</td></tr><tr><td>"No server SPKI pin configured — re-enroll to enable pinning" (log)</td><td>Enroll the agent again.</td></tr><tr><td>"server SPKI hash does not match pinned value from enrollment" (log)</td><td>The gateway certificate changed since the enrollment. Enroll the agent again.</td></tr><tr><td>"This agent is offline. Sessions fail until it reconnects." (Devolutions Cloud entry)</td><td>Check that the agent service runs and can reach the gateway over UDP.</td></tr><tr><td>"This agent is no longer enrolled on this gateway. Sessions fail until you choose another agent." (Devolutions Cloud entry)</td><td>Choose another agent or <em><strong>Automatic</strong></em>, or enroll the agent again.</td></tr></tbody></table>

## Next

* [Agent tunnel in Devolutions Gateway](https://docs.devolutions.net/gateway/guides/connect/agent-tunnel)
* [Configuration file (agent.json)](https://docs.devolutions.net/agent/reference/configuration.md)
* [Command-line interface](https://docs.devolutions.net/agent/reference/command-line.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/agent/guides/agent-tunnel.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
