Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

RustDNS: Writing a Recursive DNS Resolver in Rust, Byte by Byte

说明与用途

RustDNS 是一个使用 Rust 编写的最小递归 DNS 解析器,完全不依赖外部库。它监听 UDP 2053 端口,按顺序查询根、顶级域和权威服务器,并将答案返回给客户端。

问题

Build a minimal recursive DNS resolver in Rust that can resolve domain names without external dependencies.

结果

The resolver successfully resolves google.com by querying root, TLD, and authoritative servers, returning multiple A records.

工作流

  • Clone the repository from GitHub
  • Run cargo run --release to start the resolver on 0.0.0.0:2053
  • Use dig @127.0.0.1 -p 2053 google.com to query the resolver
  • Observe the resolver printing each lookup step and the final answers
  • Optionally use the provided 12‑line Python client to send a query

证据

RustDNS is a recursive DNS resolver written in plain Rust with zero dependencies, just std::net::UdpSocket and a 512-byte array.

来源

Port 2053 instead of 53 is deliberate: ports below 1024 need root on Linux, and this way you don't have to sudo a learning project.

来源

Received query: DnsQuestion { name: "google.com", qtype: A } attempting lookup of A google.com with ns 198.41.0.4 attempting lookup of A google.com with ns 192.41.162.30 attempting lookup of A google.com with ns 216.239.34.10 Answer: A { domain: "google.com", addr: 142.250.29.100, ttl: 300 }

来源

  • 记录日期: 2026-10-06T16:40:51.727Z