Skip to content

Instantly share code, notes, and snippets.

@alkrauss48
Last active August 29, 2015 14:03
Show Gist options
  • Save alkrauss48/c40c93ffd9ee8da5a310 to your computer and use it in GitHub Desktop.
Save alkrauss48/c40c93ffd9ee8da5a310 to your computer and use it in GitHub Desktop.

How domain names turn into valid IPs

It's more than you probably think

  1. A user types the URL http://www.example.com into a browser.

  2. The browser sends a request for the IP address of www.example.com to its local resolver (stub-resolver).

  3. The stub-resolver queries the locally configured DNS Resolver for the IP address of www.example.com.

  4. The DNS Resolver looks up www.example.com in local tables (its cache), but it isn’t found.

  5. The DNS Resolver sends a query to a root-server for the IP (the A RR) of www.example.com.

  6. The root-server only supports iterative (nonrecursive) queries (see the upcoming section “Iterative (Nonrecursive) Queries”) and answers with a list of name servers that are authoritative for the next level in the domain name hierarchy, which in this case is the gTLD .com (this is called a referral).

  7. The DNS Resolver selects one of the authoritative gTLD servers received in the previous referral and sends it a query for the IP of www.example.com.

  8. The gTLD name server only supports iterative queries and answers with the authoritative name servers for the Second-Level Domain (SLD) example.com (a referral).

  9. The DNS Resolver selects one of the authoritative DNS servers for example.com from the previous referral and sends it a query for the IP (the A RR) of www.example.com.

  10. The zone file for example.com defines www.example.com as a CNAME record (an alias) for joe.example.com. The authoritative name server answers with the www.example.com CNAME RR and, in this case, the A RR for joe.example.com, which we will assume is 192.168.254.2.

  11. The DNS Resolver sends the response joe.example.com=192.168.254.2 (together with the CNAME RR www=joe) to the original client stub-resolver.

  12. The stub-resolver sends www.example.com=192.168.254.2 to the user’s browser.

  13. The browser sends a request to 192.168.254.2 for the web page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment