Domain name server (DNS)

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

Domain name server (DNS)

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does a domain name server (DNS) store?
A A copy of every web page on the internet
B A list of domain names with their matching IP addresses
2. A DNS works like which everyday item?
A A letter that carries a message to a friend
B A phone directory that links names to numbers
3. What goes INTO a DNS during a lookup?
A A domain name such as www.example.com
B An IP address such as 93.184.216.34
4. What does a DNS give BACK when it finds a match?
A The IP address for that domain name
B The HTML code for the web page
5. How many DNS servers are there across the internet?
A Many DNS servers
B Only one DNS server for the whole world

Match the Pairs

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

Left columnRight column
1www.example.com -> 93.184.216.34 Adirectory["www.school.org"] = "203.0.113.8"
2DNS BDNS("www.bbc.co.uk") returns 151.101.64.81
3Domain name in, IP address out: the DNS server returns the IP address for a domain name CThis is back to front: you give the DNS a domain name and it returns the IP address, not the other way round.
4DNS works like a directory: look up a name to find the matching number DMany DNS servers exist across the internet, not just one.
5DNS("192.0.2.44") returns www.shop.com EA DNS record: a domain name matched with its IP address
6There is only one DNS server for the whole internet FDomain name server: stores domain names and their matching IP addresses

Definitions

DNS

Fill in the Blanks

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

1.
___ = Domain Name Server
2.
DNS list: domain name and __________
3.
domain = "example.com" ip = DNSLOOKUP(______)
4.
IF no answer from this DNS THEN ask _______ DNS server ENDIF
5.
site = "bbc.co.uk" ip = DNSLOOKUP(site) ______ ip

Spot the Error

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

Question 1
A dns = {"a.com": "10.0.0.1"}
B name = "a.com"
C print(dns["10.0.0.1"])
Question 2
A dns = {"10.0.0.5": "b.org"}
B site = "b.org"
C print(dns[site])
Question 3
A domain ← "shop.com"
B domain ← DNS_LOOKUP(ip)
C OUTPUT ip
Question 4
A dns = {"x.com": "10.1.1.1"}
B ip = dns("x.com")
C print("IP:", ip)
Question 5
A dns1 = {"a.com": "10.0.0.1"}
B name = "a.com"
C if name in dns1:
D print(dns1["name"])
E else:
F print("ask another DNS server")

Answer Key

Domain name server (DNS)
Section A: Quick Questions
Q1
B — A list of domain names with their matching IP addresses
Q2
B — A phone directory that links names to numbers
Q3
A — A domain name such as www.example.com
Q4
A — The IP address for that domain name
Q5
A — Many DNS servers
Section B: Match the Pairs
Q1
www.example.com -> 93.184.216.34 → A DNS record: a domain name matched with its IP address
Q2
DNS → Domain name server: stores domain names and their matching IP addresses
Q3
Domain name in, IP address out: the DNS server returns the IP address for a domain name → DNS("www.bbc.co.uk") returns 151.101.64.81
Q4
DNS works like a directory: look up a name to find the matching number → directory["www.school.org"] = "203.0.113.8"
Q5
DNS("192.0.2.44") returns www.shop.com → This is back to front: you give the DNS a domain name and it returns the IP address, not the other way round.
Q6
There is only one DNS server for the whole internet → Many DNS servers exist across the internet, not just one.
Section C: Definitions
Q1
DNS — Domain name server: stores a list of domain names with their matching IP addresses. Give it a domain name and it returns the IP address. Many DNS servers exist across the internet.
Section D: Fill in the Blanks
Q1
DNS = Domain Name Server
Q2
DNS list: domain name and IP address
Q3
domain = "example.com" ip = DNSLOOKUP(domain)
Q4
IF no answer from this DNS THEN ask another DNS server ENDIF
Q5
site = "bbc.co.uk" ip = DNSLOOKUP(site) OUTPUT ip
Section E: Spot the Error
Q1
C — The DNS list is keyed by domain name, so you give it the domain name to get the IP address out. Looking up by the IP address finds nothing. It should be print(dns[name]).
Q2
A — The directory has the domain name and IP address the wrong way round. A DNS stores each domain name as the key with its matching IP address as the value: {"b.org": "10.0.0.5"}.
Q3
B — The lookup goes the wrong way. You give the DNS the domain name and it returns the IP address, so the line should be ip ← DNS_LOOKUP(domain).
Q4
B — The DNS list is a dictionary, so you look an entry up with square brackets, not round brackets. It should be ip = dns["x.com"].
Q5
D — "name" in quotes is the text name, not the variable holding the domain name. The key to look up is the variable, so it should be print(dns1[name]). If the first DNS server lacks the domain, another DNS server is asked.