0% found this document useful (0 votes)
13 views63 pages

Lec10 11

Uploaded by

Luqman ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views63 pages

Lec10 11

Uploaded by

Luqman ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

• Data Link Layer

Data Link Layer


• Data Link Layer is second layer of OSI Layered Model. This
layer is one of the most complicated layers and has complex
functionalities and liabilities. Data link layer hides the details of
underlying hardware and represents itself to upper layer as the
medium to communicate.
• Data link layer works between two hosts which are directly
connected in some sense. This direct connection could be point
to point or broadcast. Systems on broadcast network are said to
be on same link. The work of data link layer tends to get more
complex when it is dealing with multiple hosts on single collision
domain.
• Data link layer is responsible for converting data stream to
signals bit by bit and to send that over the underlying hardware.
At the receiving end, Data link layer picks up data from
hardware which are in the form of electrical signals, assembles
them in a recognizable frame format, and hands over to upper
layer.
• Data link layer has two sub-layers:
• Logical Link Control: It deals with protocols, flow-control, and
error control.
• Media Access Control: It deals with actual control of media.
Data Link Layer
• Data Link Layer has two sub-layers,
• Logical Link Control (LLC):
This is the uppermost sub-layer, LLC consists of protocols running at
the top of the data link layer, and also provides flow control,
acknowledgment, and error notification. The LLC provides
addressing and data link control. It specifies which methods are to
be used for addressing channels over the transmission medium and
for controlling the data exchanged between the generator of packet
and recipient of the message.
• Media Access Control (MAC):
Who can access the media at any one time, determines by the MAC
sub-layer(e.g. CSMA/CD).
Data Link Layer in the OSI Model
• The Open System
Interconnections (OSI) model is
a layered networking framework
that conceptualizes how
communications should be done
between heterogeneous
systems. Its three lower OSI
layers are called the network
support layers. The data link
layer is the second lowest layer.
• The following diagram depicts
the position of the data link layer
where a transmission is done
from a sending machine to a
receiving machine.
Data Link Layer
• The main task of the data link layer is to transform a raw
transmission facility into a line that appears free of undetected
transmission errors to the network layer. It accomplishes this
task by having the sender break up the input data into data
frames(typically a few hundred or few thousand bytes) and
transmit the frames sequentially. If the service is reliable, the
receiver confirms correct receipt of each frame by send back
an acknowledgement frame.
Functions of Data Link Layer
• Framing
• Addressing
• Synchronization
• Error Control.
• Flow Control.
• Multi-Access.
Framing
• Data-link layer takes packets from
Network Layer and encapsulates
them into Frames. Then, it sends
each frame bit-by-bit on the
hardware. At receiver’ end, data
link layer picks up signals from
hardware and assembles them into
frames.
• Or
• The data link layer receives the
stream of bits from the network
layer divides into manageable data
units called frames.
Parts of a Frame
• A frame has the following parts −
• Frame Header − It contains the
source and the destination
addresses of the frame.
• Payload field − It contains the
message to be delivered.
• Trailer − It contains the error
detection and error correction bits.
• Flag − It marks the beginning and
end of the frame.
Types of Framing
• Framing can be of two types, fixed sized framing and variable sized
framing.
• Fixed-sized Framing
• Here the size of the frame is fixed and so the frame length acts as
delimiter of the frame. Consequently, it does not require additional
boundary bits to identify the start and end of the frame.
• Example − ATM cells.
• Variable – Sized Framing
• Here, the size of each frame to be transmitted may be different. So
additional mechanisms are kept to mark the end of one frame and
the beginning of the next frame.
• It is used in local area networks.
Physical Addressing
• The Data Link layer adds a
header to the frame in order to
define physical address of the
sender or receiver of the frame, if
the frames are to be distributed
to different systems on the
network.
Synchronization
• When data frames are sent on the link, both machines must be
synchronized in order to transfer to take place.
Error Control
• Sometimes signals may have encountered problem in transition and
the bits are flipped. These errors are detected and attempted to recover
actual data bits. It also provides error reporting mechanism to the
sender.
• Or
• The data link layer also deals with damaged or lost frames. By adding
mechanisms to detect and retransmit lost frames increases reliability.
Error Control
• When data-frame is transmitted, there is a probability that data-frame may be lost in the transit or it is received corrupted.
In both cases, the receiver does not receive the correct data-frame and sender does not know anything about any loss. In
such case, both sender and receiver are equipped with some protocols which helps them to detect transit errors such as loss
of data-frame. Hence, either the sender retransmits the data-frame or the receiver may request to resend the previous data-
frame.
• Requirements for error control mechanism:
• Error detection - The sender and receiver, either both or any, must ascertain that there is some error in the transit.
• Positive ACK - When the receiver receives a correct frame, it should acknowledge it.
• Negative ACK - When the receiver receives a damaged frame or a duplicate frame, it sends a NACK back to the sender
and the sender must retransmit the correct frame.
• Retransmission: The sender maintains a clock and sets a timeout period. If an acknowledgement of a data-frame
previously transmitted does not arrive before the timeout the sender retransmits the frame, thinking that the frame or it’s
acknowledgement is lost in transit.
Flow Control
• Stations on same link may have different speed or capacity. Data-link
layer ensures flow control that enables both machine to exchange data
on same speed.
• Or
• If the rate at which the data are consumed by the receiver is less than
the rate produced by the sender, the data link layer deals with a flow
control mechanism to prevent overrun the receiver.
Flow Control
• When a data frame (Layer-2 data) is sent from one host to another
over a single medium, it is required that the sender and receiver should
work at the same speed. That is, sender sends at a speed on which the
receiver can process and accept the data. What if the speed
(hardware/software) of the sender or receiver differs? If sender is
sending too fast the receiver may be overloaded, (swamped) and data
may be lost.
• Two types of mechanisms can be deployed to control the flow:
• Stop and Wait.
• Sliding Window.
Stop and Wait
• This flow control mechanism
forces the sender after
transmitting a data frame to stop
and wait until the
acknowledgement of the data-
frame sent is received.
Sliding Window
• This protocol improves the efficiency of stop and wait protocol by allowing multiple
frames to be transmitted before receiving an acknowledgment.
• The working principle of this protocol can be described as follows −
• Both the sender and the receiver has finite sized buffers called windows. The sender and
the receiver agrees upon the number of frames to be sent based upon the buffer size.
• The sender sends multiple frames in a sequence, without waiting for acknowledgment.
When its sending window is filled, it waits for acknowledgment. On receiving
acknowledgment, it advances the window and transmits the next frames, according to the
number of acknowledgments received.
Multi-Access
• When host on the shared link tries to transfer the data, it has a high
probability of collision. Data-link layer provides mechanism such as
CSMA/CD (Carrier Sense Multiple Access with Collision Detection)
to equip capability of accessing a shared media among multiple
Systems.
• Or
• When more than two or two devices are connected to the common
link, data link layer protocols are necessary to determine which device
has control over the link at any point of time.
Learning Objectives

