# Why MongoDB Atlas Rejects Your Connection on Mobile Data (and How to Fix It)

> Atlas connection timing out on cellular? Learn how the MongoDB Atlas IP Access List works, why mobile IPs change, and how to fix it with temporary entries or a VPN.

Source: https://bussolaformongo.app/blog/atlas-ip-access-list-mobile/ · 2026-10-08

If your Atlas connection works on office Wi-Fi but fails on mobile data, the cause is almost always the **MongoDB Atlas IP Access List**. Atlas drops connections from any public address that is not on the project's list, and your carrier gave your phone an address that is not there. The fix is to add your current public IP as a temporary entry, or to route the phone through a VPN with a fixed exit address and allow only that one. The rest of this article explains how to recognize the problem, why mobile addresses make it recurring, and how to fix it without opening the cluster to the world.

## The symptom: a timeout, not an authentication error

The IP Access List works at the network level. Atlas does not answer a connection from an address that is not allowed, so the client never gets far enough to try your credentials. You will not see `Authentication failed`. You will see the driver waiting and then giving up with a server selection error. In `mongosh` it looks like this:

```text
MongoServerSelectionError: Server selection timed out after 30000 ms
```

Drivers phrase it differently, but the shape is the same: a timeout while selecting a server, often mentioning each shard host with an unknown state. In the Node driver, the error message lists the servers it tried with `type: Unknown`.

Compare that with problems that look similar:

| What you see | Likely cause |
| --- | --- |
| Server selection timeout, works on another network | IP Access List (this article) |
| `Authentication failed` / `bad auth` | Wrong user, password or `authSource` |
| `querySrv ENOTFOUND` or `ECONNREFUSED` on `_mongodb._tcp` | DNS cannot resolve the SRV record on that network |
| TLS or certificate errors | Interception by a proxy, or a self-hosted server with a non-public CA |

The key clue is the contrast: same connection string, same credentials, different network, different result. If it works on Wi-Fi and times out on cellular, the credentials are fine.

## Why mobile IP addresses make this worse

On a laptop at a fixed office, you add the office's public IP once and forget it. A phone breaks every assumption behind that:

- **The address changes with the network.** Home Wi-Fi, office Wi-Fi, a café and cellular each present a different public address.
- **Cellular addresses are not stable.** Carriers assign them dynamically, and your address can change when the radio reconnects, when you move between cells, or after toggling airplane mode.
- **Carrier-grade NAT (CGNAT) is common.** Many carriers put thousands of subscribers behind a shared pool of public addresses. Your phone's own address is private, and what Atlas sees is the carrier's shared address. That address may be fine to allow temporarily, but it is shared with strangers, and it can change between one connection and the next.

The result is that an entry that worked yesterday on cellular may not match today. Treat any mobile address as short-lived.

## Step 1: find the public IP Atlas sees

The address shown in your phone's network settings is usually a private one, so it is not what you need. You need the public address the outside world sees. Open any "what is my IP" page in Safari on the phone while on the same network you want to use, or from a terminal that shares that network:

```bash
curl https://api.ipify.org
```

Run it on the network you are troubleshooting. Running it on your laptop's Wi-Fi tells you nothing about your phone's cellular address. If you tether a laptop to the phone's hotspot, the laptop and phone share the same exit address, which makes that a convenient way to check from a real terminal.

## Step 2: add a temporary entry

In the Atlas UI, go to **Network Access** for the project and choose to add an IP address. You can enter a single address in CIDR form (`203.0.113.25/32`), give it a comment so you remember why it exists, and set it to expire after a period of time. Atlas supports entries that are removed automatically, so a forgotten entry does not stay open forever. The exact labels and the available durations may differ from what I describe here, so check the current dialog.

If you prefer automation, the Atlas CLI and the Atlas Administration API can create access list entries too. With the Atlas CLI, the command group is `atlas accessLists`:

