This project implements a custom DNS server in multiple stages, gradually building up functionality from a basic UDP server to a full-fledged forwarding DNS server.
In this initial stage, we set up a basic UDP server that can receive and send packets. This forms the foundation for our DNS server, as DNS typically uses UDP for communication.
We implement the header section of the DNS packet. The header contains important metadata about the DNS query or response.
For more detailed information about the DNS packet format, you can refer to:
In this stage, we implement the question section of the DNS packet. This section contains the query name, type, and class.
Here, we implement the answer section of the DNS packet. This section contains the resource records that respond to the query in the question section.
We develop functionality to parse the header section of incoming DNS packets, extracting relevant information for processing.
This stage involves parsing the question section of incoming DNS packets to understand the nature of the DNS query.
DNS uses a compression scheme to reduce packet size. In this stage, we implement functionality to parse compressed DNS packets.
In the final stage, we implement a forwarding DNS server. This type of DNS server doesn't resolve queries itself but forwards them to another DNS server for resolution. It acts as an intermediary between the client and the authoritative DNS server.
- Clone the repository:
git clone https://github.com/yourusername/dns-server.git
cd dns-server
- Install dependencies:
bun install
- Run the DNS server:
bun dev