MODULE 02 / NETWORKING FUNDAMENTALS

The Data Link Layer

How local network communication uses frames, MAC addresses, and switching to deliver data across a LAN.

FOUNDATIONCCNA 200-301 ALIGNMENTREAD · UNDERSTAND · TEST

What you will learn

By the end of this module, you should be able to describe how Layer 2 organizes bits into frames, explain the purpose of MAC addresses, distinguish the LLC and MAC sublayers, and understand how local delivery works across a LAN.

  • Explain the purpose and scope of the Data Link Layer.
  • Describe framing, addressing, error detection, and media access.
  • Distinguish the LLC and MAC sublayers in the IEEE 802 model.
  • Identify the purpose and structure of a 48-bit Ethernet MAC address.
  • Explain unicast, multicast, and broadcast delivery at Layer 2.
  • Understand how switches use MAC addresses to forward Ethernet frames.

1. What is the Data Link Layer?

The Data Link Layer (Layer 2) provides node-to-node delivery over a single Layer 2 link or network segment. It takes the bit stream provided by Layer 1 and organizes it into structured units called frames. It defines how devices identify one another on the local link, how access to a shared medium is coordinated, and how certain transmission errors are detected.

Layer 2 is concerned with local delivery. Ethernet switches use destination MAC addresses to decide where to forward frames. Routers operate at Layer 3 and use IP addresses and routing information to move packets between different IP networks.

Framing

Encapsulates Layer 3 packets into frames with defined boundaries and fields.

Local addressing

Uses link-layer addresses, such as Ethernet MAC addresses, to identify interfaces on a LAN.

Error detection

Uses mechanisms such as the Ethernet FCS to detect corrupted frames.

Media access

Defines how devices share and access the transmission medium.

Layer 2 does not replace Layer 3

A host sending data to a destination on another IP network still sends an Ethernet frame to its local default gateway. The IP packet retains the remote destination IP address, but the Ethernet destination MAC address identifies the next hop on the local link. At each routed hop, the Layer 2 frame is removed and a new frame is built for the next link.

2. Encapsulation: packet inside a frame

Ethernet adds a Layer 2 header and trailer around the payload it receives from the Network Layer. This is called encapsulation. The receiving interface checks the frame and passes its payload up the protocol stack when appropriate.

Ethernet frame structureAn Ethernet frame consists of destination MAC address, source MAC address, optional VLAN tag, EtherType or length, payload, and frame check sequence.Ethernet frame (simplified; VLAN tag shown as optional)DestinationMACSourceMAC802.1QoptionalType /LengthPayload / DataFCSCRC6 bytes6 bytes4 bytes2 bytes46–1500 bytes*4 bytesHeaderPayloadTrailer*Traditional Ethernet payload size; VLAN tagging and other Ethernet variants affect frame overhead/size details.Preamble and start-frame delimiter are transmitted before the frame and are not normally counted as part of the MAC frame.
Common Ethernet frame fields. The optional 802.1Q tag adds VLAN identification information.

The destination and source MAC addresses identify the receiving and transmitting interfaces on the local Ethernet segment. The Type field commonly identifies the payload protocol, such as IPv4 (0x0800) or IPv6 (0x86DD). The Frame Check Sequence (FCS) contains a CRC used to detect corruption. It does not correct the corrupted frame; a frame that fails the check is discarded.

Ethernet frame size

A traditional Ethernet frame has a 64-byte minimum and a 1518-byte maximum when counted from destination MAC through FCS, without an 802.1Q tag. A VLAN-tagged frame adds four bytes. The preamble and start-frame delimiter are not included in those frame-size values. Jumbo frames are supported by some devices and networks, but they are not a universal Ethernet requirement.

3. The LLC and MAC sublayers

The IEEE 802 model divides the Data Link Layer into two sublayers. This split separates the interface to Layer 3 protocols from the functions needed to access the physical medium.

Logical Link Control (LLC)