```bash
atlas accessLists create 203.0.113.25 \
  --type ipAddress \
  --comment "on-call from phone" \
  --deleteAfter 2026-10-09T00:00:00Z
```

Run `atlas accessLists create --help` to confirm the flags in your installed version. The `--deleteAfter` option is what makes the entry temporary.

New entries are not instant. Atlas needs a short while to apply the change, and the Atlas UI shows the entry as pending until it is active. If you retry immediately and still time out, wait a moment before assuming it did not work.

After adding the entry, test from the phone again. If the connection still times out, check whether the phone's address changed in the meantime by repeating Step 1.

## Step 3: use a VPN with a fixed exit IP for recurring access

If you check the cluster from your phone regularly, editing the list each time becomes a chore, and a CGNAT address you cannot control is a poor thing to allow permanently. A better pattern:

1. Run or subscribe to a VPN whose exit address is fixed and belongs to you or your organization.
2. Connect the phone to that VPN profile.
3. Add only that exit address to the IP Access List, ideally with a descriptive comment.

Now the phone looks identical on Wi-Fi, cellular and hotel networks, and the list contains one auditable entry instead of a series of one-off carrier addresses. Whether you operate the VPN yourself or buy a service with a dedicated IP is your decision, but a shared-exit VPN with rotating addresses brings you back to the original problem, and allows other customers of that VPN through.

## Why not just allow 0.0.0.0/0?

Atlas lets you allow access from anywhere by adding `0.0.0.0/0`. It makes the timeout vanish, which is exactly why it is tempting. It is also the wrong answer for anything holding real data. With the network layer open, the only thing between the internet and your cluster is a username and password, and public clusters are scanned and probed for weak credentials constantly.

If you must use it to confirm a diagnosis, do it as a deliberate, short-lived experiment: add `0.0.0.0/0` with an expiry of an hour or less, confirm that the connection works, then remove it and add the specific address you found in Step 1. For production, do not leave it in place. For a broader setup that pairs network rules with a read-only user and bounded queries, see [How to Safely Query a Production MongoDB From Your Phone](/blog/query-production-mongodb-from-phone-safely/).

## Checking from the other side

When the cause is unclear, narrow it down with a few quick tests.

**Same string, different network.** Take the exact connection string and try it from a laptop on a network you already allowed. If that works and the phone fails, it is the access list (or DNS on the phone's network).

**Check the Atlas access list for what is active.** Look at Network Access and confirm the entry you expect is active, not expired and not pending. Expired temporary entries are a common reason a setup that worked last week stops working.

**Check DNS separately.** A `mongodb+srv://` string needs SRV and TXT lookups before any connection is attempted. If those fail you will see a DNS error rather than a server selection timeout, which is a different problem. You can test it from a terminal:

```bash
dig +short SRV _mongodb._tcp.cluster0.example.mongodb.net
```

**Check that the cluster is not paused.** A paused cluster also produces timeouts. The cluster page in Atlas shows its state.

## Using a direct mobile client

A native client that talks to the database directly, such as [Bussola](/) for iPhone, has the same constraint as any other client: the phone's address must be on the list, because there is no intermediary server whose fixed address you could allow instead. That is also why no backend means no fixed address to allow, and the VPN approach above is the practical answer. Bussola resolves `mongodb+srv://` records using the iOS system resolver with a public DNS fallback, so a DNS failure is less likely than an access list problem, and a server selection timeout on cellular should point you straight back to Step 1.

## Checklist

- Confirm the symptom: timeout, not an authentication error, and it works on another network.
- Find the public IP of the network you are on, not the private address shown in settings.
- Add it to the Atlas IP Access List as a `/32` entry with a comment and an expiry.
- Wait for the entry to become active, then retry.
- For regular use, route the phone through a VPN with a fixed exit IP and allow only that address.
- Do not leave `0.0.0.0/0` in a project with real data.
- If it still fails, check DNS resolution, cluster state and whether the temporary entry has expired.
