Coder Social home page Coder Social logo

dnsresolver's Introduction

Welcome to DNS resolver!

  • Start the command-line program
    • make run
  • Look up a domain name
    • lookup x.x.x.x (ex: lookup www.cs.ubc.ca)
  • Set the root name server (optional, default is 199.7.83.42 which is close to UBC!)
    • server x.x.x.x (ex: server 8.8.8.9)
  • Set verbose tracing on (optional, to print a trace of all queries and responses)
    • trace on | off
  • Print the contents of the DNS cache (optional)
    • dump
  • Quit
    • quit

How to understand what is happening

This program is an iterative DNS resolver, meaning that the client repeatedly makes requests to DNS servers to resolve a domain name to an IP address (The code contains a lot of comments). Here are two example lookups, which provide the corresponding dig commands for a live demo:

  1. We can simulate lookup www.cs.ubc.ca as follows:
  • dig +norecurse @199.7.83.42 www.cs.ubc.ca
  • dig +norecurse @185.159.196.2 www.cs.ubc.ca
  • dig +norecurse @137.82.1.1 www.cs.ubc.ca
  • dig +norecurse @137.82.61.120 www.cs.ubc.ca → we got the answer 142.103.6.5!
  1. We can simulate lookup finance.google.ca (which contains aliases) as follows:
  • dig +norecurse @199.7.83.42 finance.google.ca
  • dig +norecurse @185.159.196.2 finance.google.ca
  • dig +norecurse @199.7.83.42 ns3.google.com → we needed to lookup the IP of an authoritative nameserver
  • dig +norecurse @192.33.14.30 ns3.google.com → we got the answer 216.239.36.10 for the authoritative nameserver
  • dig +norecurse @216.239.36.10 finance.google.ca → we got the answer 142.251.33.110!

Reference: https://www.ietf.org/rfc/rfc1035.txt

dnsresolver's People

Contributors

aliyamohamed13 avatar donaldacton avatar gokcedilek avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.