TCP/IP layers – encapsulation, MAC and IP addresses, TCP vs UDP

Computer ScienceNetworks & the InternetAges 17–18

Loading…

Use with my class ✨ Customize with AI Report a problem

Follow data from an application (HTTP, HTTPS, SMTP, POP3, IMAP, FTP, DNS or a video call) as it is wrapped layer by layer – data, a TCP segment or UDP datagram with ports, an IP packet with IP addresses, a Wi-Fi or Ethernet frame with MAC addresses – sent across routers and a switch, and unwrapped at the receiver. Compare the 4-layer TCP/IP model with the 7-layer OSI model, watch MAC addresses change at every hop while IP addresses stay the same, and add packet loss to see TCP resend lost segments while UDP does not.

Lesson: Network protocols and layers: the TCP/IP stack and the OSI model, encapsulation, ports, IP and MAC addresses, TCP and UDP

What it shows

Network software is built in layers. On the sending computer each layer adds its own header: the transport layer adds port numbers (TCP also numbers the bytes), the internet layer adds the source and destination IP addresses, and the link layer wraps everything in a frame with MAC addresses. A switch reads only the frame; a router removes it, reads the destination IP address and builds a new frame for the next link, so MAC addresses change at every hop while IP addresses stay the same. TCP confirms delivery with ACKs and resends lost data; UDP does not.

How to use

Choose an Application and a Layer model, then set Routers, Packet loss at each router and Pieces of data. Watch the packets move down the layers at A and up at B; tap a packet to see its nested headers. Use Pause and Step to go event by event, compare the Headers on each link table, and press Send again after changing a setting to add a new row to Runs.

Parameters you can change

  • Application protocol HTTP – request a web page, HTTPS – secure web page, SMTP – send an email, POP3 – download email, IMAP – read email on the server, FTP – upload a file, DNS – look up names (UDP), Video call – RTP (UDP)
  • Layer model TCP/IP (4 layers), OSI (7 layers)
  • Number of routers on the path 1–4
  • Packet loss at each router 0–30 %
  • Number of pieces of data (segments or datagrams) 1–6
  • Animation speed 1–5

Questions to explore

  1. Why does the destination MAC address change after every router while the destination IP address stays the same?
  2. Up to which layer does a switch read a frame, and up to which layer does a router read it?
  3. With 20% loss, how do TCP and UDP behave differently, and why does a video call use UDP?