Skip to content

A simple DNS resolver that queries DNS servers and parses multiple DNS record types to find an ip for a domain.

Notifications You must be signed in to change notification settings

nishayo/dns_resolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DNS Resolver

A lightweight DNS resolver implementation in C that performs IPv4 (A) and IPv6 (AAAA) record lookups

Overview

This DNS resolver implements basic DNS query functionality by:

  • Building and sending DNS queries to a DNS server (Google DNS - 8.8.8.8)
  • Parsing DNS responses including A, AAAA, and CNAME records
  • Supporting both IPv4 and IPv6 address resolution

Architecture

Flow

Setup Guide

Prerequisites

  • GCC compiler
  • Make build system
  • Linux/Unix environment (for socket programming)

Building the Project

  1. Clone the repository
git clone <repository-url>
cd dns-resolver
  1. Build the project
make
  1. Run the resolver
./bin/dns_resolver <domain-name>

Technical Details

Implementation Notes

  • Uses UDP for DNS queries (port 53)
  • Maximum packet size: 512 bytes (standard DNS)
  • Supports DNS name compression
  • Handles multiple answers per query

Usage Example

./bin/dns_resolver www.github.com

Example output:

Response ID: 1234
Answer Count: 2
IPv4 Address: 140.82.121.4
IPv6 Address: 2a00:1450:4009:822::2004

About

A simple DNS resolver that queries DNS servers and parses multiple DNS record types to find an ip for a domain.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published