|
| 1 | +--- |
| 2 | +pcx_content_type: how-to |
| 3 | +title: Connect a private hostname |
| 4 | +sidebar: |
| 5 | + order: 2 |
| 6 | +--- |
| 7 | + |
| 8 | +import { Render } from "~/components"; |
| 9 | + |
| 10 | +`cloudflared` can route to non-HTTP applications on your private network using their private hostname (for example, `wiki.internal.local`). Private hostname routes are especially useful when the application has an unknown or ephemeral IP, which often occurs when infrastructure is provisioned by a third-party cloud provider. |
| 11 | + |
| 12 | +:::note[Availability] |
| 13 | +Hostname routes currently require Gateway resolver policies, an Enterprise-only feature. If you are on a Free or Pay-as-you-go plan, you will need to connect the application using its [IP address](/cloudflare-one/connections/connect-networks/private-net/cloudflared/connect-cidr) and [configure Local Domain Fallback](/cloudflare-one/connections/connect-networks/private-net/cloudflared/private-dns/) to resolve its private hostname. |
| 14 | +::: |
| 15 | + |
| 16 | +## Limitations |
| 17 | + |
| 18 | +### Supported user traffic |
| 19 | + |
| 20 | +### Supported network on-ramps |
| 21 | + |
| 22 | +## How private hostname routing works |
| 23 | + |
| 24 | +Private hostname routing with Cloudflare Tunnel consists of three main components: |
| 25 | + |
| 26 | +- The WARP client installs on the user device and forwards network and DNS traffic from the device to Cloudflare Gateway. |
| 27 | +- Gateway resolver policies instruct Gateway to resolve the private hostname using your internal DNS resolver instead of the default public resolver. |
| 28 | +- `cloudflared` installs on a host machine in your private network and proxies traffic from Cloudflare to your internal DNS resolver and internal applications. |
| 29 | + |
| 30 | +Figures 1 and 2 illustrate what happens when a user connects to a private hostname (`wiki.internal.local`) from a WARP device. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +1. The WARP client sends the DNS query to the Gateway resolver for resolution. |
| 35 | +2. Based on the configured resolver policies, Gateway determines that `wiki.internal.local` should be resolved by a custom DNS resolver. Therefore, Gateway sends the DNS request down Cloudflare Tunnel to the private network where the custom DNS resolver is located. |
| 36 | +3. `cloudflared` does a DNS lookup to figure out what the origin IP is for `wiki.internal.local`. |
| 37 | +4. The Gateway resolver now knows that the origin IP is `10.0.0.5`. |
| 38 | +5. Rather than responding to the DNS query with the actual origin IP, Gateway responds with a random IP address from the CGNAT range `100.80.0.0/16` (for example, `100.80.0.1`). This CGNAT IP is called the initial resolved IP. |
| 39 | +6. Gateway stores the mapping between the private hostname, CGNAT initial resolved IP, and the actual IP. |
| 40 | +7. The WARP client receives the initial resolved IP (`100.80.0.1`) in the DNS response for `wiki.internal.local`. |
| 41 | + |
| 42 | +As shown in Figure 2 below, the WARP client will now send `wiki.internal.local` traffic to the initial resolved IP through Gateway. Because the destination IP falls within the designated CGNAT range, Gateway knows how it maps to the actual origin IP. Traffic that passes your network policies will now route through Cloudflare Tunnel to the private application. |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +To learn more about the initial resolved IP mechanism, refer to the [Cloudflare blog](). |
| 47 | + |
| 48 | +## Configure a private hostname route |
| 49 | + |
0 commit comments