DEV Community

Cover image for I’ve Just Launched a DNS Server in 🦀 Rust!
Eduardo Baginski Costa
Eduardo Baginski Costa

Posted on

I’ve Just Launched a DNS Server in 🦀 Rust!

Originally published on the TabNews platform. Check out the publication.


📖 Introduction 📖

I was looking for a challenging project, and I decided to build a DNS server from scratch, fully modular and optimized for high performance. The goal was to create something scalable, asynchronous, and easy to maintain, so future contributors can improve and expand it with ease. Here are the highlights of what has already been implemented, with many more improvements on the way:

✨ Main Features ✨

  • Modular Code: I refactored the original implementation (a single file) into a cleaner, more modular structure, making it easier to maintain and for future contributions.
  • Dynamic Scalability: The server automatically adjusts the number of worker threads based on demand, ensuring optimal performance in various scenarios.
  • Asynchronous Processing: With the power of tokio, the server handles DNS queries asynchronously, with no blocking, improving scalability and latency.
  • Flexible Configuration: All server configurations (like name servers, message queues, number of workers) are managed through a server.toml file, making customization super simple.
  • RFC 1034 and 1035 Compliance: Implements DNS resolution according to RFC 1034 and RFC 1035 standards, with support for both IPv4 and IPv6 addresses.
  • Enhanced Debugging: Improved error handling and an optional debug output to make diagnosing and fixing issues easier.

🔮 What’s Coming Next? 🔮

The project is constantly evolving. The next step is to implement features like caching and DNS over HTTPS (DoH), making the server even more robust and production-ready.

💡 My Journey with Rust 💡

This project has been an amazing opportunity to deepen my knowledge of Rust, a language I started exploring recently. With my previous experience in C/C++, I’m becoming more and more convinced of Rust’s advantages for building reliable and secure systems. But I don’t forget about other languages! Each has its value, and I’m always open to learning more.


Check out the repository on GitHub, and feel free to contribute or suggest improvements.

Special thanks to Emil Hernvall for the base code 🙏


PS: I’m planning to record videos soon for my YouTube channel about Rust, C, and C++. I’ll be using this project as a major starting point. So, please follow me on YouTube to get notified when the video is posted: eduardobaginskicosta.

Top comments (0)