# Dynamic IP and CGNAT

Source: https://openpanel.sh/docs/servers/dynamic-ip-cgnat

A home server behind CGNAT or a changing address connects with One command. For the SSH setup, keep it reachable with a dynamic-DNS name, and what to ask your internet provider.

At home or in an office, two things can get in the way of a server: a public address that changes, and a provider that shares one public address between many customers (CGNAT).

**With [One command](/docs/servers#one-command), neither matters.** The OpenPanel agent only connects out, so a server behind CGNAT or on a changing address connects and keeps working with nothing forwarded. When the address changes, the agent reconnects on its own. The rest of this page is for the [SSH setup](/docs/servers#connect-over-ssh), where OpenPanel signs in to the server from the internet.

## A public address that changes [#a-public-address-that-changes]

Many internet providers give a home connection a dynamic address that changes from time to time, often after the router restarts. For the SSH setup, OpenPanel cannot change the address of a connected server afterwards, so do not enter an address that will change.

Use a **dynamic-DNS name** instead: a host name that always points at your current address.

1. Turn on dynamic DNS in your router's settings. Many routers have it built in, under names like Dynamic DNS or DDNS, with a list of supported services.
2. Wait until the name resolves to your current public address. Compare it with [ifconfig.me](https://ifconfig.me).
3. Enter the name, not the address, as **Public IP address or host name** when you connect the server.

OpenPanel keeps the name as you typed it and resolves it again every time it signs in. The name must resolve to a public address; a private one is refused.

Use the router's dynamic DNS rather than a program on the server. The server must be fresh when you connect it over SSH, and after the setup SSH accepts only OpenPanel's key.

The server's address in your [private network](/docs/network) stays the same when your public address changes.

## CGNAT [#cgnat]

With carrier-grade NAT (CGNAT), your provider puts many customers behind one public address. Your router has no public address of its own, so nothing on the internet can reach your server, and port forwarding does not help. It is common on mobile, fixed-wireless and some fibre connections.

A server behind CGNAT connects with [One command](/docs/servers#one-command): its agent dials out to OpenPanel, and visitors reach your services through OpenPanel's edge and that same connection. Only the SSH setup needs the server to be reachable from the internet.

### How to recognise it [#how-to-recognise-it]

1. Open your router's status page and note its internet (WAN) address.
2. Open [ifconfig.me](https://ifconfig.me) from a computer in the same network.

| What you see | What it means |
|---|---|
| Both addresses are the same | You have a public address. Port forwarding works. |
| The router's address starts with `100.64.` to `100.127.` | CGNAT. Those addresses (`100.64.0.0/10`) are reserved for it. |
| The router's address is private (`10.x`, `172.16.x` to `172.31.x`, `192.168.x`) | Another router sits in front of yours: either your provider's (CGNAT) or a second router of your own. See [Two routers in a row](/docs/servers/port-forwarding#two-routers-in-a-row). |
| The addresses differ in another way | Most likely CGNAT. Ask your provider. |

If you enter an address from `100.64.0.0/10` in the SSH form, OpenPanel answers "That address is private or reserved".

### If you want the SSH setup anyway [#if-you-want-the-ssh-setup-anyway]

The SSH setup needs a public address. Ask your provider for **a public IPv4 address** for your connection. Providers call it a public IP, a static IP, a dedicated IP, or "taking the line off CGNAT". Some give it on request, some charge for it, and some cannot offer it on every kind of line. A static address also saves you the dynamic-DNS name.

Without one, connect the machine with [One command](/docs/servers#one-command), or run the server where it has a public address, for example at a [cloud provider](/docs/servers/cloud-server).