Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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,7 +3,6 @@ pcx_content_type: reference
title: Tunnel run parameters
sidebar:
order: 4

---

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.
Expand Down Expand Up @@ -49,7 +48,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 +80,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

For locally-managed tunnels and Windows [remotely-managed tunnels](/cloudflare-one/connections/connect-networks/get-started/tunnel-useful-terms/#remotely-managed-tunnel) only.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd frame this in terms of package manager vs no package manager. Technically no-autoupdate would also work for non-Windows tunnels if you didn't use a package manager.

Does not apply if you installed cloudflared using a package manager (for example, by following the macOS or Debian installation instructions in the dashboard). You can check if cloudflared was installed by a package manager by running ls -la /usr/local/etc/cloudflared/ and looking for .installedFromPackageManager appears in the output. If so, disable auto-update in the package manager.

Consider making a partial out of the matching sentence in https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/update-cloudflared/#remotely-managed-tunnels


:::

| 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 @@ -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
Loading