Skip to main content

Tunnel

Create a tunnel​

To create and manage tunnels, you will need to install and authenticate cloudflared on your origin server. cloudflared is what connects your server to Cloudflare’s global network.

  1. Log in to Zero Trust and go to Networks > Tunnels.

  2. Select Create a tunnel.

  3. Choose Cloudflared for the connector type and select Next.

  4. Enter a name for your tunnel. We suggest choosing a name that reflects the type of resources you want to connect through this tunnel (for example, enterprise-VPC-01).

  5. Select Save tunnel.

  6. Next, you will need to install cloudflared and run it. To do so, check that the environment under Choose an environment reflects the operating system on your machine, then copy the command in the box below and paste it into a terminal window. Run the command.

  7. Once the command has finished running, your connector will appear in Zero Trust.

alt text

  1. Select Next.

Connect an application​

  1. In the Public Hostnames tab, choose a Domain and specify any subdomain or path information.

  2. Specify a service, for example http://localhost.

  3. Under Additional application settings, specify any parameters you would like to add to your tunnel configuration.

  4. Select Save tunnel.

alt text

View your tunnel​

After saving the tunnel, you will be redirected to the Tunnels page. Look for your new tunnel to be listed along with its active connector.

alt text

Update your tunnel​

If installed via apt:

  1. Update the cloudflared package:
sudo apt-get upgrade cloudflared
  1. Restart the service:
sudo systemctl restart cloudflared.service

If installed manually via dpkg -i:

You can check if cloudflared was installed by a package manager by running ls -la /usr/local/etc/cloudflared/ and looking for .installedFromPackageManager in the output.

  1. Update the cloudflared package:
curl --location --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb
  1. Restart the service:
sudo systemctl restart cloudflared.service

Create a DNS record for the tunnel​

To create a new DNS record for your tunnel:

  1. Log in to the Cloudflare dashboard and select your account and domain.
  2. Go to DNS > Records.
  3. Select Add record.
  4. Input the following information:
  • Type: CNAME
  • Name: Subdomain of your application
  • IPv4 address: <Tunnel-ID>.cfargotunnel.com
  1. Select Save.

alt text