Skip to main content
If you’re behind carrier-grade NAT (CGNAT), port forwarding on your router doesn’t work. Your internet service provider (ISP) shares one public IP address across many customers, so inbound connections never reach your router. ngrok works around this without any router or network changes. The ngrok agent makes an outbound connection to ngrok’s cloud, and traffic to your public URL flows back through that connection.

What is CGNAT?

CGNAT (also called CGN or large-scale NAT) is a technique ISPs use to stretch their limited supply of IPv4 addresses. Your router doesn’t get its own public IP address. Instead, it gets a private address from your ISP, and the ISP translates traffic for many customers through a shared public IP. This works fine for outbound traffic like browsing and streaming. It breaks anything that needs inbound connections, such as:
  • Hosting a website, API, or app from home
  • SSH or remote desktop into a home machine
  • Self-hosted services like Home Assistant, Plex, or a network-attached storage (NAS) device
  • Game servers
  • Receiving webhooks on a local machine
CGNAT is common on satellite, fixed-wireless, and mobile networks, including Starlink residential plans, T-Mobile Home Internet, and many 5G and LTE home internet services.

How to tell if you’re behind CGNAT

  1. Find your router’s WAN (internet-facing) IP address in its admin page.
  2. Compare it to your public IP address, as reported by any “what is my IP” website.
If the two addresses differ, something upstream of your router is doing NAT. It’s almost certainly CGNAT if your router’s WAN IP is in the 100.64.0.0 to 100.127.255.255 range, which RFC 6598 reserves as shared address space for CGNAT.

Why port forwarding doesn’t work behind CGNAT

Port forwarding tells your router to send inbound traffic on a port to a device on your network. Behind CGNAT, inbound traffic first hits your ISP’s NAT, which doesn’t know which customer it belongs to, so it drops the traffic before it ever reaches your router. You can’t configure your ISP’s NAT, so no router setting can fix it. The usual workarounds are paying your ISP for a public or static IP (when they offer one), running your own virtual private server (VPS) as a relay, or using a tunnel that connects outbound, which is how ngrok works.

Expose a local service through CGNAT with ngrok

What you’ll need

1. Install and configure ngrok

Install ngrok using the method that works best for your system, then add your authtoken:

2. Expose a web app or API over HTTP

For anything that speaks HTTP, such as a web app, API, Home Assistant, or a dev server, start an HTTP endpoint pointed at its local port:
ngrok prints a public HTTPS URL that forwards to localhost:8080. You don’t need to change your network or router. On the free plan, your account’s dev domain stays the same across restarts, so the URL doesn’t change.

3. Expose SSH, RDP, or other TCP services

For non-HTTP services such as SSH, remote desktop (RDP), databases, or game servers, use a TCP endpoint:
ngrok prints an address like tcp://1.tcp.ngrok.io:12345. Connect to it the same way you’d connect to the service directly, for example:
On the free plan, you can use TCP endpoints only after you add a valid payment method to your account.

4. Restrict who can reach it

Anyone with your public URL can reach it. Before you expose anything sensitive, add authentication or an IP allowlist with a Traffic Policy, so your service isn’t open to the whole internet.

Frequently asked questions

Does ngrok work behind CGNAT?

Yes. The ngrok agent only makes outbound connections, which CGNAT allows, so it works without a public IP, port forwarding, or router access. Yes. Starlink residential plans use CGNAT, which blocks port forwarding. ngrok’s outbound connection works on Starlink without any configuration.

Can I port forward without router access?

Not with traditional port forwarding, which requires you to configure the router. ngrok gives you the same result, a public address that reaches a local port, without touching the router.

Do I need a static or public IP address?

No. ngrok gives your service a public URL or TCP address, so your own IP address doesn’t matter and can change.

Can I use this for OpenVPN?

Yes. See Using ngrok with OpenVPN to tunnel an OpenVPN server through CGNAT.

Learn more