Lecture Focus: Data Communications and Networking Data Link Layer MAC Frame Format Lecture 25 CSCS...

31
Lecture Focus: Data Communications and Networking Data Link Layer MAC Frame Format Lecture 25 CSCS 311

description

Types of Framing Framing Fixed-Size Framing Variable-Size Framing  Character-oriented approach  Bit-oriented approach Data Link Layer

Transcript of Lecture Focus: Data Communications and Networking Data Link Layer MAC Frame Format Lecture 25 CSCS...

Page 1: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Lecture Focus:

Data Communications and Networking

Data Link Layer MAC Frame Format

Lecture 25

CSCS 311

Page 2: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link Layer

Main functions of the data link layer: Framing Flow control Error control Software implemented protocols that provide smooth and reliable transmission of frames between nodes Media Access Methods

Framing deals with how to organize the bits that are carried by the physical layer.

The data link layer packs bits into frames, so that each frame is distinguishable from another.

Framing

Page 3: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Fixed-Size FramingVariable-Size Framing

Character-oriented approach Bit-oriented approach

Data Link Layer

Page 4: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

FramingVariable-Size Framing : Character-oriented approach

Data to be carried are 8-bit characters from a coding system such as ASCII.

The header normally carries the source and destination addresses and other control information, and

The trailer carries error detection or error correction redundant bits Both header and trailer are also multiples of 8 bits.

To separate one frame from the next, an 8-bit (1 byte) flag is added at the beginning and the end of a frame. The flag, composed of special characters, signals the start or end

of a frame.

Data Link Layer

Page 5: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Character-oriented approach

Figure below shows the format of a frame in a character-oriented protocol.

Flag Header Trailer Flag

Data from upper layer

Variable number of characters

Data Link Layer

Page 6: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Character-oriented approach

Character-oriented framing was popular when only text was exchanged by the data link layers. The flag could be selected to be any character not used for text communication.

Now, we send other types of information such as graphs, audio, and video.

Any pattern used for the flag could also be part of the information. If this happens, the receiver, when it encounters this pattern in the

middle of the data, thinks it has reached the end of the frame.

Data Link Layer

Page 7: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Character-oriented approach

Byte-stuffing: To fix this problem, a byte-stuffing strategy was added to

character-oriented framing. In byte stuffing (or character stuffing), a special byte is

added to the data section of the frame when there is a character with the same pattern as the flag.

The data section is stuffed with an extra byte. This byte is usually called the escape character (ESC),

which has a predefined bit pattern.

Whenever the receiver encounters the ESC character, it removes it from the data section and treats the next character as data, not a delimiting flag.

In byte stuffing, we add 1 extra byte whenever there is a flag or escape character in the text.

Data Link Layer

Page 8: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Character-oriented approach

Byte-stuffing: Byte stuffing by the escape character allows the presence

of the flag in the data section of the frame, but it creates another problem.

What happens if the text contains one or more escape characters followed by a flag? The receiver removes the escape character, but keeps the flag, which is incorrectly interpreted as the end of the frame.

To solve this problem, the escape characters that are part of the text must also be marked by another escape character. In other words, if the escape character is part of the text, an extra one is added to show that the second one is part of the text.

Data Link Layer

Page 9: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Character-oriented approach

Byte-stuffing: Byte stuffing and un-stuffing

Data Link Layer

Page 10: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Character-oriented approach

Character-oriented protocols present another problem in data communications.

The universal coding systems in use today, such as Unicode, have 16-bit and 32-bit characters that conflict with 8-bit characters.

The tendency is moving toward the bit-oriented protocols.

Data Link Layer

Page 11: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Bit-oriented approach

The data section of a frame is a sequence of bits to be interpreted by the upper layer as text, graphic, audio, video, and so on.

However, in addition to headers (and possible trailers), we still need a delimiter to separate one frame from the other.

Most protocols use a special 8-bit pattern flag 01111110 as the delimiter to define the beginning and the end of the frame.

Data Link Layer

Page 12: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Bit-oriented approach

01111110 Header 0101010111010101001…….10101111111001010 Trailer 01111110

Data from upper layer

Variable number of bits

Flag Flag

Data Link Layer

Page 13: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Bit-oriented approach

Bit-Stuffing This flag can create the same type of problem we saw in the byte-

oriented protocols. That is, if the flag pattern appears in the data, we need to somehow inform the receiver that this is not the end of the frame.

We do this by stuffing 1 single bit (instead of 1 byte) to prevent the pattern from looking like a flag.

In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra 0 is added.

This extra stuffed bit is eventually removed from the data by the receiver.

Note that the extra bit is added after one 0 followed by five 1s regardless of the value of the next bit.

This guarantees that the flag field sequence does not inadvertently appear in the frame.

Data Link Layer

Page 14: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Bit-oriented approach

Bit-Stuffing

Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data, so that the receiver does not mistake the pattern 0111110 for a flag.

Data Link Layer

Page 15: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Bit-oriented approach

Bit-Stuffing

Bit stuffing and un-stuffing

Data Link Layer

Page 16: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Types of Framing

Framing

Variable-Size Framing : Bit-oriented approach

Bit-Stuffing

If the flag like pattern 01111110 appears in the data, it will change to 011111010 (stuffed) and is not mistaken as a flag by the receiver.

The real flag 01111110 is not stuffed by the sender and is recognized by the receiver.

Data Link Layer

Page 17: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link Layer

The MAC sublayer governs the operation of the access method.

