Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ pcx_content_type: reference
title: Tunnel run parameters
sidebar:
order: 4

---

import { Render } from "~/components";

This page lists general-purpose configuration options that you can [add](/cloudflare-one/connections/connect-networks/configure-tunnels/cloudflared-parameters/#update-tunnel-run-parameters) to the `cloudflared tunnel run` command.

Alternatively, if you are running a [locally-managed tunnel](/cloudflare-one/connections/connect-networks/do-more-with-tunnels/local-management/) you can add these flags to your [configuration file](/cloudflare-one/connections/connect-networks/do-more-with-tunnels/local-management/configuration-file/) as key/value pairs.
Expand Down Expand Up @@ -49,7 +50,7 @@ The IP version of `edge-bind-address` will override [`edge-ip-version`](#edge-ip

| Syntax | Default | Environment Variable |
| ------------------------------------------------------------------- | ------- | ------------------------ |
| `cloudflared tunnel --edge-ip-version <VERSION> run <UUID or NAME>` | `4` | `TUNNEL_EDGE_IP_VERSION` |
| `cloudflared tunnel --edge-ip-version <VERSION> run <UUID or NAME>` | `4` | `TUNNEL_EDGE_IP_VERSION` |

Specifies the IP address version (IPv4 or IPv6) used to establish a connection between `cloudflared` and the Cloudflare global network. Available values are `auto`, `4`, and `6`.

Expand Down Expand Up @@ -81,14 +82,20 @@ Specifies the verbosity of logging for the local `cloudflared` instance. Availab

## `metrics`

| Syntax | Default | Environment Variable |
| ----------------------------------------------------------- | ------------ | -------------------- |
| `cloudflared tunnel --metrics <IP:PORT> run <UUID or NAME>` | Refer to [Tunnel metrics](/cloudflare-one/connections/connect-networks/monitor-tunnels/metrics/)| `TUNNEL_METRICS` |
| Syntax | Default | Environment Variable |
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------- |
| `cloudflared tunnel --metrics <IP:PORT> run <UUID or NAME>` | Refer to [Tunnel metrics](/cloudflare-one/connections/connect-networks/monitor-tunnels/metrics/) | `TUNNEL_METRICS` |

Exposes a Prometheus endpoint on the specified IP address and port, which you can then query for [usage metrics](/cloudflare-one/connections/connect-networks/monitor-tunnels/metrics/).

## `no-autoupdate`

:::note

Does not apply if you installed `cloudflared` using a package manager. <Render file="tunnel/package-manager" product="cloudflare-one" />

:::

| Syntax | Environment Variable |
| ------------------------------------------------------- | -------------------- |
| `cloudflared tunnel --no-autoupdate run <UUID or NAME>` | `NO_AUTOUPDATE` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 5
---

import { TabItem, Tabs } from "~/components";
import { TabItem, Tabs, Render } from "~/components";

Updates will cause `cloudflared` to restart which will impact traffic currently being served. You can perform zero-downtime upgrades by using Cloudflare's [Load Balancer product](/cloudflare-one/connections/connect-networks/downloads/update-cloudflared/#update-with-cloudflare-load-balancer) or by using [multiple `cloudflared` instances](/cloudflare-one/connections/connect-networks/downloads/update-cloudflared/#update-with-multiple-cloudflared-instances).

Expand Down Expand Up @@ -58,7 +58,7 @@ 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.
<Render file="tunnel/package-manager" product="cloudflare-one" />

1. Update the `cloudflared` package:

Expand Down Expand Up @@ -103,7 +103,7 @@ If you installed `cloudflared` from GitHub-provided binaries or from source, run
cloudflared update
```

If you installed `cloudflared` with a package manager, you must update it using the same package manager. 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.
If you installed `cloudflared` with a package manager, you must update it using the same package manager. <Render file="tunnel/package-manager" product="cloudflare-one" />

</TabItem> </Tabs>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Follow this guide to set up a Cloudflare Tunnel using the API.

[Create an API token](/fundamentals/api/get-started/create-token/) with the following permissions:

| Type | Item | Permission |
| ------- | ---------------- | ---------- |
| Account | Cloudflare Tunnel | Edit |
| Zone | DNS | Edit |
| Type | Item | Permission |
| ------- | ----------------- | ---------- |
| Account | Cloudflare Tunnel | Edit |
| Zone | DNS | Edit |

## 2. Create a tunnel

Make a `POST` request to the [Cloudflare Tunnel](/api/resources/zero_trust/subresources/access/subresources/applications/methods/create/) endpoint:
Make a `POST` request to the [Cloudflare Tunnel](/api/resources/zero_trust/subresources/tunnels/subresources/cloudflared/methods/create/) endpoint:

```sh
curl 'https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/cfd_tunnel' \
Expand Down Expand Up @@ -76,47 +76,48 @@ Follow these steps to connect an application through your tunnel. If you are loo

1. Make a [`PUT` request](/api/resources/zero_trust/subresources/tunnels/subresources/cloudflared/subresources/configurations/methods/update/) to route your local service URL to a public hostname. For example,

```sh
curl --request PUT \
'https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/cfd_tunnel/c1744f8b-faa1-48a4-9e5c-02ac921467fa/configurations' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--data '{
"config": {
"ingress": [
{
"hostname": "app.example.com",
"service": "http://localhost:8001",
"originRequest": {}
},
{
"service": "http_status:404"
}
]
}
}'
```

:::note
If you add a multi-level subdomain (more than one level of subdomain), you must [order an Advanced Certificate for the hostname](/cloudflare-one/faq/troubleshooting/#i-see-this-site-cant-provide-a-secure-connection).
:::

Your ingress rules must include a catch-all rule at the end. In this example, `cloudflared` will respond with a 404 status code when the request does not match any of the previous hostnames.
```sh
curl --request PUT \
'https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/cfd_tunnel/c1744f8b-faa1-48a4-9e5c-02ac921467fa/configurations' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--data '{
"config": {
"ingress": [
{
"hostname": "app.example.com",
"service": "http://localhost:8001",
"originRequest": {}
},
{
"service": "http_status:404"
}
]
}
}'
```

:::note
If you add a multi-level subdomain (more than one level of subdomain), you must [order an Advanced Certificate for the hostname](/cloudflare-one/faq/troubleshooting/#i-see-this-site-cant-provide-a-secure-connection).
:::

Your ingress rules must include a catch-all rule at the end. In this example, `cloudflared` will respond with a 404 status code when the request does not match any of the previous hostnames.

2. [Create a DNS record](/api/resources/dns/subresources/records/methods/create/) for your application:
```sh
curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--data '{
"type": "CNAME",
"proxied": true,
"name": "app.example.com",
"content": "c1744f8b-faa1-48a4-9e5c-02ac921467fa.cfargotunnel.com"
}'
```

This DNS record allows Cloudflare to proxy `app.example.com` traffic to your Cloudflare Tunnel (`<tunnel-id>.cfargotunnel.com`).

```sh
curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--data '{
"type": "CNAME",
"proxied": true,
"name": "app.example.com",
"content": "c1744f8b-faa1-48a4-9e5c-02ac921467fa.cfargotunnel.com"
}'
```

This DNS record allows Cloudflare to proxy `app.example.com` traffic to your Cloudflare Tunnel (`<tunnel-id>.cfargotunnel.com`).

This application will be publicly available on the Internet once you [run the tunnel](#4-install-and-run-the-tunnel). To allow or block specific users, [create an Access application](/cloudflare-one/applications/configure-apps/self-hosted-public-app/).

Expand All @@ -143,45 +144,46 @@ Install `cloudflared` on your server and run the tunnel using the `token` value

<Tabs> <TabItem label="Windows">

1. [Download and install](/cloudflare-one/connections/connect-networks/downloads/#windows) `cloudflared`.
1. [Download and install](/cloudflare-one/connections/connect-networks/downloads/#windows) `cloudflared`.

2. Open Command Prompt as administrator.
2. Open Command Prompt as administrator.

3. Run the following command:
3. Run the following command:

```txt
cloudflared.exe service install <tunnel-token>
```
```txt
cloudflared.exe service install <tunnel-token>
```

</TabItem> <TabItem label="macOS">

1. [Download and install](/cloudflare-one/connections/connect-networks/downloads/#macos) `cloudflared`.
1. [Download and install](/cloudflare-one/connections/connect-networks/downloads/#macos) `cloudflared`.

2. Run the following command:
2. Run the following command:

```sh
sudo cloudflared service install <tunnel-token>
```
```sh
sudo cloudflared service install <tunnel-token>
```

</TabItem> <TabItem label="Linux">

1. [Download and install](https://pkg.cloudflare.com/index.html) `cloudflared`.
1. [Download and install](https://pkg.cloudflare.com/index.html) `cloudflared`.

2. Run the following command:
2. Run the following command:

```sh
sudo cloudflared service install <tunnel-token>
```
```sh
sudo cloudflared service install <tunnel-token>
```

</TabItem> <TabItem label="Docker">

1. Open a terminal window.
1. Open a terminal window.

2. Run the following command:

2. Run the following command:
```sh
docker run cloudflare/cloudflared:latest tunnel --no-autoupdate run --token <tunnel-token>
```

```sh
docker run cloudflare/cloudflared:latest tunnel --no-autoupdate run --token <tunnel-token>
```
</TabItem> </Tabs>

## 5. Verify tunnel status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar:

import { Render } from "~/components";

Follow this step-by-step guide to get your first tunnel up and running using Zero Trust.
Follow this step-by-step guide to create your first [remotely-managed tunnel](/cloudflare-one/connections/connect-networks/get-started/tunnel-useful-terms/#remotely-managed-tunnel) using Zero Trust.

## 1. Create a tunnel

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
{}

---

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.