Data link layer
Download
Report
Transcript Data link layer
Network Models
2.1 what is the Protocol?
• A protocol defines the rules that both the
sender and receiver and all intermediate
devices need to follow, to be able to
communicate effectively.
• In the network telecommunication, we need
to divide the communication task between
different layers, in which case we need a
protocol or more at each layer.
Figure 2.16 Layers and protocols in the reference protocol model
2.3
Communication through an internet
Communication through an internet ()
Data units of each layer
messages
Segments or datagrams
packets
frames
bits
Figure 2.5 Physical layer
The physical layer is responsible for movements of
individual bits from one hop (node) to the next.
2.7
Figure 2.6 Data link layer
The data link layer is responsible for moving
frames from one hop (node) to the next.
2.8
Figure 2.7 Hop-to-hop delivery
2.9
Figure 2.8 Network layer
The network layer is responsible for the
delivery of individual packets from
the source host to the destination host.
2.10
Figure 2.9 Source-to-destination delivery
2.11
Figure 2.10 Transport layer
The transport layer is responsible for the delivery
of a message from one process to another.
2.12
Figure 2.11 Reliable process-to-process delivery of a message
2.13
Figure 2.14 Application layer
2.14
The application layer is responsible for
1- providing services to the user.
2- dialog control and synchronization.
3- translation, compression, and encryption.
2.15
Figure 2.17 Addresses in TCP/IP
2.16
Figure 2.18 Relationship of layers and addresses in TCP/IP
2.17
Figure 2.19 Physical addresses
2.18
Figure 2.20 IP addresses
2.19
Figure 2.21 Port addresses
2.20
THE DATA LINK LAYER
3.1 DATA LINK LAYER functions
• 1. Providing a well-defined service interface to
the network layer.
• 2. Framing: breaking up the bit stream into
discrete frames
• 3. Error control
• 4. Flow control: Regulating the flow of data so
that slow receivers are not swamped by fast
senders.
1-Providing a well-defined service
interface to the network layer.
• the data link layer takes the packets it gets
from the network layer and encapsulates
them into frames for transmission.
• Each frame contains:
– a frame header,
– a payload field for holding the packet,
– and a frame trailer,
Packets and Frames
Relationship between packets and frames.
3.1.2 Framing
• A good design of framing must make it easy
for a receiver to find the start of new frames
while using little of the channel bandwidth.
We will look at four methods:
– 1. Byte count.
– 2. Flag bytes with byte stuffing.
– 3. Flag bits with bit stuffing.
– 4. Physical layer coding violations.
1. Byte count.
• This method uses a field in the header to specify
the number of bytes in the frame. When the data
link layer at the destination sees the byte count,
it knows how many bytes follow and hence
where the end of the frame is.
• Trouble with this algorithm is that when the
count is incorrectly received, the destination
will get out of synchronization with
transmission.
2. Flag bytes with byte stuffing.
• This method resolves the problem of
resynchronization after an error by having each
frame start and end with special bytes (flag byte)
is used as both the starting and ending delimiter.
• Two consecutive flag bytes indicate the end of
one frame and the start of the next.
• Thus, if the receiver ever loses synchronization, it
can just search for two flag bytes to find the end
of the current frame and the start of the next
frame.
2. Flag bytes with byte stuffing.
If the actual data contains a byte that is identical to the
FLAG byte (e.g., picture, data stream, etc.) the convention
that can be used is to have escape character inserted just
before the “FLAG” character.
2. Flag bytes with byte stuffing.
3. Flag bits with bit stuffing.
• Each frame begins and ends with a special bit
pattern, e.g 111111 , five consecutive 1s .
• Whenever the sender’s data link layer encounters
five consecutive 1s in the data it automatically
stuffs a 0 bit into the outgoing bit stream.
• With both bit and byte stuffing, a problem is that
the length of a frame now depends on the
contents of the data it carries.
4. Physical layer coding violations
• This method is to use a shortcut from the
physical layer.
• We can use some reserved signals to indicate
the start and end of frames.
• it is easy to find the start and end of frames
and there is no need to stuff the data.
3.1.3 Error Control
4 ways for error control:
• computing a checksum (a short token) for each
frame, and include it in the frame. When a
frame arrives at the destination, the checksum is
recomputed.
• The usual way to ensure reliable delivery is to
calls for the receiver to send back special control
frames bearing positive or negative
acknowledgements about the incoming frames.
3.1.3 Error Control ()
• When the sender transmits a frame, it generally
also starts a timer. The timer is set to expire after
an interval long enough for the frame to reach
the destination; if either the frame or the
acknowledgement is lost, the timer will go off,
alerting the sender to a potential problem.
• frames may be transmitted multiple times; To
prevent this from happening, it is generally
necessary to assign sequence numbers to
outgoing frames