The answersDownload the PDF
Worksheet

A12.3 How the Internet works

Networks and the web · A level · OCR H446 1.3.3, AQA 7517 4.9.3.1, Eduqas A500QS 2.2 · about 25 min

BugBotLab
NameClassDate

What this lesson is about

Packet switching, routers and gateways, URLs, fully qualified domain names and DNS.

Questions 6 marks in all

  1. [1 mark]Which of these are found in a packet's header? Choose all that apply.

    Tick every answer that is true.

    1. ASource IP address
    2. BDestination IP address
    3. CPacket sequence number
    4. DTime to live
    5. EThe web page's text
  2. [1 mark]When should a gateway be used rather than a router?

    1. AWhen the networks being joined use different protocols
    2. BWhen the two networks use the same protocols
    3. CWhen a device needs a private IP address
    4. DWhen a domain name must be registered
  3. [1 mark]In the URL https://www.bbc.co.uk/news, what is the fully qualified domain name?

  4. [1 mark]Put the steps of a DNS lookup for lessons.bugbot.example, with nothing cached, in order.

    Number the lines 1 to 5 to put them in the right order.

    1. The resolver asks the authoritative name server for bugbot.example
    2. The resolver caches the IP address and returns it to the computer
    3. The resolver asks a root name server
    4. The resolver asks the top-level domain server for .example
    5. The computer asks its resolver
  5. [1 mark]Which is an advantage of packet switching over circuit switching?

    1. ALinks are shared by many conversations, and packets can be routed around a failed link
    2. BData always arrives in the order it was sent
    3. CThe delay is always constant
    4. DA dedicated path is reserved for the whole conversation
  6. [1 mark]What does this program print?

    packets = {3: 'ket', 1: 'pa', 2: 'c'}
    message = ''
    for n in sorted(packets):
        message = message + packets[n]
    print(message)

The task: put the packets back together

The Server on this mat sends one short message as four packets, one every 0.4 seconds, but not in order. Each packet is text in the form <number>/<total>:<payload>, for example 2/4:an take d. The number counts from 1, the total is how many packets make the message, and the payload is everything after the first colon (it may contain spaces). Listen with messages(), checking every 0.1 s, until you hold every packet. Then print two lines: - arrived in order: <numbers>, the packet numbers in the order they arrived, separated by single spaces; - message: <text>, the payloads joined in number order. The robot does not drive.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

wait(2)
for sender, text in messages():
    print(text)

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/a12-3-the-internet-and-dns/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Add a TTL to the DNS cell: stop a lookup after 2 servers and print too many hops. The lookup above needs 3, so it should now fail.
  2. Drop one packet: have your program give up after 3 seconds and print which packet numbers are missing.
  3. Split https://www.bbc.co.uk/news/technology into its scheme, FQDN, domain name and path with string methods.