A DNS lookup step by step

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

A DNS lookup step by step

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does the browser send to the DNS server at the start of a DNS lookup?
A The domain name, such as www.example.com
B The IP address of the web server
2. What does the DNS server return to the browser when it finds a match?
A The full web page
B The IP address that matches the domain name
3. How does a DNS server find the right entry for a domain name?
A It searches its records for a matching domain name
B It guesses the IP address from the domain name
4. A DNS server has no record for the domain name it was sent. What happens next?
A It sends the browser a random IP address
B It passes the request on to another DNS server
5. Which order is correct for a DNS lookup?
A Browser sends domain name, DNS searches, IP address returned
B DNS sends IP address, browser searches, domain name returned

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1DNS lookup AThe browser sends a domain name to a DNS server, which searches for it and returns the matching IP address
2www.example.com -> 93.184.216.34 BThe DNS server found the domain name in its records and returned the matching IP address to the browser
3If the first DNS server has no entry for the domain name, it passes the request on to another DNS server CIf no match is found there is no IP address to use. The DNS server should pass the request to another DNS server instead.
4The first step of a lookup is the browser sending the domain name to a DNS server Dif domain not found: ask another DNS server
5DNS server -> browser: www.example.com Ebrowser -> DNS server: www.example.com
6Domain not found: browser uses the IP address anyway FThe DNS server returns the IP address to the browser, not the domain name. The browser already knows the domain name, so sending it back does not help.

Definitions

DNS lookup

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
domain ← "www.bbc.co.uk" ip ← DNS.______(domain)
2.
IF found THEN ______ ip ENDIF
3.
IF ___ found THEN PASS request TO otherDNS ENDIF
4.
IF NOT found THEN ____ request TO otherDNS ENDIF
5.
IF found THEN RETURN ip ____ OUTPUT "Not found"

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A domain ← "www.example.com"
B SEND domain TO dns_server
C FIND ip IN dns_records
D RETURN ip TO browser
Question 2
A request ← domain_name
B SEND request TO web_server
C ip ← DNS_SEARCH(request)
D CONNECT TO ip
Question 3
A domain ← "192.168.1.5"
B SEND domain TO dns_server
C ip ← dns_server.RESULT
D CONNECT TO ip
Question 4
A SEARCH records FOR domain
B IF match found THEN
C RETURN ip TO browser
D ELSE RETURN ip TO browser
E ENDIF
Question 5
A dns_server RECEIVES domain
B FIND matching web_page
C SEND ip_address TO browser

Answer Key

A DNS lookup step by step
Section A: Quick Questions
Q1
A — The domain name, such as www.example.com
Q2
B — The IP address that matches the domain name
Q3
A — It searches its records for a matching domain name
Q4
B — It passes the request on to another DNS server
Q5
A — Browser sends domain name, DNS searches, IP address returned
Section B: Match the Pairs
Q1
DNS lookup → The browser sends a domain name to a DNS server, which searches for it and returns the matching IP address
Q2
www.example.com -> 93.184.216.34 → The DNS server found the domain name in its records and returned the matching IP address to the browser
Q3
If the first DNS server has no entry for the domain name, it passes the request on to another DNS server → if domain not found: ask another DNS server
Q4
The first step of a lookup is the browser sending the domain name to a DNS server → browser -> DNS server: www.example.com
Q5
DNS server -> browser: www.example.com → The DNS server returns the IP address to the browser, not the domain name. The browser already knows the domain name, so sending it back does not help.
Q6
Domain not found: browser uses the IP address anyway → If no match is found there is no IP address to use. The DNS server should pass the request to another DNS server instead.
Section C: Definitions
Q1
DNS lookup — The browser sends a domain name to a DNS server, which searches for it and returns the matching IP address. If it has no match, it passes the request to another DNS server.
Section D: Fill in the Blanks
Q1
domain ← "www.bbc.co.uk" ip ← DNS.SEARCH(domain)
Q2
IF found THEN RETURN ip ENDIF
Q3
IF NOT found THEN PASS request TO otherDNS ENDIF
Q4
IF NOT found THEN PASS request TO otherDNS ENDIF
Q5
IF found THEN RETURN ip ELSE OUTPUT "Not found"
Section E: Spot the Error
Q1
C — The DNS server searches its records for the domain name, because that is what the browser sent. The IP address is the answer it returns. Line 3 should be FIND domain IN dns_records.
Q2
B — The browser must send the domain name to a DNS server first, to get the IP address. A web server cannot be contacted until the IP address is known. Line 2 should be SEND request TO dns_server.
Q3
A — A DNS lookup starts with a domain name, which is what the user types. An IP address is the result of the lookup. Line 1 should store a domain name such as "bbc.co.uk".
Q4
D — If this DNS server has no matching record, it has no IP address to return. It must pass the request on to another DNS server. Line 4 should be ELSE PASS TO other_dns.
Q5
B — A DNS server matches a domain name to an IP address. It does not store or find web pages. Line 2 should be FIND matching ip_address.