INF105 gruppetime 09
☛ Handwritten notes can be included in the quizzes
Contents
Description
Opening a webpage usually takes a fraction of a second. Behind that simple action, several processes take place: domain names are resolved into IP addresses, connections are established, requests travel across networks, and responses return with the requested content.
In this session, we will experience how people find and exchange information without a predefined communication system. Then we will simulate how the internet handles the same task using network protocols, addressing, routing and encapsulation. You will compare the two approaches and discuss what the protocols accomplish, what additional steps they introduce, and why those steps are useful.
Part 1 - Surf it like a Human
Before simulating network protocols, you will retrieve information without a predefined addressing or routing system.
In part 1, each of you will play the role of a web client and web server. You will hold two fragments:
- a request (the picture you want to find by the domain name you get), and
- content (the picture you have) .
Your task will be:
- Start a stopwatch on your phone
- Find the person who hosts your page, get the picture from them
- Wait until you give your picture to whoever is looking for you
- Stop the stopwatch and tell groupleaders how many minutes did it take for you to resolve both incoming and outgoing request, and take your seat.
Part 2 - Surf it like a Machine
Now, we’re going to imitate the real internet’s workflow.
In part 2, each table will be a separate local network. Every IP address within the table will share the first three numbers (e.g. 10.0.4.x addresses will all correspond to table 4). Within the table, each of you will receive a role with IP address, gateway (the router of the table) and DNS server’s IP:
- Client - a person that requests webpages
- Web server - a person that holds the content, answering TCP handshakes and GET requests.
- DNS server - a person that holds and updates the list of known hosts.
- Router - a person that look at IP header of the packet and delivers it to other network’s routers.
Your goal will be to imitate the pathway of a single unit of content through all layers of a network model, encapsulating it in TCP/UDP headers, IP headers, and transmitting the signals from one table (router) to another. In this lab, encapsulation will be represented as a colourful sticky notes stuck on top of each other:
How to encapsulate?
Every message is a stack of sticky notes. You build the stack from the inside out, and the receiver peels it off from the outside in. Let’s recap the 5 layer model and see how it will work in our lab:
| Layer | Colour | Protocol Data Units | What you write | Example |
|---|---|---|---|---|
| 5 Application | Yellow | Content / data | The question or request itself | Who is example.org ? / example.org is 10.0.2.3 / GET /picture |
| 4 Transport | Pink | Segment / datagram | Protocol, source port, destination port. For TCP: add flags and numbers | UDP 50123 → 53 / TCP 50321 → 80 SYN |
| 3 Network | Blue | IP packet | Source IP, destination IP, TTL | 10.0.4.1 → 10.0.2.3 TTL 8 |
| 2 Data link | Green | Frame | The next person who should pick it up | to: gateway / to: Mia |
| 1 Physical | - | Raw bits (0101) | Nothing. It is the router carrying the stack to another table |
Write the request. Your goal is to fetch the page of the domain on your card. The first thing you write is always the request itself, which is the only note that carries content. All other notes only help it travel. A web request needs the server’s IP address, and you only know the name, so you need two requests: first a DNS question, then the web request. In our lab, we will write simplified HTTP requests:
GET /picture.Ask the DNS server for the IP address. Write
who is example.org ?on another yellow note. This is a DNS request that you will need to send (encapsulating it in pink and blue stickers as well). This will help you to learn the IP address of the domain which you want to request for the content.What the DNS server does:
- If the name is in your list, answer straight away:
example.org is 10.0.2.3(also wrapping it in outer layers). - If not, you become a client. Write a new question, wrap it like any client would (UDP, your own source port → 53; your IP → the root DNS’s IP), and send it to the root DNS (a group leader at 10.0.0.2).
- When the answer arrives, add the name and IP to your list of known hosts, and then answer your client back.
In real DNS the root server only knows the servers of top-level domains such as .org, and the answer comes after several steps. In this lab, the group leader plays root, TLD and authoritative server in one. Your list is a cache: the next time someone asks for the same name, you skip step 2. Entries never expire in this lab.
- If the name is in your list, answer straight away:
Add the transport. The pink note says which program at the receiver should get the message:
| UDP | TCP | |
|---|---|---|
| Use it for | Short question and answer (DNS) | Fetching a web page content |
| Setup | None, just send | Three-way handshake first |
| Confirmation | None. You resend if the answer never comes | An ACK for every data packet |
| Example | UDP 50123 → 53 | TCP 50321 → 80 ACK |
- Choosing ports: server ports are fixed, because the client must know where to knock: DNS server 53 (UDP), root DNS 53 (UDP), web server 80 (TCP). Client ports are chosen by you: any number from 40000 to 60000, and a new one for every request, so the replies don’t get mixed up.
- TCP three-way handshake: these packets carry no yellow note, only pink, blue and green:
- Client → server:
TCP 50321 → 80 SYN(“I want a connection”) - Server → client:
TCP 80 → 50321 SYN-ACK(“OK, let’s connect”) - Client → server:
TCP 50321 → 80 ACK(“Connected”)
Only after sending ACK to the server can the client send GET /picture.In this lab, we skip the part about seq and ack numbers. In practice, real TCP counts bytes that tell whether all expected TCP segments were received.
- Client → server:
- Add the IP addresses. The blue note says where the packet comes from and where it goes in the end:
10.0.4.3 → 10.0.2.3 TTL 8. Your own IP is on your ID card, and the destination is either a DNS server (ID card) or the answer from the DNS server. The blue note stays the same all the way to the receiver (except the TTL). In a reply, swap the addresses and start a new TTL at 8.
- IP TTL (time to live) limits how many router steps a packet may take. Every router crosses out the old value, writes the new one (value − 1), and discards the packet if it reaches 0 and tells the group leader. This stops packets from circling forever. It has nothing to do with the DNS list.
- Add the next hop. The green note says who should pick up the stack next, which is not necessarily the final receiver. Compare the first three numbers of the destination IP with your own:
- If they are the same, the receiver sits at your table. Look up the IP in your table’s seat list and write that student’s name:
to: Elisa. (In this lab, student names replace the MAC addresses of real devices.) - If they are different, write
to: gatewayas it is router’s job to send the package to another network.
Router’s job is to send IP packets around the room clockwise. Your router sheet has a routing table with only two rows: if the destination is 10.0.T.x (your own table) - deliver locally:
to: Elisa, if it is anything else - pass to the next router in the ring: new green noteto: R5(the router at table 5).- Take the stack and peel off the old green note.
- Read only the blue note. Never look under it.
- Lower the IP TTL by 1. If it’s 0, discard the packet and tell the group leader.
- Look up the destination in your table and stick a new green note on.
- Pass it to the next receiver.
Receiving: unwrap in reverse. Check the notes one by one from the outside in:
- is it for me?
- is the destination my IP?
- is the port one I listen on?
- this is the actual request. Answer it, swapping source and destination.
What if nothing arrives?
Whenever you expect a reply, start a three-minute timer. If nothing has arrived, resend the packet and restart the timer. A lost UDP question gets repeated only because the client asks again, but a lost TCP packet is noticed through the missing ACK. Some packets will be removed by the group leaders on purpose.