dq(1)

πŸ“¦
this version Β· 2 versions
  • debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • ubuntu jammy
, in debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ dq(1) β€” the manual page, but make it make sense ✨

okay bestie, pull up a chair, we're learning dq πŸ’…


🌸 NAME 🌸

dq β€” DNS/DNSCurve query tool. that's it, that's the whole vibe. it asks DNS servers questions and you get answers. iconic behavior honestly πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

dq [ options ] type fqdn [ host ]

dq -a  [ options ] type fqdn host

so two whole shapes. one is the chill recursive one, one is the bossy authoritative one with -a and you gotta give it a host for that one, no skipping 🫢


πŸ’– DESCRIPTION πŸ’–

dq is a commandline tool that's derived from dnsq / dnsqr β€” the origin story is right here: https://cr.yp.to/djbdns/debugging.html ✨

dq asks for records of type type under the domain name fqdn. that's the whole thing. it goes and gets them.

and then dq -a sends a non-recursive DNS/DNSCurve query to the DNS/DNSCurve server host for records of type type under the domain name fqdn. like, it goes straight to the source instead of asking the middleman. main character energy, no cap πŸ‘‘


πŸ’… OPTIONS πŸ’…

  • -v β€” print extra information. she's chatty, we love her πŸ’¬
  • -r β€” send recursive query. this is the default, it's just built different πŸŒ€
  • -a β€” send authoritative query. the non-recursive, go-directly-to-jail-do-not-pass-go one πŸ‘‘
  • -u β€” use UDP. also the default, ngl she's the low-effort queen ✨
  • -t β€” use TCP. when you need the reliable one 🧚
  • -s β€” send DNSCurve query in streamlined format (default), and heads up: this is ignored for regular DNS queries. so if you're not doing DNSCurve it literally does nothing, don't stress πŸ“
  • -S suffix β€” send DNSCurve query in TXT format using suffix suffix, also ignored for regular DNS queries. same deal, only matters for DNSCurve πŸŽ€
  • -T timeout β€” give up on the DNS/DNSCurve query attempt after timeout seconds, range <1-60>, default 60. so when the server's ghosting you, you get to leave after a minute max 😭
  • -p port β€” send query to port port, default 53. the classic ✨
  • -k key β€” send DNSCurve query and use servers public-key key πŸ”‘

and the positional args, bestie:

  • type β€” DNS query type. your options are A, NS, MX, ANY, PTR, TXT, SOA, SRV, AAAA, AXFR, CNAME, or a numeric type. so many choices, pick your fighter 🌈
  • fqdn β€” fully qualified domain name. yes fully. no shortcuts πŸ’–
  • host β€” DNS server, as a hostname or IP address πŸ–₯️

🌈 ENVIRONMENT 🌈

these are the env vars that change how dq behaves, and yes they override stuff:

  • DNSCACHEIP β€” use IP address $DNSCACHEIP instead of the nameserver lines from /etc/resolv.conf. you're basically saying "not that one, this one" πŸ’…
  • LOCALDOMAIN β€” use space separated names from $LOCALDOMAIN instead of the search line from /etc/resolv.conf πŸ”
  • DNSREWRITEFILE β€” use the $DNSREWRITEFILE file instead of /etc/dnsrewrite πŸ“„

πŸ¦‹ NOTES πŸ¦‹

okay this part is lowkey the coolest: dq rewrites IP addresses to *.in-addr.arpa or *.ip6.arpa for PTR queries. so you don't have to do it yourself, she does it for you 🧚

e.g.:

127.0.0.1 -> 1.0.0.127.in-addr.arpa
::1 -> 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa

look at that ipv6 one. absolutely unhinged length. she ate tho πŸ’€βœ¨


⭐ RECURSIVE EXAMPLES ⭐

the chill ones, no -a in sight:

dq any dnscurve.cz
dq any dnscurve.cz 8.8.8.8
env DNSCACHEIP=8.8.8.8 dq any dnscurve.cz
dq ptr 1.0.0.127.in-addr.arpa
dq ptr 127.0.0.1
dq ptr ::1
dq ptr 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa

copy these, run these, become the DNS girlie you were always meant to be πŸ’–


πŸ‘‘ AUTHORITATIVE EXAMPLES πŸ‘‘

now we're doing -a, we're going straight to the server, we're that girl:

dq -a any dnscurve.cz uz5mj60yr9tnudkkpcglw1y0w6dlh78j1l4gk4z7t8bsf1u4d48wlq.ns.dnscurve.cz
dq -a -S cz any dnscurve.cz uz5mj60yr9tnudkkpcglw1y0w6dlh78j1l4gk4z7t8bsf1u4d48wlq.ns.dnscurve.cz
dq -a -k uz5mj60yr9tnudkkpcglw1y0w6dlh78j1l4gk4z7t8bsf1u4d48wlq any dnscurve.cz 2a02:2b88:2:1::127d:1

that key is long, yes, do not try to type it from memory, copy paste is self care fr fr 🫢


πŸ’œ SEE ALSO πŸ’œ

go read these next, bestie, they're the extended universe:

and the links, in their full glory:

https://mojzis.com/software/dq
https://dnscurve.org/
https://cr.yp.to/djbdns/debugging.html

and that's a wrap on the dq(1) page from the General Commands Manual β€” you made it to the very end, which means you now know more about DNS/DNSCurve querying than like 90% of the people you know. periodt. go query something πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from