---
title: "Recursive/iterative query and DNS records"
subject: "Computer Networks and Security"
chapter: 6
key: "semester_7/computer_networks_and_security:dns-recursive-iterative-records"
source: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/dns-recursive-iterative-records
site: BCT Engineering
---

# Recursive/iterative query and DNS records

Computer Networks and Security · Chapter 6: Application Layer

- Asked in: 2074 Asoj, 6+2 marks
- Video: [DNS recursive query vs. Iterative query](https://www.youtube.com/watch?v=PS0UppB3-fg) — Sunny Classroom
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/dns-recursive-iterative-records
- Whole chapter: https://www.bctengineer.com/md/semester_7/computer_networks_and_security/chapter-6

## Question

What is recursive and iterative query? Explain with suitable diagram. Discuss the DNS records.

## Short answer

Recursive query: local DNS server fully resolves the name, querying other servers itself. Iterative query: server returns referrals; the requester queries each referred server. DNS records include A (IPv4), AAAA (IPv6), NS (authoritative server), CNAME (alias), MX (mail server), PTR (reverse lookup), SOA (zone authority), and TXT (text). Root servers only accept iterative queries to reduce load.

## Answer

**DNS** translates domain names to IP addresses. A client's request for a name can be resolved in two ways.

#### Recursive query
The client asks its local DNS server and the server takes the **complete responsibility** of finding the answer. If it does not know the answer, it queries other servers itself and finally returns either the final answer or an error. The client sends one query and gets one reply.

#### Iterative query
The queried server returns the best answer it has: either the address, or a **referral** to another server that is closer to the answer. The querier then asks that next server itself. So the burden is on the requester.

```text
Recursive (client -> local), iterative (local -> others)

Host            Local DNS         Root     TLD(.com)   Auth(abc.com)
 |--1 www.abc.com->|
 |                 |--2 query------->|
 |                 |<--3 refer .com--|
 |                 |--4 query------------>|
 |                 |<--5 refer abc.com----|
 |                 |--6 query------------------>|
 |                 |<--7 IP 1.2.3.4-------------|
 |<--8 IP 1.2.3.4--|
```

| Point | Recursive | Iterative |
|---|---|---|
| Work done by | Queried server | Querying client/server |
| Reply | Final answer or error | Answer or referral |
| Load on root servers | High (so root servers do not accept recursive queries) | Low |

#### DNS resource records
A record format is (Name, Value, Type, Class, TTL).

| Type | Meaning | Example |
|---|---|---|
| A | Host name to IPv4 address | www.abc.com -> 1.2.3.4 |
| AAAA | Host name to IPv6 address | www.abc.com -> 2001:db8::1 |
| NS | Authoritative name server of a domain | abc.com -> ns1.abc.com |
| CNAME | Alias to canonical name | ftp.abc.com -> www.abc.com |
| MX | Mail server of a domain (with priority) | abc.com -> mail.abc.com |
| PTR | IP address to name (reverse lookup) | 4.3.2.1.in-addr.arpa -> www.abc.com |
| SOA | Start of authority: zone serial, refresh, admin | - |
| TXT | Free text (SPF, verification) | - |

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. In a recursive query, who is responsible for finding the answer?
   A. The client
   B. The queried server, which returns the final answer or an error
   C. The root server only
   D. No one
   Answer: B. The queried server takes full responsibility. (Key point: Recursive query)

2. What does a server return in an iterative query when it does not know the answer?
   A. An error only
   B. A referral to a closer server
   C. The final answer always
   D. A broadcast
   Answer: B. It gives the best answer, possibly a referral; the requester asks the next server. (Key point: Iterative query)

3. Why do root servers usually refuse recursive queries?
   A. Load would be high
   B. They have no data
   C. UDP forbids it
   D. They are not authoritative for anything
   Answer: A. Recursion puts high load on root servers, so iterative is used. (Key point: Root load)

4. Which record maps an alias to a canonical name?
   A. A
   B. MX
   C. CNAME
   D. PTR
   Answer: C. CNAME gives an alias to a canonical name. (Key point: Records)

## Related in other subjects

- [Recursion; iterative vs recursive choice](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Adefine-recursion-iterative-vs-recursive) — Data Structure and Algorithm, chapter 5
- [ER diagram: product and components](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Aer-product-component) — Database Management System, chapter 2