• Process-to-process delivery
• Client Server
• Addresses
• Connectionless and Connection Oriented Services
PROCESS-TO-PROCESS
DELIVERY
The transport layer is responsible for process-to-process
delivery
• The delivery of a packet,
• part of a message,
• from one process to another.
• Two processes communicate in a client/server
relationship.
Client/Server
• A client gets services from a process usually on the
remote host called a server e.g daytime client and server

• For communications, we must define following:


• Local host
• Local process
• Remote host
• Remote process
Addresses
• Data Link
• MAC Addressing
• Network Layer
• IP Addressing
• Transport Layer
• Port Addressing
• Destination port required for delivery and source port required
to receive reply
• Port numbers are 16 – bit integers ranging from
0 – 65,535
• Socket Addressing
• combination of an IP address and port number
Socket
Address
• The transport layer is responsible for process-to-process
delivery
• IANA (Internet Assigned Number Authority) Ranges
• Well Known Ports ranging from 0 to 1023 are assigned and
controlled by IANA
• Registered Ports ranging from 1024 to 49,151 are not
assigned or controlled by IANA
• They can only be registered with IANA to prevent
duplication
• Dynamic Ports ranging from 49,152 to 65,535 are neither
registered nor controlled by IANA. They can be used by
any process
Multiplexing and Demultiplexing

• At the sender site there may be several processes.


