Um momento
0x10Lesson 2 of 7

Deliver frames on a local network

Distinguish link-layer addresses from network addresses.

15 min 4-question quiz 1 code exercise
By the end of this lesson you can
  • Describe how a switch uses MAC addresses to forward local frames.

On a typical Ethernet LAN, a frame carries source and destination MAC addresses. A switch learns which source MAC addresses arrive on each port and uses that table to forward later frames. MAC delivery is local to a link; IP addresses identify endpoints across networks. Address resolution connects the two on an IPv4 LAN.

network_demo.py
switch_table = {"aa:10": "port 1", "bb:20": "port 2"}
destination = "bb:20"
print(switch_table.get(destination, "flood local ports"))
Output
port 2

If a switch does not know a destination MAC, it usually floods the frame to the other ports in that VLAN, then learns from the reply. ARP is one IPv4 mechanism used to discover a local MAC address for a next-hop IP address.

Key takeaways

  • Describe how a switch uses MAC addresses to forward local frames.

  • The code examples simulate protocol behavior; they do not send network traffic.

  • Use the layer model to locate where an address, port, or message belongs.

Lesson quiz

4 questions · pass with 3 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Practice: model networking concepts

Use small Python programs to model packet, address, and protocol behavior. These exercises run locally in your browser and do not send network traffic.

Exercise 1

Look up a switch port

+25 XP

Use the learned MAC table to print the destination port, or flood local ports when the address is unknown.

  • Known destination
  • Unknown destination
main.py
Loading editor…

Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: