OSI Data Link Layer

57
OSI Data Link Layer Network Fundamentals Chapter 7

description

OSI Data Link Layer. Network Fundamentals Chapter 7. Objectives. Explain the role of Data Link layer protocols in data transmission. Describe how the Data Link layer prepares data for transmission on network media. Describe the different types of media access control methods. - PowerPoint PPT Presentation

Transcript of OSI Data Link Layer

Page 1: OSI Data Link Layer

OSI Data Link Layer

Network Fundamentals

Chapter 7

Page 2: OSI Data Link Layer

Objectives

Explain the role of Data Link layer protocols in data transmission.

Describe how the Data Link layer prepares data for transmission on network media.

Describe the different types of media access control methods.

Identify several common logical network topologies and describe how the logical topology determines the media access control method for that network.

Page 3: OSI Data Link Layer

Objectives

Explain the purpose of encapsulating packets into frames to facilitate media access.

Describe the Layer 2 frame structure and identify generic fields.

Explain the role of key frame header and trailer fields including addressing, QoS, type of protocol and Frame Check Sequence.

Page 4: OSI Data Link Layer

Outline

Data link layer: Accessing the media Supporting and connecting to upper-layer

services Controlling transfer across local media Creating a frame Connecting upper-layer services to the media Data link sublayers Standards

Page 5: OSI Data Link Layer

Outline

MAC techniques: Placing data on the media MAC for shared media MAC for non-shared media Logical topology vs. physical topology

MAC: Addressing and framing data Data link layer protocol: the frame Framing: role of the header Addressing: where the frame goes Framing: Role of the trailer Sample data link layer frames

Page 6: OSI Data Link Layer

Data Link Layer: Accessing the Media

Packets traveling from source to destination may need to travel over different physical networks. Consist of different types of physical media such as copper

wires, microwave, optical fiber and satellite link. Can be LAN or WAN.

Data link layer provides a means for transferring packets over a physical network. Repackage a packet (network-layer PDU) into frames. Controls the frames’ access to the media.

There are various data link layer protocols for different types of physical network.

Page 7: OSI Data Link Layer

Data Link Layer: Accessing the Media

Page 8: OSI Data Link Layer

Supporting and Connecting to Upper-layer Services Data link layer performs two basic services:

Allows the upper layers to access the media using techniques such as framing. Framing is the process of taking a packet (network-layer

PDU), and adding an appropriate header and trailer to create a data link layer PDU (frame).

Controls how data is placed onto the media and is received from the media using techniques such as media access control (MAC) and error detection.

Given a particular physical network, the data link layer is responsible for the transmission of data between source and destination devices connected to this network.

Page 9: OSI Data Link Layer

Supporting and Connecting to Upper-layer Services

Data link layer is implemented by all the hosts and intermediary devices (routers and switches).

At each hop along the path, a router processes the frame as follows: Accept the frame from physical media Perform data link-layer processes such as error checking Decapsulate the frame into packet Construct a new frame appropriate for the next media Forward the packet inside the new frame across the next

segment of the physical network

Page 10: OSI Data Link Layer

Controlling Transfer Across Local Media

The technique for getting a frame on and off a media is called media access control (MAC).

Different media requires a different MAC technique. MAC defines the processes by which network devices can

access the network media and transmit frames in diverse network environments.

Intermediary devices such as a router may need to connect two different physical networks. Requires the ability to send frames to the different physical

networks by using suitable MAC methods. Must know how to encapsulate the packet into the

appropriate frame, based on the protocol used.

Page 11: OSI Data Link Layer

Controlling Transfer Across Local Media

11

A router has an Ethernet interface to connect to LAN and a serial interface to connect to WAN

Packet is received with an encapsulation used by LAN technology and the router reencapsulate the packet into a frame supported by the protocol used in the WAN.

Page 12: OSI Data Link Layer

Creating a Frame

Frame is the term given to data link layer PDU. A frame consists of a header, data and a trailer.

Header: Control information put in front of the PDU. Data: Network-layer PDU. Trailer: Control information added to the end of the PDU.

Both the header and trailer contain fields that carry control information required for data link layer operations. The actual fields available inside the header and trailer

depend on the protocol used.

Page 13: OSI Data Link Layer

Creating a Frame

Page 14: OSI Data Link Layer

Connecting Upper-layer Services to the Media

Data link layer exists as a connecting layer between the software processes of the layer above it and the hardware physical layer below it.

Data link layer is implemented inside the network interface card. Implemented in hardware and software. Hardware: circuitry of the network interface card. Software: firmware running on the processor of

the network interface card.

Page 15: OSI Data Link Layer

Connecting Upper-layer Services to the Media

Page 16: OSI Data Link Layer

Data Link Sublayers

To allow more flexibility in supporting a wide variety of network functions, data link layer is sub-divided into two sublayers. Upper sublayer: defines the software processes that

provide services to the network layer protocols. Example: Logical link control (LLC)

Lower sublayer: defines the media access process performed by the hardware. Example: Media access control (MAC)

Separating into sublayers allows one type of frame defined by the upper layer to access different types of media defined by the lower layer.

Page 17: OSI Data Link Layer

Data Link Sublayers

Page 18: OSI Data Link Layer

Standards

Unlike upper layer protocols (application, transport and network layer protocols), data link layer protocols are not defined by RFC. Recall that RFC are standard documents maintained by

IETF to describe TCP/IP protocols. Data link layer protocols are described by

engineering organizations such as: International Organization for Standardization (ISO) Institute of Electrical and Electronics Engineers (IEEE) American National Standards Institute (ANSI) International Telecommunication Union (ITU)

Page 19: OSI Data Link Layer

Standards

Page 20: OSI Data Link Layer

MAC Techniques: Placing Data on the Media

Regulating the placement of data frames onto the media is known as MAC (media access control).

The MAC method used depends on: Media sharing: If and how the nodes share the

media. Topology: How the connection between the nodes

appears to the data link layer.

Page 21: OSI Data Link Layer

MAC for Shared Media

Some network topologies share a common medium with multiple nodes.

At any time, there can be a number of devices attempting to send and receive data using the network media. Need to prevent all these devices from transmitting at the

same time. Otherwise collision may occur. Collision means the signals from the different devices get

mixed up in the media and all the signals would then become unuseable.

MAC is used to prevent (or reduce) this from happening.

Page 22: OSI Data Link Layer

MAC for Shared Media

There are two basic MAC methods for shared media. Controlled: Each node has its own time to use the medium. Contention-based: All nodes compete for the use of the

medium.

Method Characteristics Examples

Controlled access • Only one station transmit at a time• Devices wanting to transmit must wait for their turn• No collision• Some networks used token passing

Token Ring, FDDI

Contention-based access

• Station can transmit at any time• Collision may happen• Mechanisms exist to resolve contention• CSMA/CD for Ethernet networks• CSMA/CA for 802.11 wireless network

Ethernet, Wireless

Page 23: OSI Data Link Layer

Controlled MAC

In this method, network devices take turn to access the media.

During its turn, the device can either: Send a frame (if it has data to send). Pass the turn to the next device (if it has no data to send).

Collision can never occur because when a device is transmitting, the other devices cannot transmit.

This method is well ordered and provides predictable output.

But it can be inefficient because a device has to wait for its turn before it can use the medium.

Page 24: OSI Data Link Layer

Contention-based MAC

In this method, network devices can try to access the medium whenever it has data to send.

To prevent collisions from happening, a technique called CSMA (carrier sense multiple access) is used. CSMA refers to the technique where the device first detect

whether the media is carrying any signal. If a signal is detected, that means another device is

transmitting. The device only transmit if it sense that the network is idle. Otherwise it will wait and try again later.

Page 25: OSI Data Link Layer

Contention-based MAC Due to the use of CSMA, the probability of collision

to happen is very low. However, collision can still happen when two

devices transmit at exactly the same time. In this case, the data transmitted by both devices will be

corrupted and need to be retransmitted. CSMA is usually implemented in conjunction with a

method for resolving the media contention (what to do to avoid collision).

The two commonly used methods are: CSMA/collision detection (CSMA/CD) CSMA/collision avoidance (CSMA/CA)

Page 26: OSI Data Link Layer

CSMA/CD

The device senses the media for the presence of data signal.

If no data signal detected, indicating that the media is free, the device transmits the data.

While transmitting, the device keeps sensing the media in case collision occurs.

If collision occurs: Send a jamming signal to let all other devices know that

collision has happened. All devices involved will stop transmission immediately. Try to send again after a short period of time.

Page 27: OSI Data Link Layer

CSMA/CA

The device senses the media for the presence of data signal.

If the media is free, the device will reserve the whole media for a certain duration. Done by broadcasting a message to tell all the

other nodes that it wants to reserve the media. Once the media is reserved by a device, the

other devices will not transmit within the reserved duration. Therefore collision will never occur.

Page 28: OSI Data Link Layer

MAC for Non-shared Media

Non-shared media is commonly characterized by a point-to-point connection. There are only two devices, each at one end of the link.

In this case, there is no need to worry about collision. Therefore, the MAC procedure is simpler.

The only issue is the transmission duplex. Simplex: Only one of the device can send. Half-duplex: Both devices can send, but only one at a time. Full-duplex: Both devices can send at the same time.

Page 29: OSI Data Link Layer

Logical Topology vs. Physical Topology

Topology of a network refers to the arrangement of the network devices and the interconnections between them.

Network topologies can be viewed at the physical level and the logical level.

Physical topology An arrangement of the nodes and the physical connections

between them. Logical topology

The way a network transfers frame from one node to the next.

Page 30: OSI Data Link Layer

Logical Topology vs. Physical Topology

It is the logical topology that influences the type of network framing and media access control used.

Physical topology of a network may not be the same as the logical topology.

Physical topologies used in network: point-to-point, bus, ring, star.

Logical topologies used in network: point-to-point, multi-access (bus), ring.

Page 31: OSI Data Link Layer

Logical Topology vs. Physical Topology

Page 32: OSI Data Link Layer

Logical Point-to-point Topology

Connects two nodes directly together. Logically, not necessarily physically. The logical connection between the two nodes is

called a virtual circuit. Since there are only two devices, no special

addressing is required. Frames from one device is confirmed to be for the

other device. MAC protocol can be very simple.

Page 33: OSI Data Link Layer

Logical Point-to-point Topology

Page 34: OSI Data Link Layer

Logical Multi-access Topology

A number of nodes communicate using the same shared media.

To avoid collision, the MAC protocol will make sure that only one node can transmit at a time.

The frame transmitted by a node will be received by all nodes attached to the shared media.

But only the actual receiver will take and process the frame. The receiving node is identified using an address called the

MAC address.

Page 35: OSI Data Link Layer

Logical Multi-access Topology

Page 36: OSI Data Link Layer

Logical Ring Topology

A number of nodes communicate using the same shared media.

To avoid collision, each node takes turn transmitting. The turn is implemented by using a token. The token is passed around from node to node. Only the node that holds the token can transmit.

The transmitted frame will be received in turn by each node. The node checks the destination MAC address. If it is not the destination, the frame will be passed to the

next node.

Page 37: OSI Data Link Layer

Logical Ring Topology

Page 38: OSI Data Link Layer

Data Link Layer Protocols: The Frame

The data link layer protocols describe the operations required to transport packets across different media.

To enable the operations to be carried out, the sending node must include relevant control information inside the frame. This control information is put inside the frame’s header

and trailer.

When the receiving node receives the frame, the header and trailer will be read and the required operations will be performed.

Page 39: OSI Data Link Layer

Framing: Role of the Header

The actual fields included inside a frame’s header depends on the protocol.

However, the following fields are commonly included: Start frame field: To indicate the beginning of the frame. Source and destination address fields: To identify the

source and destination nodes on the media. Priority / Quality of Service field: To indicate a particular

type of communication service for processing. Type field: To indicate the upper layer service contained in

the frame.

Page 40: OSI Data Link Layer

Framing: Role of the Header

Logical connection control field: Used to establish a logical connection between nodes.

Physical link control field: Used to establish the media link. Flow control field: Used to start and stop traffic over the

media. Congestion control field: To indicate congestion in the

media.

A data link layer protocol may use several of the fields mentioned above, depending on the features that it provides.

Page 41: OSI Data Link Layer

Addressing: Where the Frame Goes

Device address at the data link layer is known as the physical address or the MAC address.

Whether or not a device needs to have a physical address depends on the logical topology used.

In point-to-point topology, no address is required since there is only one possible destination.

In multi-access or ring topology, physical address is very important. There are multiple nodes connected to the media. If a node sends a frame, all the nodes will receive it. Physical address is required to identify the actual receiver.

Page 42: OSI Data Link Layer

Addressing: Where the Frame Goes

Page 43: OSI Data Link Layer

Addressing: Where the Frame Goes The physical address is associated with the device’s

network interface card. Burned inside the NIC’s ROM. Cannot be changed. The address is always the same no

matter where the device go. The source and destination node’s physical

addresses are put inside the header of a frame. These addresses must be the address of devices attached

to the local network on which the frame is to be transmitted.

If the frame is to be forwarded to devices on a different network, the frame must be decapsulated and a new frame with appropriate addresses must be constructed.

Page 44: OSI Data Link Layer

Framing: Role of the Trailer

A trailer is attached at the end of a frame. The actual content of the trailer is protocol

dependent, but the following fields are common. Frame check sequence (FCS) field: Used for error

checking. Stop field: Used to indicate the end of a frame or to

increase the size of a frame to an expected size. The FCS field contains an error detection code.

Error detection is important because it is always possible for data bits to get corrupted during transmission.

The receiver needs to know whether the frame received contains data that is correct.

Page 45: OSI Data Link Layer

Framing: Role of the Trailer

The error detection code is calculated by the sender. Can be done by using various error detection schemes. Involves some mathematical calculation. The error detection scheme commonly used data link layer

is called cyclic redundancy check (CRC). The error detection code obtained from the calculation is

put inside the FCS field in the trailer. The receiver would then use the error detection

code to check whether the received frame contains error or not. Also done by performing some mathematical calculation.

Page 46: OSI Data Link Layer

Sample Data Link Layer Frames

Internetwork has two types of environment: LAN and WAN.

Both LAN and WAN have different requirements for frames to be transmitted across them. They have different logical topology, physical media and

bandwidth. Therefore, different protocols are required.

There are also different types of LANs and WANs, each requiring different link layer protocols.

Here, we will look at several examples of link layer protocols and their frames.

Page 47: OSI Data Link Layer

Ethernet Protocol for LANs

Ethernet is a family of LAN networking technologies that are defined in the IEEE 802.2 and 802.3 standards. There are many sub-categories of Ethernet, each used in

LAN environment. However, all of them use the same frame format.

Used for shared media that uses the multi-access logical topology. Uses CSMA/CD as the media access control method.

Ethernet provides unacknowledged connectionless service.

Page 48: OSI Data Link Layer

Ethernet Protocol for LANs

Page 49: OSI Data Link Layer

Ethernet Protocol for LANs

Ethernet frame fields: Preamble: Used for time synchronization. Destination address: 48-bit MAC address of the destination

node. Source address: 48-bit MAC address of the source node. Type: A value to indicate the upper-layer protocol that will

receive the data. Data or payload: The network layer PDU, typically an IPv4

packet. Frame check sequence (FCS): Contains the CRC code

used for error detection.

Page 50: OSI Data Link Layer

Point-to-point Protocol (PPP) for WANs

PPP is used to deliver frames in a point-to-point logical topology. It is popular protocol to implement serial WANs.

PPP can be used on various physical media, including twisted pair, fiber optic lines, and satellite transmission, as well as for virtual connections. To accommodate different types of physical media, PPP

establishes a logical connection called sessions between the two nodes.

This hides the physical media from the upper layer protocol.

Makes PPP more flexible to be used for different media.

Page 51: OSI Data Link Layer

Point-to-point Protocol (PPP) for WANs

PPP also allows the two nodes to negotiate options within the PPP session. Authentication: Requires the nodes on each end

of the PPP link to authenticate in order to establish connection.

Compression: Reduces the size of data frame transmitted and therefore reduces the time required to transfer the frame.

Multilink: Allows the use of multiple physical links to support a single PPP session.

Page 52: OSI Data Link Layer

Point-to-point Protocol (PPP) for WANs

Page 53: OSI Data Link Layer

Point-to-point Protocol (PPP) for WANs

PPP frame fields: Flag: Contains the binary sequence 01111110 to indicate

the beginning and end of the frame. Address: Contains the binary sequence 11111111 which is

the standard PPP broadcast address. Control: Contains the binary sequence 00000011. which

means transmission in an unsequenced frame. Protocol: A value to indicate the upper-layer protocol that

will receive the data. Data: The network layer PDU, typically an IPv4 packet. FCS: Contains a 16-bit (or 32-bit) error detection code.

Page 54: OSI Data Link Layer

WiFi Protocol for Wireless LANs

WiFi is defined by the IEEE 802.11 standard. Used for wireless LAN transmission.

Uses CSMA/CA as the media access control method.

Uses acknowledgement to confirm that a frame is received successfully.

Other services supported: Authentication Association (connectivity to a wireless device) Privacy (encryption)

Page 55: OSI Data Link Layer

WiFi Protocol for Wireless LANs

Page 56: OSI Data Link Layer

WiFi Protocol for Wireless LANs

WiFi frame fields: Protocol version: The version of 802.11 protocol used. Type and subtype: Identifies one of the three functions and

subfunctions of frames – control, data and management. To DS: Set to 1 in data frames destined for the distribution

system (devices in the wireless infrastructure). From DS: Set to 1 for frames exiting the distribution

system. More fragments: Set to 1 for frames that have another

fragment. Retry: Set to 1 if the frame is a retransmission of an earlier

frame.

Page 57: OSI Data Link Layer

WiFi Protocol for Wireless LANs

Power management: Set to 1 to indicate that a node will be in power-save mode.

More data: Set to 1 to indicate to a node in power-save mode that more frames are buffered for that node.

Wired Equivalent Privacy (WEP): Set to 1 if the frame contains data that is WEP encrypted.

Order: Set to 1 in a data type frame that uses strictly ordered service class (does not need reordering).

Fragment number: Indicate the number for each fragment of a frame.

Frame body: Contains the the network layer PDU, typically an IPv4 packet.

FCS: Contains a 32-bit cyclic redundancy check (CRC) code of the frame.