However there is only one transport protocol
• This is many to one relation and requires multiplexing
• A protocol accepts messages from different processes,
differentiated by their assigned port numbers.
• After adding header, the transport layer passes the packet
to network layer.
Multiplexing and Demultiplexing
Connectionless vs. Connection oriented Services
• A transport layer protocol can be either connectionless or
connection oriented
• Connectionless Services
• The packets are sent from one site to another with no need of
connection establishment or release
• The packets are not numbered. There is no
acknowledgement
• They may be delayed, lost or reach out of sequence e.g UDP
• Connection Oriented Services
• Connection is first established between the sender and the
receiver
• Data transferred and then connection released
Reliable vs. Unreliable Protocol

• If the application layer program require reliability, we use


reliable transport protocol by implementing flow and error
control at transport layer
• Reliable protocol is slower and more complex while
unreliable protocol (without flow and error control) is fast
and simple
• Unreliable protocol can be used by real time applications
• UDP is unreliable while TCP is a reliable protocol
TCP and UDP

• The emphasis of this curriculum is on TCP/IP


Ethernet networks.
• The TCP/IP protocol of the OSI model Layer 4
(transport layer) has two protocols - TCP and UDP.
Both TCP and UDP use port (or socket) numbers to pass
information to the upper layers.
Client-Server
Model
It defines:
• Which process may begin the interaction?
• Which process may answer?
• How error conditions may be managed?
Process classification
Client process: the process that requires a service
Server process: the process that provides the required
service
The client requires a service, the server provides the
service and makes available the results to the client
Client-Server
Model

• To make any use of the Internet, application programs


should run on the two endpoints of a network
connection.
• The applications are the entities that communicate with
each other to exchange services
• “Client” applications request service
• “Server” applications provide service.
Client-Server Relationship: Many-to-One
• Servers
• Run all the time (i.e. infinite)
• Provide service to any client
• Typically specialize in providing a
certain type of service, e.g. Mail.
• Listen to a well-known port and
passively open connection.

• Clients
• Run when needed, then terminate
(i.e. finite)
• Actively Open TCP or UDP
connection with Server’s socket.
Communication Services

• Connection oriented reliable service


• Connectionless unreliable service
Internet Provides two services to its distributed applications:
• Connection Oriented Reliable Service
• It guarantees that data transmitted from a sender to a
receiver will eventually be delivered to the receiver
in order and in its entirety.
• Connectionless Unreliable Service
• It does not make any guarantees about eventual
delivery.
• Note: Distributed applications makes use of one
or the other (but not both) of these two services.
• Thus, Internet is an infrastructure in which new applications
are being constantly invented and deployed.
Connection Oriented Service
• Reliable Data Transfer
• Using acknowledgements & retransmissions
• Flow Control
• sender won’t overwhelm receiver
• Congestion Control
• senders “slow down sending rate” when network
congested
• TCP
• Applications using TCP are:
• HTTP (Web), FTP (file transfer), Telnet
(remote login), SMTP (email)
Connectionless Service
• Unreliable Data Transfer
• no flow control
• no congestion control
• Fast
• connectionless
• UDP
• Applications using UDP are:
• multimedia, videoconferencing, DNS, Internet
telephony
TCP Vs. UDP
• Reliable Protocol • Unreliable Protocol
• Connection Oriented • Connectionless
• Performs three ways • Much faster than TCP
handshake • No acknowledgement waits
• Provision for error detection • No proper sequencing of
and retransmission data units
• Most applications use TCP • Suitable for applications
for reliable and guaranteed where speed matters more
transmission than reliability
Application Layer Protocols:
• DHCP
• SMTP
• SNMP
• POP
• WLAN
• POP
• WWW
• HTTP
• TELNET
• FTP
• TFTP
• DNS
Client-Server Model

• A model where there is a server, which manages some resource,


and a number of clients which send requests to the server to access
the resource.
• A Client is a program running on the local machine requesting
service from a server .
• Active Open: A client opens the communication channel using the
IP address of the remote host and the well known port numbers of
the specific server program running on that machine. This is called
active open .
• Active Close: After a channel of communication is opened, the
client sends its request and receives a response ,At that moment ,the
client closes the communication channel with an active close .
• A Server is a program running on the remote machine and provide
services to the clients
Protocols

• A protocol is a set of rules that


