Lecture 25 DCN Mac Frame Format

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 31

CSCS 311

Data Communications and Networking


Lecture 25

Lecture Focus:
 Data Link Layer
 MAC Frame Format
Data Link Layer
Framing
 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.
Data Link Layer
Framing
Types of Framing

Fixed-Size Framing
Variable-Size Framing
 Character-oriented approach
 Bit-oriented approach
Data Link Layer
Framing
Types of Framing Variable-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
Framing
Types of Framing Variable-Size Framing : Character-oriented approach

 Figure below shows the format of a frame in a character-


oriented protocol.

Data from upper layer


Variable number of characters
Flag Header Trailer Flag
Data Link Layer
Framing
Types of 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
Framing
Types of 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
Framing
Types of 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
Framing
Types of Framing Variable-Size Framing : Character-oriented approach

Byte-stuffing: Byte stuffing and un-stuffing


Data Link Layer
Framing
Types of 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
Framing
Types of 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
Framing
Types of Framing Variable-Size Framing : Bit-oriented approach

Data from upper layer


Variable number of bits
01111110 Header 0101010111010101001…….10101111111001010 Trailer 01111110

Flag Flag
Data Link Layer
Framing
Types of 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
Framing
Types of 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
Framing
Types of Framing Variable-Size Framing : Bit-oriented approach

Bit-Stuffing

Bit stuffing and un-stuffing


Data Link Layer
Framing
Types of 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
MAC Sublayer: Framing

 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.
Data Link Layer
MAC Sublayer: Framing MAC Frame Format

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.
Data Link Layer
MAC 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.
Data Link Layer
MAC 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.
Data Link Layer
MAC 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.
Data Link Layer
MAC Sublayer: Framing MAC Frame Format

Frame Length
 Standards has imposed restrictions on both the minimum and
maximum lengths of a frame.
Data Link Layer
MAC 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 time
2. The maximum length restriction prevents one station from monopolizing
the shared medium, blocking other stations that have data to send.
Data Link Layer
MAC 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.
Data Link Layer
MAC Sublayer: Framing MAC Frame Format

Ethernet addresses in hexadecimal notation

6 bytes =12 hex digits = 48 bits


Data Link Layer
MAC 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.
Data Link Layer
MAC 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.
Data Link Layer
MAC 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 : 1A
B. 47 : 20 : 1B : 2E : 08 : EE
C. FF : FF: FF: FF : FF : FF

Solution
To 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.
Data Link Layer
MAC 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.
Data Link Layer
MAC 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


First bit sent
Second bit sent
Second bit sent
Data Link Layer
MAC 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?

You might also like