# Using Dynamic DNS in cPanel

> Keep a subdomain pointed at a home or office connection whose IP address changes, for CCTV, a home server or remote access, with cPanel's Dynamic DNS.

Source: https://helpcenter.ruachost.com/cpanel/domains/using-dynamic-dns-in-cpanel/

Most home and office internet connections get a new public IP address from time to time. **Dynamic DNS** keeps a subdomain, such as `office.example.com`, pointing at that connection, so you can always reach a device there (a CCTV recorder, a NAS, a home server or a remote desktop) by name instead of by IP address.

> **Note:**
Your domain must use Ruachost's nameservers, so the DNS is managed in your cPanel. See [Changing your nameservers](https://helpcenter.ruachost.com/domains/guides/how-to-change-domain-nameservers/).

## Step 1: Create the Dynamic DNS domain

1. Log in to cPanel and open **Dynamic DNS** under **Domains**.
2. Click **Create**.
3. Enter the **subdomain**, for example `office`, and choose your domain.
4. Optionally add a description, such as "Office CCTV".
5. Click **Create**.

cPanel shows a **webcall URL**, a secret address that updates the subdomain's IP address when it's visited. **Copy it** and keep it private: anyone with the URL can change where your subdomain points.

## Step 2: Visit the webcall URL from the connection you want to track

Whenever the webcall URL is visited **from your home or office network**, cPanel updates the subdomain to that network's current public IP address. Set something on that network to visit it regularly:

**A router or NAS.** Many routers and NAS devices have a **Custom DDNS** or **Dynamic DNS → Custom** option. Paste the webcall URL as the update URL.

**A computer that's always on.**

- **Linux or macOS:** add a cron job that runs every 15 minutes:

  ```bash
  */15 * * * * curl -s "WEBCALL_URL" > /dev/null
  ```

- **Windows:** create a scheduled task in **Task Scheduler** that runs every 15 minutes:

  ```powershell
  powershell -Command "Invoke-WebRequest -UseBasicParsing 'WEBCALL_URL'"
  ```

Replace `WEBCALL_URL` with your webcall URL.

## Step 3: Check it works

After the first update, `office.example.com` points to your network's public IP address. Check with:

```bash
nslookup office.example.com
```

Compare it with your IP address (search "what is my IP" from that network). DNS changes can take a few minutes to show.

## Good to know

- **Port forwarding:** Dynamic DNS only points the name at your connection. To reach a device behind your router, you also need to set up port forwarding on the router, and the device should be protected with a strong password.
- **CGNAT:** some mobile and fibre providers share one public IP address between many customers (carrier-grade NAT). If so, incoming connections won't reach you even with Dynamic DNS. Ask your provider for a public IP address.
- **Rotating the URL:** if the webcall URL leaks, delete the Dynamic DNS entry in cPanel and create a new one, then update your router or script.

## Related articles

- [Using the DNS Zone Editor in cPanel](https://helpcenter.ruachost.com/cpanel/domains/using-the-dns-zone-editor-in-cpanel/)
- [Using cPanel API tokens to automate your hosting](https://helpcenter.ruachost.com/cpanel/advanced/using-cpanel-api-tokens/)
