Module 4 of 5Free to explore

How devices find each other on Ethernet

45–60 minutesTheory and practiceEasy

A workshop has three devices connected to a switch by cables. A pupil wants to print a timetable. The label on the printer says “printer by the window”, but the computer knows it as 192.0.2.20. What happens on the local link so that data can reach it? You will move paper cards between three desks and interpret two observations. No printer, change of settings or network capture is needed.

Cable, interface and frame

A network interface is a point where a device connects to a network. A laptop may have both Ethernet and Wi-Fi. Draw only wired Ethernet for this lesson. All three sample devices are in the same broadcast segment. On such a link, data travels in frames. A frame header includes the address of the sending interface and the destination address. These are MAC addresses. Our examples use six pairs of hexadecimal digits.

The address 02:00:00:00:00:10 identifies an imaginary interface. Its final pair is a convenient label for moving cards. On a real network a matching last pair in an IP and a MAC address does not identify the owner. One computer can have different interface addresses. You can finish the entire exercise using the invented addresses in the table.

How the switch learns

The switch receives a frame on a port. From the source address, it learns which port leads to that address. If it already knows the destination, an ordinary frame can be sent through the corresponding port. In this simple model an unknown destination is flooded to the other ports in the segment. A broadcast frame also goes to the other ports. There are no extra segments or equipment rules in the diagram.

Lay out three port cards and a blank sheet labelled “What the switch knows”. Start with an empty table. You, the reader, know which device is plugged into each port, but the switch learns from arriving frames. Record the source and incoming port before deciding where to send each frame.

Device            port      IPv4          MAC
Desk              1         192.0.2.10    02:00:00:00:00:10
Printer           2         192.0.2.20    02:00:00:00:00:20
Gateway (LAN)     3         192.0.2.1     02:00:00:00:00:01
Frame A:           in 1      source ...:10    destination FF:FF:FF:FF:FF:FF
Frame B:           in 2      source ...:20    destination 02:00:00:00:00:10

What ARP does

To reach the local IPv4 address of the printer, the computer needs the corresponding MAC address. In this example an empty neighbour table makes it send a broadcast ARP request asking who has 192.0.2.20. The gateway also receives the question, but the printer owns the requested address and supplies its MAC address. The computer can keep that mapping in a neighbour table for a time. There an IP is paired with a MAC. The switch table connects a MAC address with a port. A home appliance can contain both functions, but the two tables answer different questions.

Check the direction of frame B. Its source ends in 20 and its destination in 10, so the printer is replying to the computer. This establishes that a local reply could travel back. It says nothing about whether a print job was accepted, paper was loaded or the application sent the timetable.

Practice. Walk two cards through the model

  1. Label the devices and connect each to a separate numbered port in the centre. Start with an empty switch table and an empty neighbour table on the computer. If you shorten MAC addresses, include a legend with the full values.
  2. Read frame A. Learn one source address. Place copies of the question at ports 2 and 3. Why is a copy unnecessary at incoming port 1? Mark both devices that receive the request, then mark the one that answers.
  3. Walk reply B through the switch. Add the second source to its table. Was the destination already known? On the computer’s separate sheet, record the printer’s IP and MAC. Underline the table entry that makes it possible to choose port 2 next time.
  4. Try a third card saying “computer sends an ordinary frame to printer”. Use the table as it now stands. Compare the number of outgoing ports with frame A and cite the earlier observation that explains the difference.

Look at your own settings

If available, open the details of your active network in Windows Settings, macOS Network settings or your Linux desktop’s active connection. Look for a physical or hardware address. Record the interface type and the format, without copying the address. On some devices Wi-Fi uses a private address for a specific network. You do not need a live neighbour table to finish the paper exercise.

After B the switch has learned two addresses, while the computer has one newly learned mapping for the printer. The gateway received a question but sent no frame. The switch had no source observation from which to learn its address. If you added a third row, identify the exact moment when you thought that happened and correct the sheet. For more context see the medium access chapter in Tanenbaum, Feamster and Wetherall, Computer Networks. The ARP standard, RFC 826

Try the idea yourself

Why a service cannot be reached

Change the conditions and observe this training model. It runs in your browser and does not change your computer.

DNS→Firewall→HTTPS :443
Observation

Choose conditions above to see an explanation of the result.

Independent exercise

Move the printer to a different port in the model and keep its MAC address. Can the switch learn the move?

Evidence

Before: MAC …:20 → port 2; MAC …:10 → port 1
Frame C: incoming port 4; source …:20; destination …:10

Assignment

Update the table after C. Give the outgoing port for C and the port for a subsequent reply.

Compare your reasoning

The entry for …:20 now leads to port 4. The known destination …:10 is on port 1, so C leaves through 1. A reply from …:10 to …:20 leaves through 4.

Personal practice environment

Check an excerpt, find matching lines and compute the SHA-256 of the original text. Temporary data expires after 30 minutes or when you close the environment.