04. Ethernet Switch
An Ethernet frame wraps an Internet Layer packet (like an IP packet) with a header and trailer.
- Ethernet II
- Dominant format used today.
- Identified by a 2-byte
EtherType
field that has a value of0x0800
or greater. This field directly indicates the protocol of the encapsulated payload (e.g.,0x0800
for IPv4,0x0806
for ARP).
- IEEE 802.3
- An older standard.
- In the same position as the
EtherType
field, it has a 2-byteLength
field. If the value of this field is less than0x0600
, the receiving station knows it indicates the length of the data payload, not the protocol type.
An Ethernet switch (Layer 2) is the traffic controller of a local network. Its goal is to forward data frames only to their intended recipient.
A switch stores a MAC Address Table, implemented with a Content-Addressable Memory (CAM; offers high-speed lookups).
- Provide the data (MAC address) and it gives back the location (switch port number).
- Entry: (MAC address, port number, aging timer)
Algorithm
- Learn: updates CAM table with source MAC address (resets aging timer).
- Examines destination MAC address:
- Forward (unicast): if the dest. is known and on a different port, send the frame to that port.
- Filter: if the dest. is on the same port, drop the frame.
- Flood: if the dest. is unknown or is the broadcast address (
FF:FF:FF:FF:FF:FF
), send a copy out to every port (except source).