> ## Content Index
> Fetch the complete content index at: https://blog.esadax.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# DNS Examples
- URL: https://blog.esadax.com/en/dns-examples/
- Published: 2026-11-15T04:13:31.000Z
- Updated: 2026-11-15T04:13:31.000Z
- Author: Esadax 
- Tags: #tr-domains-02-dns-01-intro-05-example-records, #en, #mdx-imported, Domains

# 🌐 Setting Up Host Records for DNS

Properly configuring DNS (Domain Name System) host records is crucial for ensuring that your domain resolves correctly to web servers, mail servers, and other internet services. This guide will walk you through setting up various types of DNS records, using practical examples.

---

## 🧠 What Are DNS Host Records?

DNS host records tell the internet how to find your domain and its services (like websites or email). Each record maps a **hostname** (like `@` or `www`) to a **value** (like an IP address or another domain name).

Each DNS record has:

- **Record Type**: Defines the kind of mapping (e.g., A, AAAA, CNAME, MX, TXT).
- **Hostname**: The name of the subdomain (e.g., `@`, `www`, `mail`).
- **Value**: The destination (e.g., an IP address or domain).
- **MX Preference**: Only used for MX records to prioritize mail servers.
- **TTL (Time to Live)**: How long DNS servers cache the record, in seconds.

---

## 🧾 DNS Record Types Explained

### 📍 A Record (Address Record)

Maps a domain or subdomain to an **IPv4 address**.

#### Example:

```
RECORD_TYPE: A
HOSTNAME: @
VALUE: 10.30.21.11
TTL: 300

```

- `@` means the root domain (e.g., example.com).
- This record tells DNS to point `example.com` to the IPv4 address `10.30.21.11`.

Another example:

```
RECORD_TYPE: A
HOSTNAME: mail
VALUE: 10.30.21.11
TTL: 300

```

- This points `mail.example.com` to the same server.

---

### 🧭 AAAA Record (IPv6 Address)

Maps a domain or subdomain to an **IPv6 address**.

#### Example:

```
RECORD_TYPE: AAAA
HOSTNAME: @
VALUE: 2001:b07:5d2e:6e67:552a:ae40:7e9d:f47
TTL: 300

```

- This sets `example.com` to use the given IPv6 address.

---

### 🔁 CNAME Record (Canonical Name)

Maps a subdomain to another domain name. This is often used for aliasing.

#### Example:

```
RECORD_TYPE: CNAME
HOSTNAME: www
VALUE: @
TTL: 300

```

- This makes `www.example.com` an alias for `example.com`.

Another set of examples:

```
RECORD_TYPE: CNAME
HOSTNAME: mail1
VALUE: mail
MX_PREF: 10
TTL: 300

```

```
RECORD_TYPE: CNAME
HOSTNAME: mail2
VALUE: mail
MX_PREF: 20
TTL: 300

```

- `mail1.example.com` and `mail2.example.com` both point to `mail.example.com`, possibly for mail server redundancy. While CNAME records technically shouldn’t have MX preferences, this might be misused or misunderstood. Typically, you'd use **MX records** instead for mail routing.

---

### 📬 TXT Record (Text Record)

Holds arbitrary text data, often used for email authentication like SPF, DKIM, or DMARC.

#### Example:

```
RECORD_TYPE: TXT
HOSTNAME: mail
VALUE: v=spf1 mx -all
TTL: 300

```

- This SPF (Sender Policy Framework) record allows mail servers listed in the MX records to send email on behalf of `mail.example.com`.
- `-all` means all others are **not authorized** to send mail.

---

### 📧 Common Mistake: MX Records

Your data includes MX preferences in CNAME records, which is incorrect.

Proper **MX** records should look like:

```
RECORD_TYPE: MX
HOSTNAME: @
VALUE: mail.example.com
MX_PREF: 10
TTL: 300

```

- MX records define mail servers for a domain.
- `MX_PREF` sets the priority (lower is higher priority).

---

## 🛠 Sample DNS Zone Configuration

Here's a combined example that sets up web and email services for a domain:

```csv
RECORD_TYPE,HOSTNAME,VALUE,MX_PREF,TTL
A,@,10.30.21.11,,300
AAAA,@,2001:b07:5d2e:6e67:552a:ae40:7e9d:f47,,300
CNAME,www,@,,300
A,mail,10.30.21.11,,300
MX,@,mail.example.com,10,300
TXT,mail,v=spf1 mx -all,,300

```

### Explanation:

- `example.com` and `www.example.com` point to a server via IPv4 and IPv6.
- `mail.example.com` is set up as the mail server.
- An MX record directs email for the domain to `mail.example.com`.
- A TXT SPF record is added for email authentication.

---

## ⏲ TTL (Time to Live)

TTL defines how long a DNS record is cached by resolvers.

- Common values: `300` (5 minutes), `3600` (1 hour), `86400` (1 day)
- A lower TTL means faster propagation for changes, but more frequent DNS lookups.

---

## 🧪 Final Notes

- Ensure you don't mix incompatible record types (e.g., don't put MX\_PREF in CNAME).
- Use DNS lookup tools to test your configuration (e.g., `dig`, `nslookup`, or online DNS checkers).
- Changes may take time to propagate based on TTL values.