The upper sublayer. Provides an interface to the Network Layer and identifies which Layer 3 protocol is being carried in some link-layer technologies.

Media Access Control (MAC)

The lower sublayer. Handles link-layer addressing and media-access rules, and defines how frames are placed onto the medium.

MAC addresses

A typical Ethernet MAC address is 48 bits (6 bytes), usually written as six hexadecimal octets, for example 00:1A:2B:3C:4D:5E. The first 24 bits are commonly the Organizationally Unique Identifier (OUI), assigned to an organization, and the remaining bits identify an interface within that allocation. Modern address allocation includes additional details, but this is the standard introductory model.

MAC addresses are usually described as Layer 2 addresses. They identify an interface on a local link; they are not used by routers as the end-to-end path identifier. A host can have different MAC addresses on different interfaces, and a Layer 2 frame's source/destination addresses change as a packet crosses a router onto a new link.

Unicast, multicast, and broadcast

Delivery typeDestinationMeaning
UnicastOne specific interfaceOne sender targets one recipient.
MulticastA group addressOne sender targets interested members of a group.
BroadcastFF:FF:FF:FF:FF:FFTargets all devices in the local Layer 2 broadcast domain.

Ethernet broadcast frames are flooded within the VLAN/broadcast domain by switches, but routers do not normally forward Layer 2 broadcasts between IP networks. This is one reason VLANs and IP subnets are commonly designed together.

How a switch uses Layer 2 information

A Layer 2 switch builds a MAC address table by examining the source MAC address of frames it receives. It records the source address and the port on which it arrived. When forwarding a frame, the switch looks up the destination MAC address.

  1. If the destination MAC is known, the switch forwards the frame out the associated port (unless that is the same port on which it arrived).
  2. If the destination is unknown, the switch floods the frame out the other eligible ports in the same VLAN.
  3. Broadcast and many multicast frames are also flooded according to the VLAN and configured forwarding behavior.
Switch MAC learning and forwardingHost A on switch port 1 sends a frame to host B on port 3. The switch learns A's source MAC on port 1, looks up B's destination MAC, and forwards to port 3.Host AMAC: AA-AASwitchMAC address tableAA-AA → Fa0/1BB-BB → Fa0/3Host BMAC: BB-BBPort 1Port 3Frame: source AA-AA · destination BB-BBLearn source on ingress · Look up destination for egressKnown unicast destination → forward only to the matching portIllustrative topology; actual MAC table entries age out after an inactivity timer.
A switch learns from source MAC addresses and forwards based on destination MAC addresses.

What happens when a host sends to a different subnet?

Suppose Host A wants to send an IP packet to a server on a remote network. Host A compares the destination IP with its own subnet. Because the destination is remote, it sends the frame to the MAC address of its default gateway. The frame's destination MAC is the router's local interface, while the IP packet's destination remains the remote server. The router then routes the packet and creates a new Layer 2 frame for the next link.

Layer 2 troubleshooting on IOS XE

show mac address-table
show interfaces status
show interfaces gigabitEthernet 0/0/1
show vlan brief

Use the MAC address table to check which port learned a host's MAC. Check interface status for link and administrative state. On a switch, confirm the port belongs to the intended VLAN. A correct MAC table entry alone does not prove that Layer 3 addressing or routing is correct.

4. Check your understanding

Answer all six questions. After submission, every option receives an explanation so you can see exactly why it is correct or incorrect.

Data Link Layer knowledge check

6 questions · one answer per question · explanations shown after submission

Question 1What is the primary data unit handled by the Data Link Layer?
Question 2Which address does an Ethernet switch normally learn from an incoming frame to update its MAC address table?
Question 3What is the Ethernet broadcast destination MAC address?
Question 4What does the Ethernet Frame Check Sequence (FCS) provide?
Question 5A switch receives a frame for a unicast destination MAC address that is not in its MAC address table. What does it normally do?
Question 6A host sends an IP packet to a server on a different subnet. What is the Ethernet destination MAC address in the first frame?