The Data Link Layer provides a means for exchanging data over a common local media.

The Data Link Layer performs two basic services:

  • Allows the upper layers to access the media using techniques such as framing.
  • Controls how data is placed onto the media and is received from the media using techniques such as media access control and error detection.

Engineering organizations that define open standards and protocols that apply to the Data Link layer include:

  • International Organization for Standardization (ISO)
  • Institute of Electrical and Electronics Engineers (IEEE)
  • American National Standards Institute (ANSI)
  • International Telecommunication Union (ITU)

Unlike the upper layer protocols, which are implemented mostly in software such as the host operating system or specific applications, Data Link layer processes occur both in software and hardware. The procotols at this layer are implemented within the eletronics of the network adapters with which the device connects to the physical network. (e.g. the network interface card(NIC) or a wireless PCMCIA adapter)

The Ethernet

The original version of Ethernet was the first LAN in the world. Ethernet operates in the lower two layers of the OSI model: the Data Link layer and the Physical layer.

Ethernet separates the functions of the Data Link layer into two distinct sublayers:

  1. the Logical Link Control (LLC)
  2. the Media Access Control (MAC)

For Ethernet, the IEEE 802.2 standards describes the LLC sublayer functions. LLC handles the communication between the upper layers and the networking software, and the lower layers, typically the hardware. The LLC sublayer takes the network protocol data, which is typically an IPv4 packet, and adds control information to help deliver the packet to the destination node.

LLC is implemented in software, and its implementation is independent of the physical equipment. In a computer, the LLC can be considered the driver software for the Network Interface Card (NIC).

Media Access Control (MAC)

Media Access Control(MAC) is the lower Ethernet sublayer of the Data Link layer. Media Access Control is implemented by hardware, typically in the computer Network Interface Card(NIC).

The Ethernet MAC sublayer has two primary responsibilities:

  • Data Encapsulation
  • Media Access Control

1, Data Encapsulation

Data encapsulation provides three primary functions:

  • Frame delimiting
  • Addressing
  • Error detection

The Ethernet Frame

  1. Preamble and Start Frame Delimiter Fields: Used for synchronization between the sending and reciving devices.
  2. Destination MAC Address Field: Used by Layer 2 to assist devices in determining if a frame is addressed to them.
  3. Source MAC Address Field: Identifies the frame’s originating NIC or interface.
  4. Length/Type Field: Defines the exact length of the frame’s data field or a type for specific protocol.
  5. Data and Pad Fields: Contains the encapsulated ata from a higher layer.
  6. Frame Check Sequence Field(FCS): Used to detect errors in a frame. It uses a cyclic redundancy check(CRC).

The Ethernet MAC Address

A unique identifier called a Media Access Control(MAC) address was created to assist in determining the source and destination address within an Ethernet network. An Ethernet MAC address is a 48-bit binary value expressed as 12 hexadecimal digits:

2, Ethernet Media Access Control

In a shared media environment, all devices have guaranteed access to the medium. Collisions are the cost that Ethernet pays to get the low overhead associated with each transmission. Ethernet uses CSMA/CD to detect and handle collisions and manage the resumption of communications.

Interframe Spacing

The Ethernet standards require a minimun spacing between two non-colliding frames. This gives the media time to stabilize after the transmission of the prevous frame and time for the devices to process the frame.

Jam Signal

In the event that two devices transmit simultaneously, the network CSMA/CD attempts to resolve the issue. As soon as a collision is detected, the sending devices transmit a 32-bit “jam” singal that will enforce the collision. This ensures all devices in the LAN to detect the collision. It is important that the jam singal not be detected as a valid frame.

Backoff Timing

After a collision occurs and all devices allow the cable to become idel(each waits the full interframe spacing), the devices whose transmissions collided must wait an additional - and potentialyy progressively longer - period of time before attemping to retransmit the collided frame. The waiting period is intentionally designed to be random so that two stations do not delay for the same amount of time before retransmitting. If media congestion results in the MAC layer unable to send the frame after 16 attempts, it gives up and generates an error to the Network layer.

Ethernet - Using Switches

In the last few years, switches have quickly become a fundamental part of most networks. Switches allow the segmentation of the LAN into separate collision domains.

Switches - Selective Forwarding

Ethernet switches selectively forward individual frames from a receiving port to the port where the destination node is conneted. This selective forwarding process can be thought of as establishing a momentary point-to-point connection between the transmitting and receiving nodes.

Forwarding is Based on the Destination MAC

The switch maintains a table, called a MAC table. that matches a destination MAC address with the port used to connect to a node.

Switch Operation

To accomplish their purpose, Ethernet LAN switches use five basic operations:

  1. Learning: Allows switch’s mappings to be dynamically acquired during normal operation.
  2. Aging: There is timestamp to removing old entries in the MAC table.
  3. Flooding: If the switch does not know to which port to send a frame because the destination MAC address is not in the MAC table, the switch sends the frame to all segments, which is known as flooding.
  4. Selective Forwarding: Selective Forwarding is the process of examininga frame’s destination MAC address and forwarding it out the appropriate port.
  5. Filtering: If a frame is not forwarded, or is illegal, or fails a CRC check. switch will drop the frame. An additional reason for filtering a frame is security. A switch has security settings for blocking frames.


评论需要翻墙 for disqus