# Gyro Cloud Istanbul: setting reverse DNS (PTR)

https://www.gyrohosting.com/en/knowledgebase/article/gyro-cloud-istanbul-reverse-dns

- **What you will learn**: The reverse DNS (PTR) record every address of your server gets automatically, how to replace it with your own domain (panel, CLI, API, Terraform) and what matters for e-mail delivery.
- **Time**: 5 minutes

## 1. What is reverse DNS and why does it matter?

Reverse DNS (PTR) maps an IP address to a name: `203.0.113.60` → `mail.example.com`. Receiving mail servers look at the PTR of the sending IP; if it is missing or the name's forward (A) record does not point to the same IP, mail may be rejected or marked as spam.

## 2. Automatic default record

On Gyro Cloud Istanbul **every IP address** (the primary address and additional IPv4 addresses) gets a reverse DNS record **automatically**:

- Default name: `203-0-113-60.ip.gyrohosting.com` (the dots of the IP become dashes).
- The forward record of that name exists too (`203-0-113-60.ip.gyrohosting.com` → `203.0.113.60`), so both directions match.
- When you delete the server, the service is cancelled or you release an additional IP, the reverse DNS record of that address is **removed**. A suspended server keeps its record.

Nothing to do; if you do not send e-mail, the default record is enough.

## 3. Using your own domain

1. First add an **A record** in your domain's DNS: `mail.example.com` → your server's IP address.
2. In the panel open your server's **Management** > **Network & Security** > **Reverse DNS**. Each IP address is a row; the status column shows **Default** or **Active**.
3. Click edit on the row, enter the **fully qualified name** (e.g. `mail.example.com`) and save.
4. The message "Reverse DNS (PTR) saved; it goes live within seconds." appears and the status becomes **Active**. If the A record does not point to this IP, the panel warns you (the record is still written).
5. To return to the default, click delete on the row; the record goes back to the `…ip.gyrohosting.com` name.

From the command line:

```
gyro server rdns list 12345
gyro server rdns set 12345 --ip 203.0.113.60 --hostname mail.example.com
gyro server rdns set 12345 --ip 203.0.113.60 --hostname ""     # back to default
```

With the API (`PUT /cloud/servers/{id}/rdns`):

```
curl -s -X PUT https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/rdns \
  -H "Authorization: Bearer $GYRO_TOKEN" -H "Content-Type: application/json" \
  -d '{"ip":"203.0.113.60","hostname":"mail.example.com"}'
```

The response lists `hostname`, `status` (`active`) and `default` (`true` on the default name) for every address.

With Terraform:

```
resource "gyro_server_rdns" "mail" {
  server_id = gyro_server.web.id
  ip        = gyro_server.web.ipv4
  hostname  = "mail.example.com"
}
```

`terraform destroy` returns the record to the default name.

> **Info**
> 
> The same applies to your additional IPv4 addresses; each additional address has its own row.

## 4. Rules and limits

- Only a **fully qualified name** is accepted (at least two labels, e.g. `mail.example.com`); single words such as `localhost`, IP addresses and internal names such as `.local` are refused.
- Names under `gyrohosting.com`, `gyrodns.net` and other Gyro domains cannot be used (the default name is assigned by the system).
- Well-known brand and institution names (banks, payment and shipping companies, large mail providers, etc.) are **protected** against abuse; if the domain is really yours, open a support ticket.
- At most **30 changes** per server per hour.
- Reverse DNS is free.

## 5. Checking

```
dig -x 203.0.113.60 +short           # mail.example.com.
dig mail.example.com +short          # 203.0.113.60  (both directions must match)
```

On the mail server also set the `HELO`/`EHLO` name to the same name and add SPF, DKIM and DMARC records for your domain.

## 6. Frequently asked questions

**I changed the record, when is it visible?**

It goes live on our name servers within seconds. For an address that was queried before, the old answer may stay in caches on the internet for up to an hour.

**Can I set reverse DNS without an A record?**

Yes, the record is written but the panel warns you. Receiving mail servers check both directions, so add the A record if you send e-mail.

**What happens to the record when I delete the server?**

It is removed. The IP address is held back for a while and is never handed to a new customer with the old name.

**I released an additional IP; will my old name show on another server?**

No. The reverse DNS record of a released address is removed at once; when the address is given out again only the default name is written.

## Next step

- [Additional IPv4 addresses](https://www.gyrohosting.com/en/knowledgebase/article/gyro-cloud-istanbul-additional-ipv4)
- [Snapshots, custom templates and reverse DNS](https://www.gyrohosting.com/en/knowledgebase/article/gyro-cloud-istanbul-rdns-snapshots)
