# How to get \`dig\` to send multiple questions at once?

**URL:** <https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087>\
**Category:** Challenges\
**Tags:** challenge:dns-server\
**Created:** [February 21, 2025, 2:13am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087 "2025-02-21T02:13:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![merc1er](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/merc1er/32/4237_2.png) [@merc1er](https://forum.codecrafters.io/u/merc1er)\
**Post date:** [February 21, 2025, 2:13am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087/1 "2025-02-21T02:13:19Z")

</div>

How can we test `yc9` with dig (or similar tools)? It looks like dig only sends questions one by one, but this step requires handling multiple questions within the same query.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [February 21, 2025, 9:45am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087/3 "2025-02-21T09:45:35Z")

</div>

Hi @merc1er, `dig` doesn’t support sending multiple questions in a single query.

You might want to try [kdig](https://www.knot-dns.cz/docs/2.6/html/man_kdig.html) or write a custom script to test this locally.

Let me know if you’d like further assistance! We can figure it out together.

---

<div class="post-metadata">

**Author:** ![merc1er](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/merc1er/32/4237_2.png) [@merc1er](https://forum.codecrafters.io/u/merc1er)\
**Post date:** [February 22, 2025, 5:04am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087/4 "2025-02-22T05:04:23Z")

</div>

Thank you for the response. I actually installed the codecrafters CLI and I run the tests this way without having to push to git every time.

---

<div class="post-metadata">

**Author:** ![merc1er](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/merc1er/32/4237_2.png) [@merc1er](https://forum.codecrafters.io/u/merc1er)\
**Post date:** [February 22, 2025, 5:11am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087/5 "2025-02-22T05:11:28Z")

</div>

> [@andy1li](#):
>
> You might want to try [kdig](https://www.knot-dns.cz/docs/2.6/html/man_kdig.html) or write a custom script to test this locally.

Looks like kdig also sends questions individually. I wasn’t able to get it to send multiple at once.

EDIT: I am also reading online that multiple “questions” in the same query is practically not supported: [https://serverfault.com/questions/742785/multi-query-multiple-dns-record-types-at-once](https://serverfault.com/questions/742785/multi-query-multiple-dns-record-types-at-once)

---

<div class="post-metadata">

**Author:** ![rolisv](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rolisv/32/6022_2.png) [@rolisv](https://forum.codecrafters.io/u/rolisv)\
**Post date:** [March 6, 2025, 5:03am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087/7 "2025-03-06T05:03:10Z")

</div>

@merc1er, from what I follow, there is an [RFC 9619](https://www.rfc-editor.org/rfc/rfc9619) that updates the DNS [RFC 1035](https://www.rfc-editor.org/rfc/rfc1035).

From the abstract:

> This document updates RFC 1035 by constraining the allowed value of the QDCOUNT parameter in DNS messages with OPCODE = 0 (QUERY) to a maximum of one, and it specifies the required behavior when values that are not allowed are encountered.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [March 6, 2025, 8:21am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087/8 "2025-03-06T08:21:38Z")

</div>

@merc1er You’re absolutely right! `kdig` sends questions individually. Apologies for the confusion! 🙏

You can try this python script to send multiple questions in a single request:

```python
from scapy.all import DNS, DNSQR, IP, UDP, sr1

query = (
    IP(dst="127.0.0.1")
    / UDP(dport=2053)
    / DNS(rd=1, qd=[DNSQR(qname="example.com"), DNSQR(qname="codecrafters.io")])
)

response = sr1(query)
print(response[DNS].an)

```

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/7/79b5df8a187d80892f1446463ece3f5658b120ef.png)

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [March 24, 2025, 11:16am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087/10 "2025-03-24T11:16:23Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [March 29, 2025, 11:16am UTC](https://forum.codecrafters.io/t/how-to-get-dig-to-send-multiple-questions-at-once/5087/11 "2025-03-29T11:16:55Z")

</div>

Closed on March 29, 2025, 11:16am UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