It also frames data received from the upper layer and passes them to the physical layer.

Frame Format The frame contains seven fields:

Preamble SFD DA SA Length of protocol data unit (PDU) Upper-layer data CRC.

MAC Sublayer: Framing

Page 18: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing

Preamble: The first field of the frame contains 7 bytes (56 bits) of alternating

0s and 1s that alerts the receiving system to the coming frame. The pattern provides only an alert. The 56-bit pattern allows the stations to miss some bits at the

beginning of the frame. The preamble is actually added at the physical layer and is not

(formally) part of the frame.

MAC Frame Format

Page 19: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Start frame delimiter (SFD): Second field (1 byte: 10101011) signals the beginning of the frame. The last 2 bits are 11 and alerts the receiver that the next field is

the destination address.

Page 20: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Destination Address (DA): The DA field is 6 bytes and contains the physical address of the

destination station or stations to receive the packet.

Source address (SA): The SA field is also 6 bytes and contains the physical address of

the sender of the packet.

Page 21: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Length: This field is defined as a length field to define the number of bytes in

the data field.Data:

This field carries data encapsulated from the upper-layer protocols. It is a minimum of 46 and a maximum of 1500 bytes.

CRC: This field contains error detection information, in this case a CRC-32.

Page 22: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Frame Length Standards has imposed restrictions on both the minimum and

maximum lengths of a frame.

Page 23: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

If the upper-layer packet is less than 46 bytes, padding is added to make up the difference.

The maximum length restriction has two historical reasons:1. Memory was very expensive at that time2. The maximum length restriction prevents one station from monopolizing

the shared medium, blocking other stations that have data to send.

Page 24: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Addressing: Each station on an Ethernet network (such as a PC, workstation, or

printer) has its own network interface card (NIC). The NIC fits inside the station and provides the station with a 6-byte

physical address. The Ethernet address is 6 bytes (48 bits), normally written in

hexadecimal notation, with a colon between the bytes.

Page 25: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Ethernet addresses in hexadecimal notation

6 bytes =12 hex digits = 48 bits

Page 26: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Ethernet addresses in hexadecimal notation

Unicast, Multicast, and Broadcast Addresses: A source address is always a unicast address-the frame comes

from only one station. The destination address can be unicast, multicast, or broadcast. Figure below shows how to distinguish a unicast address from a

multicast address. If the least significant bit of the first byte in a destination

address is 0, the address is unicast; otherwise, it is multicast.

Page 27: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Ethernet addresses in hexadecimal notation

Unicast, Multicast, and Broadcast Addresses:

A unicast destination address defines only one recipient; the relationship between the sender and the receiver is one-to-one.

A multicast destination address defines a group of addresses; the

relationship between the sender and the receivers is one-to-many.

The broadcast address is a special case of the multicast address; the recipients are all the stations on the LAN. A broadcast destination address is forty-eight (48) 1s.

Page 28: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Unicast, Multicast, and Broadcast Addresses:

Example:Define the type of the following destination addresses:

A. 4A : 30 : 10 : 21 : 10 : 1AB. 47 : 20 : 1B : 2E : 08 : EEC. FF : FF: FF: FF : FF : FF

SolutionTo find the type of the address, look at the second hexadecimal digit from the left. If it is even, the address is unicast. If it is odd, the address is multicast. If all digits are F's, the address is broadcast.

A. This is a unicast address because A in binary is 1010 (even).B. This is a multicast address because 7 in binary is 0111 (odd).C. This is a broadcast address because all digits are F's.

Page 29: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Unicast, Multicast, and Broadcast Addresses:

The way the addresses are sent out on line is different from the way they are written in hexadecimal notation.

The transmission is left-to-right, byte by byte. However, for each byte, the least significant bit is sent first and

the most significant bit is sent last.

This means that the bit that defines an address as unicast or multicast arrives first at the receiver.

Page 30: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing MAC Frame Format

Unicast, Multicast, and Broadcast Addresses:

Example:Show how the address 47 : 20 : 1B : 2E : 08 : EE is sent out on line.

Solution:The address is sent left-to-right, byte by byte; for each byte, it is sent right-to-left, bit by bit, as shown below:

4 7 : 2 0 : 1 B : 2 E : 0 8 : E E 0100 0111: 0010 0000 : 0001 1011: 0010 1110: 0000 1000: 1110 1110

Sent in the following order:

1110 0010 0000 0100 11011000 0111 0100 0001 0000 0111 0111

First bit sent

Second bit sentFirst bit sent

Second bit sent

Page 31: Lecture Focus: Data Communications and Networking  Data Link Layer  MAC Frame Format Lecture 25 CSCS 311.

Data Link LayerMAC Sublayer: Framing

Exercises: What is the hexadecimal equivalent of the following Ethernet address?

01011010 00010001 01010101 00011000 10101010 00001111

How does the Ethernet address 1A:2B:3C:AD:5E:6F appear on the line in binary?

If an Ethernet destination address is 07:01:02:03:04:05, what is the type of the address (unicast, multicast, or broadcast)?

The address 43:7B:6C:DE:10:00 has been shown as the source address in an Ethernet frame. The receiver has discarded the frame. Why?

An Ethernet MAC sublayer receives 42 bytes of data from the upper layer. How many bytes of padding must be added to the data?

An Ethernet MAC sublayer receives 1510 bytes of data from the upper layer. Can the data be encapsulated in one frame? If not, how many frames need to be sent? What is the size of the data in each frame?