How to Connect Cloudflare Tunnel to Synology NAS

Published: Updated:
3 min read 423 words
Banner

Connecting your Synology NAS to a Cloudflare Tunnel enables secure access to local services without opening router ports. By leveraging the Cloudflare Zero Trust ecosystem, you can route traffic through an encrypted tunnel, eliminating the need for complex firewall rules or traditional VPNs.

Prerequisites

  • A Cloudflare account with a configured domain.
  • A Synology NAS running DSM 7.2 or higher (required for Container Manager).
  • Cloudflare Zero Trust enabled on your account.

Step-by-Step Configuration

1. Install Container Manager

Log in to Synology DSM, open the Package Center, and search for Container Manager (formerly the Docker package). Click Install if the package is not currently active on your system. img

2. Download the cloudflared Image

Open Container Manager, navigate to the Registry tab, and search for cloudflared. Locate the official image (typically cloudflare/cloudflared) and click Download. Select the latest tag when prompted.

3. Create the Container

Once the download is complete, switch to the Image tab. Select cloudflare/cloudflared and click Run to launch the container creation wizard.

4. Configure Network Settings

During network configuration, select “Use the same network as Docker Host” (Host mode). This setting enables the container to communicate directly with your NAS services using localhost or the NAS’s internal IP address, removing the need for manual port mapping.

5. Set the Execution Command

Locate the Execution Command field within the General Settings or Advanced Settings section. You must replace the default command with the following, inserting your specific tunnel token:

tunnel run --token <your-unique-token>

NOTE

You must generate this token in your Cloudflare Zero Trust dashboard under Networks > Tunnels.

6. Route Your Services

With the container running, return to the Cloudflare Zero Trust dashboard to finalize the connection:

  1. Navigate to your tunnel and select Public Hostnames.
  2. Add a new hostname (e.g., nas.yourdomain.com).
  3. Set the Service Type to HTTP or HTTPS.
  4. Enter your NAS’s local IP address and port in the URL field (e.g., 192.168.1.100:5000).

Security Best Practices

  • Token Security: Treat your tunnel token with the same security as a password. Possession of this token grants connection access to your internal network.
  • Access Policies: Avoid exposing services directly to the open web. Implement Cloudflare Access Policies to mandate authentication—such as email PINs, OIDC, or GitHub—before users can access the Synology login interface.
  • Keep Images Updated: Periodically check Container Manager for updates to the cloudflared image to ensure your setup includes the latest security patches.

References

YouTube

Further reading
previous
How to automatically load node version based on nvmrc file
How to automatically load node version based on nvmrc file
next
How to create an Awesome List
How to create an Awesome List