governs data communication.
• A protocols defines:
• What is communicated?
• How it is communicated ?
• When it is communicated?
Key Elements of a Protocol

• Syntax
• Data formats
• Semantics
• Control information
• Error handling
• Timing
• Speed matching
• Sequencing
MAC vs. Network Addresses

• A MAC address can be compared to your name and the


network address to your mailing address. For example, if
you were to move to another town, your name would
remain unchanged, but your mailing address would
indicate your new location. Network devices (routers as
well as individual computers) have both a MAC address
and a protocol (network layer) address.

• When you physically move a computer to a different


network, the computer maintains the same MAC address,
but you must assign it a new network address.
IP Addressing

• The Internet Protocol (IP) is the most popular


implementation of a hierarchical network addressing
scheme. IP is the network protocol the Internet uses.
• As information flows down the layers of the OSI model,
the data is encapsulated at each layer. At the network
layer, the data is encapsulated within packets (also
known as datagrams).

• IP determines the form of the IP packet header (which


includes addressing and other control information), but
does not concern itself with the actual data -- it accepts
whatever is passed down from the higher layers
DHCP
• Dynamic Host Configuration Protocol
(DHCP) is a protocol that a PC can use to
automatically obtain an IP number over the
network from a DHCP server.
• DHCP is A client-server program designed
to provide information dynamically
• Used to assign addresses dynamically
SNMP
• Simple Network Management Protocol (SNMP) is a
popular protocol for network management.
• It is used for collecting information from, and configuring,
network devices, such as servers, printers, hubs, switches,
and routers on an Internet Protocol (IP) network.
• It works on Application layer.
• It uses port numbers 161,162
SMTP

• Stands for "Simple Mail Transfer Protocol."


• This is the protocol used for sending e-mail over the
Internet.
• SMTP is a push protocol; it pushes the message from the
client to the server
• SMTP uses port number 25
• It Works on application layer
WLAN
• A provides wireless network communication over
short distances using radio or infrared signals
instead of traditional network cabling.
• WLANs are built by attaching a device called the
access point (AP) to the edge of the wired
network.
• Clients communicate with the AP using a
wireless network adapter similar in function to a
traditional Ethernet adapter
Post Office Protocol (POP)
• used to retrieve e-mail from a mail server.
• it pulls the messages from mail server the client.
• It is application layer protocol.
• It uses port number 110.
WWW

• The World Wide Web (WWW) is a repository of


information linked together from points all over
the world.
• The WWW today is a distributed client server
service, in which a client using a browser can
access a service using a server.
HTTP
• HTTP (Hypertext Transfer Protocol) is the set of rules
for transferring files (text, graphic images, sound,
video, and other multimedia files) on the WWW.
• The Hypertext Transfer Protocol (HTTP) is a protocol
used mainly to access data on the World Wide Web.
• HTTP is an application Layer protocol.
• It uses port number 80
TELNET

• is an abbreviation for TErminaL NETwork.


• It is the standard TCP/IP protocol for virtual terminal
service.
• TELNET enables the establishment of a connection to a
remote system.
• TELNET is a general-purpose client/server application
program.
• It works on application layer.
• TELNET uses only one TCP connection
• It uses port 23.
FTP

• FTP uses the services of TCP. It needs two TCP


connections. The well-known port 21 is used for the control
connection, and the well-known port 20 is used for the data
connection.

• File Transfer Protocol (FTP) is a standard network


protocol used to transfer files from one host to another host
over a TCP-based network, such as the Internet
Trivial File Transfer Protocol (TFTP)
• It is generally used for automated transfer of
configuration or boot files between machines in a
local environment.
• It is a simplified version of FTP.
• unlike FTP, TFTP has no login feature (it does not
prompt for user name and password).
• TFTP uses UDP port 69 to establish network
connections
Domain Name System (DNS)

• The DNS translates Internet domain and host names


to IP addresses.
• DNS automatically converts the names we type in
our Web browser address bar to the IP addresses of
Web servers hosting those sites.
• It uses port number 53.
• It is application layer service.
Bootstrap/Bootp
• is a network protocol used by a network client to
obtain an IP address from a configuration server.
• BOOTP is usually used during the bootstrap
process when a computer is starting up.
• The bootstrap protocol (BOOTP) is a host
configuration protocol developed before DHCP

You might also like