Computer Communication Network Notes

Download as pdf or txt
Download as pdf or txt
You are on page 1of 47

CANARA

MODULE-1 V SEM Computer Communication Networks[21EC53]

ENGINEERING COLLEGE
Benjanapadavu, Mangalore-574219

NOTES
Computer Communication Networks
For 5TH Semester (CBCS)
Course Code: 21EC53
Prepared By :Rajitha A A

Module- 1
Introduction
Network Models
and
Data-Link Layer

DEPARTMENT OF
ELECTRONICS & COMMUNICATION
ENGINEERING

Department of ECE,CEC 1
MODULE-1 V SEM Computer Communication Networks[21EC53]

MODULE 1
SYLLABUS:

Introduction: Data communication: Components, Data representation, Data flow, Networks: Network criteria,
Physical Structures, Network types: LAN, WAN, Switching, The Internet. (1.1,1.2, 1.3(1.3.1to 1.3.4 of Text).

Network Models: TCP/IP Protocol Suite: Layered Architecture, Layers in TCP/IP suite, Description of layers,
Encapsulation and Decapsulation, Addressing, Multiplexing and Demultiplexing, The OSI Model: OSI Versus
TCP/IP. (2.1, 2.2, 2.3 of Text)

Data- Link Layer: Introduction: Nodes and Links, Services, Categories of link, Sublayers, Link Layer
addressing: Types of addresses, ARP.

Text Books:

Forouzan, Data Communications and Networking, 5th Edition, McGraw Hill, 2013, ISBN: 1-25906475-3.

Department of ECE,CEC 2
MODULE-1 V SEM Computer Communication Networks[21EC53]

DATA COMMUNICATION

1.1 INTRODUCTION

• The term telecommunication, which includes telephony, telegraphy and television, means
communication at a distance (tele is Greek for “far”). The word data refers to information presented in
whatever form is agreed upon by the parties creating and using the data.
• Data communications are the exchange of data between two devices via some form of transmission
medium such as a wire cable. For data communications to occur, the communicating devices must be part
of a communication system made up of a combination of hardware (physical equipment) and software
(programs).
The effectiveness of a data communications system depends on four fundamental characteristics: Delivery,
Accuracy, Timeliness, and Jitter.
Delivery: The system must deliver data to the correct destination. Data must be received by the intended device
or user and only by that device or user.
Accuracy: The system must deliver the data accurately. Data that have been altered in transmission and left
uncorrected are unusable.
Timeliness: The system must deliver data in a timely manner. Data delivered late are useless. In the case of
video and audio, timely delivery means delivering data as they are produced, in the same order that they are
produced and without significant delay. This kind of delivery is called real-time transmission.
Jitter: Jitter refers to the variation in the packet arrival time. It is the uneven delay in the delivery of audio or
video packets. For example, let us assume that video packets are sent every 30ms. If some of the packets arrive
with 30-ms delay and others with 40-ms delay, an uneven quality in the video is the result.

1.2 COMPONENTS

Message: The message is the information (data) to be communicated. Popular forms of information include
text, numbers, pictures, audio, and video.
Sender: The sender is the device that sends the data message. It can be a computer, workstation, telephone
handset, video camera, and so on.

Department of ECE,CEC 3
MODULE-1 V SEM Computer Communication Networks[21EC53]

Fig. 1: Five components of data communication


Receiver: The receiver is the device that receives the message. It can be a computer, workstation, telephone
handset, television, and so on.
Transmission medium: The transmission medium is the physical path by which a message travels from sender
to receiver. Some examples of transmission media include twisted-pair wire, coaxial cable, fiber optic cable, and
radio waves.
Protocol: A protocol is a set of rules that govern data communications. It represents an agreement between the
communicating devices. Without a protocol, two devices may be connected but not communicating, just as a
person speaking French cannot be understood by a person who speaks only Japanese.

1.3 DATA REPRESENTATION:


Information today comes in different forms such as text, numbers, images, audio, and video.

TEXT

In data communications, text is represented as a bit pattern, a sequence of bits (0’s or 1’s). Different sets of bit
patterns have been designed to represent text symbols.

• Each set is called a code, and the process of representing symbols is called coding. Today, the prevalent coding
system is called Unicode, which uses 32 bits to represent a symbol or character used in any language in the
world.

• The American Standard Code for Information Interchange (ASCII), developed some decades ago in the United
States, now constitutes the first 127 characters in Unicode and is also referred to as Basic Latin.

NUMBERS

• Numbers are also represented by bit patterns.

Department of ECE,CEC 4
MODULE-1 V SEM Computer Communication Networks[21EC53]

• Here code such as ASCII is not used to represent numbers, but the number is directly converted to a
binary number to simplify mathematical operations.

IMAGES
• Images are also represented by bit patterns. In its simplest form, an image is composed of a matrix of
pixels (picture elements), where each pixel is a small dot. The size of the pixel depends on the resolution.

• For example, an image can be divided into 1000 pixels or 10,000 pixels. In the second case, there is a
better representation of the image (better resolution), but more memory is needed to store the image.

• After an image is divided into pixels, each pixel is assigned a bit pattern. The size and the value of the
pattern depend on the image. For an image made of only black- and-white dots (e.g., a chessboard), a 1-
bit pattern is enough to represent a pixel.

• If an image is not made of pure white and pure black pixels, we can increase the size of the bit pattern to
include gray scale. For example, to show four levels of gray scale, we can use 2-bit patterns. A black
pixel can be represented by 00, a dark gray pixel by 01, a light gray pixel by 10, and a white pixel by 11.

• There are several methods to represent color images. One method is called RGB, so called because each color
is made of a combination of three primary colors: red, green, and blue. The intensity of each color is
measured, and a bit pattern is assigned to it. Another method is called YCM, in which a color is made of a
combination of three other primary colors: yellow, cyan, and magenta.

AUDIO

• Audio refers to the recording or broadcasting of sound or music.

• Audio is by nature different from text, numbers, or images. It is continuous, not discrete, when we use a
microphone to change voice or music to an electric signal, we create a continuous signal.
VIDEO

• Video refers to the recording or broadcasting of a picture or movie.

• Video can either be produced as a continuous entity (e.g., by a TV camera), or it can be a combination of
images, each a discrete entity, arranged to convey the idea of motion.

Department of ECE,CEC 5
MODULE-1 V SEM Computer Communication Networks[21EC53]

1.4 DATA FLOW


Communication between two devices can be simplex, half-duplex, or full-duplex as shown in Fig.2.

SIMPLEX

• In simplex mode, the communication is unidirectional, as on a one-way street. Only one of the two
devices on a link can transmit; the other can only receive (see Fig. 2.a).

• Keyboards and traditional monitors are examples of simplex devices. The keyboard can only introduce
input, the monitor can only accept output. The simplex mode can use the entire capacity of the channel to
send data in one direction.
HALF-DUPLEX

• In half-duplex mode, each station can both transmit and receive, but not at the same time. When one
device is sending, the other can only receive, and vice versa (see Fig. 2.b).

• The half-duplex mode is like a one-lane road with traffic allowed in both directions. When cars are
traveling in one direction, cars going the other way must wait.

• In a half-duplex transmission, the entire capacity of a channel is taken over by whichever of the two
devices is transmitting at the time.

• Walkie-talkies and CB (citizens band) radios are both half-duplex systems.

Department of ECE,CEC 6
MODULE-1 V SEM Computer Communication Networks[21EC53]

• The half-duplex mode is used in cases where there is no need for communication in both directions at the
same time; the entire capacity of the channel can be utilized for each direction.

FULL-DUPLEX

In full-duplex mode (also called duplex), both stations can transmit and receive simultaneously (see Fig. 2.c).

• The full-duplex mode is like a two-way street with traffic flowing in both directions at the same time. In
full-duplex mode, signals going in one direction share the capacity of the link with signals going in the
other direction.

• This sharing can occur in two ways: Either the link must contain two physically separate transmission
paths, one for sending and the other for receiving; or the capacity of the channel is divided between
signals traveling in both directions.

• One common example of full-duplex communication is the telephone network. When two people are
communicating by a telephone line, both can talk and listen at the same time.

• The full-duplex mode is used when communication in both directions is required all the time. The
capacity of the channel, however, must be divided between the two directions.

1.5 NETWORKS

• A network is the interconnection of a set of devices capable of communication. In this definition, a


device can be a host (or an end system as it is sometimes called) such as a large computer, desktop,
laptop, workstation, cellular phone, or security system.

• A device in this definition can also be a connecting device such as a router, which connects the network
to other networks, a switch, which connects devices together, a modem (modulator-demodulator), which
changes the form of data, and so on.

• These devices in a network are connected using wired or wireless transmission media such as cable or
air. When we connect two computers at home using a plug-and-play router, we have created a network,
although very small.

Department of ECE,CEC 7
MODULE-1 V SEM Computer Communication Networks[21EC53]

➢ NETWORK CRITERIA

A network must be able to meet a certain number of criteria. The most important of these are performance,
reliability, and security.
Performance

• Performance can be measured in many ways, including transit time and response time. Transit time is the
amount of time required for a message to travel from one device to another. Response time is the elapsed
time between an inquiry and a response.

• The performance of a network depends on a number of factors, including the number of users, the type of
transmission medium, the capabilities of the connected hardware, and the efficiency of the software.

• Performance is often evaluated by two networking metrics: throughput and delay. We often need more
throughput and less delay. However, these two criteria are often contradictory.

• If we try to send more data to the network, we may increase throughput but we increase the delay
because of traffic congestion in the network.
Reliability
In addition to accuracy of delivery, network reliability is measured by the frequency of failure, the time it takes a
link to recover from a failure and the network’s robustness in a catastrophe.

Security
Network security issues include protecting data from unauthorized access, protecting data from damage and
development and implementing policies and procedures for recovery from breaches and data losses.

➢ PHYSICAL STRUCTURES
Before discussing networks, we need to define some network attributes. Some of them are:
Type of connection

• A network is two or more devices connected through links. A link is a communications pathway that
transfers data from one device to another.

• For visualization purposes, it is simplest to imagine any link as a line drawn between two points. For
communication to occur, two devices must be connected in some way to the same link at the same time.

• There are two possible types of connections: point-to-point and multipoint.

Department of ECE,CEC 8
MODULE-1 V SEM Computer Communication Networks[21EC53]

Point-to-point
• A point-to-point connection provides a dedicated link between two devices. The entire capacity of the link is

reserved for transmission between those two devices.

• Most point-to-point connections use an actual length of wire or cable to connect the two ends, but other

options, such as microwave or satellite links, are also possible (Fig. 3a).

• When we change television channels by infrared remote control, we are establishing a point-to-point

connection between the remote control and the television’s control system.

Fig. 3: Types of connections: point-to-point and multipoint

Multipoint

• A multipoint (also called multidrop) connection is one in which more than two specific devices share a
single link (Fig. 3b).

• In a Multipoint environment the capacity of the channel is shared, either spatially or temporally
• If several devices can use the link simultaneously, it is a spatially shared connection. If users must take turns,
it is a timeshared connection.

➢ PHYSICAL TOPOLOGY

• The term physical topology refers to the way in which a network is laid out physically. Two or more
devices connect to a link; two or more links form a topology.

• The topology of a network is the geometric representation of the relationship of all the links and linking
devices (usually called nodes) to one another.

• There are four basic topologies possible: mesh, star, bus, and ring.

Department of ECE,CEC 9
MODULE-1 V SEM Computer Communication Networks[21EC53]

MESH TOPOLOGY
• In a mesh topology, every device has a dedicated point-to-point link to every other device. The term
dedicated means that the link carries traffic only between the two devices it connects. To find the number
of physical links in a fully connected mesh network with n nodes, we first consider that each node must
be connected to every other node.

• Node 1 must be connected to n – 1 nodes, node 2 must be connected to n – 1 nodes, and finally node n
must be connected to n – 1 nodes. We need n (n – 1) physical links. However, if each physical link
allows communication in both directions (duplex mode), we can divide the number of links by 2.

• In other words, we can say that in a mesh topology, we need n (n – 1) / 2 duplex-mode links. To
accommodate that many links, every device on the network must have n – 1 input/output (I/O) ports (see
Figure 1.4) to be connected to the other n – 1 stations.

Fig. 4: A fully connected mesh topology (five devices)


A mesh offers several advantages:

• The use of dedicated links guarantees that each connection can carry its own data load, thus eliminating
the traffic problems that can occur when links must be shared by multiple devices.

• Mesh topology is robust. If one link becomes unusable, it does not incapacitate the entire system.

• Privacy or security: When every message travels along a dedicated line, only the intended recipient sees

it. Physical boundaries prevent other users from gaining access to messages.

Department of ECE,CEC 10
MODULE-1 V SEM Computer Communication Networks[21EC53]

• Point-to-Point links make fault identification and fault isolation easy. Traffic can be routed to avoid links
with suspected problems. This facility enables the network manager to discover the precise location of
the fault and aids in finding its cause and solution.

The main disadvantages of a mesh are related to the amount of cabling and the number of I/O ports
required.

• Here, every device must be connected to every other device, installation and reconnection are difficult.

• The sheer bulk of the wiring can be greater than the available space (in walls, ceilings, or floors) can
accommodate.

• The hardware required to connect each link (I/O ports and cable) can be prohibitively expensive.
• For the above reasons a mesh topology is usually implemented in a limited fashion, for example, as a
backbone connecting the main computers of a hybrid network that can include several other topologies.
• One practical example of a mesh topology is the connection of telephone regional offices in which each
regional office needs to be connected to every other regional office.
STAR TOPOLOGY

• In a star topology, each device has a dedicated point-to-point link only to a central controller, usually
called a hub. The devices are not directly linked to one another.

• Unlike a mesh topology, a star topology does not allow direct traffic between devices. The controller acts
as an exchange: If one device wants to send data to another, it sends the data to the controller, which then
relays the data to the other connected device (see Fig. 5).
• A star topology is less expensive than a mesh topology. In a star, each device needs only one link and one
I/O port to connect it to any number of others. This factor also makes it easy to install and reconfigure.
Far less cabling needs to be housed, and additions, moves, and deletions involve only one connection:
between that device and the hub.

• Other advantages include robustness. If one link fails, only that link is affected. All other links remain
active. This factor also lends itself to easy fault identification and fault isolation. As long as the hub is
working, it can be used to monitor link problems and bypass defective links.

Department of ECE,CEC 11
MODULE-1 V SEM Computer Communication Networks[21EC53]

Fig. 5: A star topology connecting four stations

• Other advantages include robustness. If one link fails, only that link is affected. All other links remain
active. This factor also lends itself to easy fault identification and fault isolation. As long as the hub is
working, it can be used to monitor link problems and bypass defective links.

• One big disadvantage of a star topology is the dependency of the whole topology on one single point, the
hub. If the hub goes down, the whole system is dead.

• Although a star requires far less cable than a mesh, each node must be linked to a central hub. For this
reason, often more cabling is required in a star than in some other topologies (such as ring or bus).

• High-speed LANs often use a star topology with a central hub.

BUS TOPOLOGY
The preceding examples all describe point-to-point connections. A bus topology, on the other hand, is
multipoint. One long cable act as a backbone to link all the devices in a network (Fig. 6).

Fig. 6: A bus topology connecting three stations

Department of ECE,CEC 12
MODULE-1 V SEM Computer Communication Networks[21EC53]

• Nodes are connected to the bus cable by drop lines and taps. A drop line is a connection running between
the device and the main cable. A tap is a connector that either splices into the main cable or punctures the
sheathing of a cable to create a contact with the metallic core.

• As a signal travels along the backbone, some of its energy is transformed into heat. Therefore, it becomes
weaker and weaker as it travels farther and farther. For this reason, there is a limit on the number of taps
a bus can support and on the distance between those taps.

• Advantages of a bus topology include ease of installation. Backbone cable can be laid along the most
efficient path, then connected to the nodes by drop lines of various lengths. In this way, a bus uses less
cabling than mesh or star topologies. In a star, for example, four network devices in the same room
require four lengths of cable reaching all the way to the hub. In a bus, this redundancy is eliminated. Only
the backbone cable stretches through the entire facility. Each drop line must reach only as far as the
nearest point on the backbone.

• Disadvantages include difficult reconnection and fault isolation. A bus is usually designed to be
optimally efficient at installation. It can therefore be difficult to add new devices. Signal reflection at the
taps can cause degradation in quality. This degradation can be controlled by limiting the number and
spacing of devices connected to a given length of cable. Adding new devices may therefore require
modification or replacement of the backbone.

• In addition, a fault or break in the bus cable stops all transmission, even between devices on the same
side of the problem. The damaged area reflects signals back in the direction of origin, creating noise in
both directions.

• Bus topology was the one of the first topologies used in the design of early local area networks.
Traditional Ethernet LANs can use a bus topology, but they are less popular now.

RING TOPOLOGY

In a ring topology, each device has a dedicated point-to-point connection with only the two devices on either
side of it. A signal is passed along the ring in one direction, from device to device, until it reaches its destination.
Each device in the ring incorporates a repeater. When a device receives a signal intended for another device, its
repeater regenerates the bits and passes them along (see Fig 7).

Department of ECE,CEC 13
MODULE-1 V SEM Computer Communication Networks[21EC53]

Fig. 7: A ring topology connecting six stations

• A ring is relatively easy to install and reconfigure. Each device is linked to only its immediate neighbors
(either physically or logically). To add or delete a device requires changing only two connections. The
only constraints are media and traffic considerations (maximum ring length and number of devices). In
addition, fault isolation is simplified. Generally, in a ring a signal is circulating at all times. If one device
does not receive a signal within a specified period, it can issue an alarm. The alarm alerts the network
operator to the problem and its location.

• However, unidirectional traffic can be a disadvantage. In a simple ring, a break in the ring (such as a
disabled station) can disable the entire network. This weakness can be solved by using a dual ring or a
switch capable of closing off the break.

• Ring topology was prevalent when IBM introduced its local-area network, Token Ring. Today, the need
for higher-speed LANs has made this topology less popular.

1.6 NETWORK TYPES

➢ The criteria of distinguishing one type of network from another is difficult and sometimes confusing. We
use a few criteria such as size, geographical coverage, and ownership to make this distinction. The two
types of networks are LANs and WANs.
LOCAL AREA NETWORK

➢ A local area network (LAN) is usually privately owned and connects some hosts in a single office,
building, or campus. Depending on the needs of an organization, a LAN can be as simple as two PCs and
a printer in someone’s home office, or it can extend throughout a company and include audio and video
devices.

Department of ECE,CEC 14
MODULE-1 V SEM Computer Communication Networks[21EC53]

➢ Each host in a LAN has an identifier, an address, that uniquely defines the host in the LAN. A packet
sent by a host to another host carries both the source host’s and the destination host’s addresses.

➢ In the past, all hosts in a network were connected through a common cable, which meant that a packet
sent from one host to another was received by all hosts. The intended recipient kept the packet; the others
dropped the packet.

Fig. 8: An isolated LAN in the past and today

➢ Today, most LANs use a smart connecting switch, which is able to recognize the destination address of
the packet and guide the packet to its destination without sending it to all other hosts.

➢ The switch alleviates the traffic in the LAN and allows more than one pair to communicate with each
other at the same time if there is no common source and destination among them. Note that the above
definition of a LAN does not define the minimum or maximum number of hosts in a LAN. Fig. 8 shows a
LAN using either a common cable or a switch.

➢ When LANs were used in isolation (which is rare today), they were designed to allow resources to be
shared between the hosts. As we will see shortly, LANs today are connected to each other and to WANs
(discussed next) to create communication at a wider level.
WIDE AREA NETWORK
➢ A wide area network (WAN) is also an interconnection of devices capable of communication. However,
there are some differences between a LAN and a WAN.

➢ A LAN is normally limited in size, spanning an office, a building, or a campus; a WAN has a wider
geographical span, spanning a town, a state, a country, or even the world.

Department of ECE,CEC 15
MODULE-1 V SEM Computer Communication Networks[21EC53]

➢ A LAN interconnects hosts; a WAN interconnects connecting devices such as switches, routers, or
modems.

➢ A LAN is normally privately owned by the organization that uses it; a WAN is normally created and run
by communication companies and leased by an organization that uses it.

We see two distinct examples of WANs today: point-to-point WANs and switched WANs.
point-to-point WAN

A point-to-point WAN is a network that connects two communicating devices through a trans- mission media (cable
or air). We will see examples of these WANs when we discuss how to connect the networks to one another. Fig. 9
shows an example of a point-to-point WAN.

Fig. 9: A point-to-point WAN


switched WAN
A switched WAN is a network with more than two ends. A switched WAN, as we will see shortly, is used in the
backbone of global communication today. We can say that a switched WAN is a combination of several point-
to-point WANs that are connected by switches. Fig. 10 shows an example of a switched WAN.

Fig. 10: A switched WAN

Department of ECE,CEC 16
MODULE-1 V SEM Computer Communication Networks[21EC53]

1.7 INTERNETWORK

• There is very rare to see a LAN or a WAN in isolation; they are connected to one another. When two or
more networks are connected, they make an internetwork, or internet.

• As an example, assume that an organization has two offices, one on the east coast and the other on the
west coast. Each office has a LAN that allows all employees in the office to communicate with each
other.

• To make the communication between employees at different offices possible, the management leases a
point-to-point dedicated WAN from a service provider, such as a telephone company, and connects the
two LANs.

• Now the company has an internetwork, or a private internet (with lowercase i). Communication between
offices is now possible. Fig. 11 shows this internet

Fig. 11: An internetwork made of two LANs and one point-to-point WAN

• When a host in the west coast office sends a message to another host in the same office, the router blocks
the message, but the switch directs the message to the destination.

• On the other hand, when a host on the west coast sends a message to a host on the east coast, router R1
routes the packet to router R2, and the packet reaches the destination.

• Fig. 12 shows another internet with several LANs and WANs connected. One of the WANs is a switched
WAN with four switches.

Department of ECE,CEC 17
MODULE-1 V SEM Computer Communication Networks[21EC53]

Fig. 12: A heterogeneous network made of four WANs and three LANs

1.8 SWITCHING
An internet is a switched network in which a switch connects at least two links together. A switch needs to
forward data from a network to another network when required. The two most common types of switched
networks are circuit-switched and packet-switched networks.
➢ Circuit-Switched Network

• In a circuit-switched network, a dedicated connection called a circuit, is always available between the
two end systems; the switch can only make it active or inactive.

• Fig.13 shows a very simple switched network that connects four telephones to each end. We have used
telephone sets instead of computers as an end system because circuit switching was very common in
telephone networks in the past, although part of the telephone network today is a packet-switched network.

• In Fig. 13, the four telephones at each side are connected to a switch. The switch connects a telephone set
at one side to a telephone set at the other side. The thick line connecting two switches is a high-capacity
communication line that can handle four voice communications at the same time; the capacity can be shared
between all pairs of telephone sets. The switches used in this example have forwarding tasks but no storing
capability.

• Let us look at two cases. In the first case, all telephone sets are busy; four people at one site are talking
with four people at the other site; the capacity of the thick line is fully used.

Department of ECE,CEC 18
MODULE-1 V SEM Computer Communication Networks[21EC53]

Fig. 13: A circuit-switched network

• In the second case, only one telephone set at one side is connected to a tele- phone set at the other side;
only one-fourth of the capacity of the thick line is used. This means that a circuit-switched network is
efficient only when it is working at its full capacity; most of the time, it is inefficient because it is
working at partial capacity.

• The reason that we need to make the capacity of the thick line four times the capacity of each voice line
is that we do not want communication to fail when all telephone sets at one side want to be connected
with all telephone sets at the other side.

➢ Packet-Switched Network

In a computer network, the communication between the two ends is done in blocks of data called packets. In
other words, instead of the continuous communication we see between two telephone sets when they are being
used, we see the exchange of individual data packets between the two computers.

This allows us to make the switches function for both storing and forwarding because a packet is an independent
entity that can be stored and sent later.

Fig. 14 shows a small packet-switched network that connects four computers at one site to four computers at the
other site.

Department of ECE,CEC 19
MODULE-1 V SEM Computer Communication Networks[21EC53]

Fig. 14: A packet-switched network

• A router in a packet-switched network has a queue that can store and forward the packet. Now assume
that the capacity of the thick line is only twice the capacity of the data line connecting the computers to
the routers.

• If only two computers (one at each site) need to communicate with each other, there is no waiting for the
packets. However, if packets arrive at one router when the thick line is already working at its full
capacity, the packets should be stored and forwarded in the order they arrived.

• The two simple examples show that a packet-switched network is more efficient than a circuit- switched
network, but the packets may encounter some delays.
1.9 THE INTERNET

• An internet (note the lowercase i) is two or more networks that can communicate with each other. The
most notable internet is called the Internet (uppercase I) and is composed of thousands of interconnected
networks. Fig. 15 shows a conceptual (not geographical) view of the Internet.

• The Fig. 15 shows the Internet as several backbones, provider networks, and customer networks. At the
top level, the backbones are large networks owned by some communication companies such as Sprint,
Verizon (MCI), AT&T, and NTT.

• The back- bone networks are connected through some complex switching systems called peering points.
At the second level, there are smaller networks called provider networks, that use the services of the
backbones for a fee.

• The provider networks are connected to backbones and sometimes to other provider networks. The
customer networks are networks at the edge of the Internet that actually use the services provided by the
Inter- net. They pay fees to provider networks for receiving services.

Department of ECE,CEC 20
MODULE-1 V SEM Computer Communication Networks[21EC53]

• Backbones and provider networks are also called Internet Service Providers (ISPs). The backbones are
often referred to as international ISPs; the provider net- works are often referred to as national or regional
ISPs.

Fig. 15: The Internet today

NETWORK MODELS
1.10 PROTOCOL LAYERING

In data communication and networking, a protocol defines the rules that both the sender and receiver and all
intermediate devices need to follow to be able to communicate effectively. When communication is simple, we
may need only one simple protocol; when the communication is complex, we may need to divide the task
between different layers, in which case we need a protocol at each layer or protocol layering.
Scenarios
Let us develop two simple scenarios to better understand the need for protocol layering.

➢ First scenario

In the first scenario, communication is so simple that it can occur in only one layer. Assume Maria and Ann are
neighbors with a lot of common ideas. Communication between Maria and Ann takes place in one layer, face to
face, in the same language, as shown in Fig. 16.

• Even in this simple scenario, we can see that a set of rules needs to be followed. First, Maria and Ann
know that they should greet each other when they meet.

Department of ECE,CEC 21
MODULE-1 V SEM Computer Communication Networks[21EC53]

• Second, they know that they should confine their vocabulary to the level of their friendship.

• Third, each party knows that she should refrain from speaking when the other party is speaking.

• Fourth, each party knows that the conversation should be a dialog, not a monolog: both should have the
opportunity to talk about the issue. Fifth, they should exchange some nice words when they leave.

Fig. 16: A single-layer protocol

We can see that the protocol used by Maria and Ann is different from the communication between a professor
and the students in a lecture hall. The communication in the second case is mostly monolog; the professor talks
most of the time unless a student has a question, a situation in which the protocol dictates that she should raise
her hand and wait for permission to speak. In this case, the communication is normally very for- mal and limited
to the subject being taught.

➢ Second scenario

In the second scenario, we assume that Ann is offered a higher-level position in her company but needs to move
to another branch located in a city very far from Maria. The two friends still want to continue their
communication and exchange ideas because they have come up with an innovative project to start a new
business when they both retire. They decide to continue their conversation using regular mail through the post
office. However, they do not want their ideas to be revealed by other people if the letters are intercepted. They
agree on an encryption/decryption technique. The sender of the letter encrypts it to make it unreadable by an
intruder; the receiver of the letter decrypts it to get the original letter.
We assume that Maria and Ann use one technique that makes it hard to decrypt the letter if one does not have the
key for doing so. Now we can say that the communication between Maria and Ann takes place in three layers, as
shown in Fig. 17. We assume that Ann and Maria each have three machines (or robots) that can perform the task
at each layer.

• Let us assume that Maria sends the first letter to Ann. Maria talks to the machine at the third layer as
though the machine is Ann and is listening to her. The third layer machine listens to what Maria says and
creates the plaintext (a letter in English), which is passed to the second layer machine.
Department of ECE,CEC 22
MODULE-1 V SEM Computer Communication Networks[21EC53]

• The second layer machine takes the plaintext, encrypts it, and creates the ciphertext, which is passed to
the first layer machine. The first layer machine, presumably a robot, takes the ciphertext, puts it in an
envelope, adds the sender and receiver addresses, and mails it.

Fig. 17: A three-layer protocol

• At Ann’s side, the first layer machine picks up the letter from Ann’s mail box, recognizing the letter
from Maria by the sender address. The machine takes out the ciphertext from the envelope and delivers
it to the second layer machine. The second layer machine decrypts the message, creates the plaintext,
and passes the plaintext to the third-layer machine. The third layer machine takes the plaintext and reads
it as though Maria is speaking.

• Protocol layering enables us to divide a complex task into several smaller and simpler tasks.

• For example, in Fig. 17, we could have used only one machine to do the job of all three machines.
However, if Maria and Ann decide that the encryption/decryption done by the machine is not enough to
protect their secrecy, they would have to change the whole machine. In the present situation, they need
to change only the second layer machine; the other two can remain the same. This is referred to as
modularity.

Modularity in this case means independent layers. A layer (module) can be defined as a black box with inputs
and outputs, without concern about how inputs are changed to outputs. If two machines provide the same outputs
when given the same inputs, they can replace each other.

Department of ECE,CEC 23
MODULE-1 V SEM Computer Communication Networks[21EC53]

For example, Ann and Maria can buy the second layer machine from two different manufacturers. As long as the
two machines create the same ciphertext from the same plaintext and vice versa, they do the job.

• One of the advantages of protocol layering is that it allows us to separate the services from the
implementation. A layer needs to be able to receive a set of services from the lower layer and to give the
services to the upper layer; we don’t care about how the layer is implemented. For example, Maria may
decide not to buy the machine (robot) for the first layer; she can do the job herself. As long as Maria can
do the tasks provided by the first layer, in both directions, the communication system works.

• Another advantage of protocol layering, which cannot be seen in our simple examples but reveals itself
when we discuss protocol layering in the Internet, is that communication does not always use only two
end systems; there are intermediate systems that need only some layers, but not all layers. If we did not
use protocol layering, we would have to make each intermediate system as complex as the end systems,
which makes the whole system more expensive.

Is there any disadvantage to protocol layering? One can argue that having a single layer makes the job easier.
There is no need for each layer to provide a service to the upper layer and give service to the lower layer. For
example, Ann and Maria could find or build one machine that could do all three tasks. However, as mentioned
above, if one day they found that their code was broken, each would have to replace the whole machine with a
new one instead of just changing the machine in the second layer.
Principles of Protocol Layering

Let us discuss two principles of protocol layering.

➢ First principle
The first principle dictates that if we want bidirectional communication, we need to make each layer so that it
can perform two opposite tasks, one in each direction. For example, the third layer task is to listen (in one
direction) and talk (in the other direction). The second layer needs to be able to encrypt and decrypt. The first
layer needs to send and receive mail.

➢ Second Principle
The second principle that we need to follow in protocol layering is that the two objects under each layer at both
sites should be identical. For example, the object under layer 3 at both sites should be a plaintext letter. The
object under layer 2 at both sites should be a ciphertext letter. The object under layer 1 at both sites should be a
piece of mail.

Department of ECE,CEC 24
MODULE-1 V SEM Computer Communication Networks[21EC53]

Logical Connections
After following the above two principles, we can think about logical connection between each layer as shown in
Fig. 18. This means that we have layer-to-layer communication. Maria and Ann can think that there is a logical
(imaginary) connection at each layer through which they can send the object created from that layer. We will see
that the concept of logical connection will help us better understand the task of layering we encounter in data
communication and networking.

Fig. 18: Logical connection between peer layers

1.11 TCP/IP PROTOCOL SUITE

Here, the concept of protocol layering and the logical communication between layers in our second scenario, we
can introduce the TCP/IP (Transmission Control Protocol/Internet Protocol). TCP/IP is a protocol suite (a set of
protocols organized in different layers) used in the Internet today.

Fig. 19: Layers in the TCP/IP protocol suite

Department of ECE,CEC 25
MODULE-1 V SEM Computer Communication Networks[21EC53]

It is a hierarchical protocol made up of interactive modules, each of which provides a specific functionality. The
term hierarchical means that each upper-level protocol is supported by the services provided by one or more
lower-level protocols.
The original TCP/IP protocol suite was defined as four software layers built upon the hardware. However,
TCP/IP is thought of as a five-layer model. Fig. 19 shows both configurations.

Layered Architecture

To show how the layers in the TCP/IP protocol suite are involved in communication between two hosts, we
assume that we want to use the suite in a small internet made up of three LANs (links), each with a link-layer
switch. We also assume that the links are connected by one router, as shown in Fig. 20.

Fig. 20: Communication through an internet

Let us assume that computer A communicates with computer B. As the Fig. 20 shows, we have five
communicating devices in this communication: source host (computer A), the link-layer switch in link 1, the
router, the link-layer switch in link 2, and the destination host (computer B). Each device is involved with a set
of layers depending on the role of the device in the internet.

Department of ECE,CEC 26
MODULE-1 V SEM Computer Communication Networks[21EC53]

• The two hosts are involved in all five layers; the source host needs to create a message in the application
layer and send it down the layers so that it is physically sent to the destination host.

• The destination host needs to receive the communication at the physical layer and then deliver it through
the other layers to the application layer.

• The router is involved in only three layers; there is no transport or application layer in a router if the
router is used only for routing. Although a router is always involved in one network layer, it is involved
in n combinations of link and physical layers in which n is the number of links the router is connected to.
The reason is that each link may use its own data-link or physical protocol.

• For example, in the above figure, the router is involved in three links, but the message sent from source A
to destination B is involved in two links. Each link may be using different link-layer and physical-layer
protocols; the router needs to receive a packet from link 1 based on one pair of protocols and deliver it to
link 2 based on another pair of protocols.

• A link-layer switch in a link, however, is involved only in two layers, data-link and physical. Although
each switch in the above figure has two different connections, the connections are in the same link, which
uses only one set of protocols. This means that, unlike a router, a link-layer switch is involved only in
one data-link and one physical layer.

Layers in the TCP/IP Protocol Suite

After the above introduction, we briefly discuss the functions and duties of layers in the TCP/IP protocol suite.
Fig. 21 shows logical connections in simple internet.

• As the Fig. 21 shows, the duty of the application, transport, and network layers is end-to-end. However,
the duty of the data-link and physical layers is hop-to-hop, in which a hop is a host or router.

• In other words, the domain of duty of the top three layers is the internet, and the domain of duty of the
two lower layers is the link.

• Another way of thinking of the logical connections is to think about the data unit created from each layer.
In the top three layers, the data unit (packets) should not be changed by any router or link-layer switch. In
the bottom two layers, the packet created by the host is changed only by the routers, not by the link-layer
switches.
Fig. 22 shows the second principle discussed previously for protocol layering. We show the identical objects
below each layer related to each device.

Department of ECE,CEC 27
MODULE-1 V SEM Computer Communication Networks[21EC53]

Note that, although the logical connection at the network layer is between the two hosts, we can only say that
identical objects exist between two hops in this case because a router may fragment the packet at the network
layer and send more packets than received. Note that the link between two hops does not change the object.

Fig. 22: Logical connections between layers of the TCP/IP protocol suite

1.12 DESCRIPTION OF EACH LAYER

Physical Layer

o Here, physical layer is responsible for carrying individual bits in a frame across the link. Although the
physical layer is the lowest level in the TCP/IP protocol suite, the communication between two devices at
the physical layer is still a logical communication because there is another, hidden layer, the transmission
media, under the physical layer.

o Two devices are connected by a transmission medium (cable or air). We need to know that the
transmission medium does not carry bits; it carries electrical or optical signals. So, the bits received in a
frame from the data-link layer are transformed and sent through the transmission media, but we can think
that the logical unit between two physical layers in two devices is a bit.

o There are several protocols that transform a bit to a signal. We discuss them in Part II when we discuss
the physical layer and the transmission media.

Department of ECE,CEC 28
MODULE-1 V SEM Computer Communication Networks[21EC53]

Data-link Layer

o We know that an internet is made up of several links (LANs and WANs) connected by routers. There
may be several overlapping sets of links that a datagram can travel from the host to the destination. The
routers are responsible for choosing the best links. However, when the next link to travel is determined
by the router, the data-link layer is responsible for taking the datagram and moving it across the link.

o The link can be a wired LAN with a link-layer switch, a wireless LAN, a wired WAN, or a wireless
WAN. We can also have different protocols used with any link type. In each case, the data-link layer is
responsible for moving the packet through the link.

o TCP/IP does not define any specific protocol for the data-link layer. It supports all the standard and
proprietary protocols. Any protocol that can take the datagram and carry it through the link suffices for
the network layer. The data-link layer takes a datagram and encapsulates it in a packet called a frame.

o Each link-layer protocol may provide a different service. Some link-layer protocols provide complete
error detection and correction, some provide only error correction.
Network Layer

o The network layer is responsible for creating a connection between the source computer and the
destination computer. The communication at the network layer is host-to-host. Here, there can be several
routers from the source to the destination, the routers in the path are responsible for choosing the best
route for each packet.

o Hence, network layer is responsible for host-to-host communication and routing the packet through
possible routes. The need of the network layer may add the routing duty to the transport layer and
dropped this layer.

o The first reason is the separation of different tasks between different layers. The second reason is that the
routers do not need the application and transport layers. Separating the tasks allows us to use fewer
protocols on the routers.

o The network layer in the Internet includes the main protocol, Internet Protocol (IP), that defines the
format of the packet, called a datagram at the network layer. IP also defines the format and the structure
of addresses used in this layer. IP is also responsible for routing a packet from its source to its
destination, which is achieved by each router forwarding the datagram to the next router in its path.

o IP is a connectionless protocol that provides no flow control, no error control and no congestion control
services. This means that if any of these services is required for an application, the application should
rely only on the transport-layer protocol.

Department of ECE,CEC 29
MODULE-1 V SEM Computer Communication Networks[21EC53]

o The network layer also includes unicast (one-to-one) and multicast (one-to-many) routing protocols. A
routing protocol does not take part in routing (it is the responsibility of IP), but it creates forwarding
tables for routers to help them in the routing process.

o The network layer also has some auxiliary protocols that help IP in its delivery and routing tasks.

o The Internet Control Message Protocol (ICMP) helps IP to report some problems when routing a packet.
The Internet Group Management Protocol (IGMP) is another protocol that helps IP in multitasking.

o The Dynamic Host Configuration Protocol (DHCP) helps IP to get the network-layer address for a host.

o The Address Resolution Protocol (ARP) is a protocol that helps IP to find the link-layer address of a host
or a router when its network-layer address is given.

Transport Layer
o The logical connection at the transport layer is also end-to-end. The transport layer at the source host
gets the message from the application layer, encapsulates it in a transport layer packet (called a segment
or a user datagram in different protocols) and sends it, through the logical (imaginary) connection, to the
transport layer at the destination host.

o In other words, the transport layer is responsible for giving services to the application layer: to get a
message from an application program running on the source host and deliver it to the corresponding
application program on the destination host. The reason to have an end-to-end application is the
separation of tasks and duties.

o The transport layer should be independent of the application layer. In addition, we will see that we have
more than one protocol in the transport layer, which means that each application program can use the
protocol that best matches its requirement

o The main protocol, Transmission Control Protocol (TCP), is a connection-oriented protocol that first
establishes a logical connection between transport layers at two hosts before transferring data. It creates a
logical pipe between two TCPs for transferring a stream of bytes. TCP provides flow control (matching
the sending data rate of the source host with the receiving data rate of the destination host to prevent
overwhelming the destination), error control (to guarantee that the segments arrive at the destination
without error and resending the corrupted ones), and congestion control to reduce the loss of segments
due to congestion in the network.

o The other common protocol, User Datagram Protocol (UDP), is a connectionless protocol that transmits
user datagrams without first creating a logical connection. In UDP, each user datagram is an independent
entity without being related to the previous or the next one (the meaning of the term connectionless).
Department of ECE,CEC 30
MODULE-1 V SEM Computer Communication Networks[21EC53]

UDP is a simple protocol that does not provide flow, error, or congestion control. Its simplicity, which
means small overhead, is attractive to an application program that needs to send short messages and
cannot afford the retransmission of the packets involved in TCP, when a packet is corrupted or lost.

o A new protocol, Stream Control Transmission Protocol (SCTP) is designed to respond to new
applications that are emerging in the multimedia.

Application Layers

As Fig. 20 shows, the logical connection between the two application layers is end to end.

o The two application layers exchange messages between each other as though there were a bridge between
the two layers. However, we should know that the communication is done through all the layers.

o Communication at the application layer is between two processes (two programs running at this layer).
To communicate, a process sends a request to the other process and receives a response. Process-to-
process communication is the duty of the application layer. The application layer in the Internet includes
many predefined protocols, but a user can also create a pair of processes to be run at the two hosts.

o The Hypertext Transfer Protocol (HTTP) is a vehicle for accessing the World Wide Web (WWW).

o The Simple Mail Transfer Protocol (SMTP) is the main protocol used in electronic mail (e-mail) service.

o The File Transfer Protocol (FTP) is used for transferring files from one host to another.

o The Terminal Network (TELNET) and Secure Shell (SSH) are used for accessing a site remotely.

o The Simple Network Management Protocol (SNMP) is used by an administrator to manage the Internet
at global and local levels.

o The Domain Name System (DNS) is used by other protocols to find the network-layer address of a
computer.

o The Internet Group Management Protocol (IGMP) is used to collect membership in a group.

1.13 ENCAPSULATION AND DECAPSULATION

One of the important concepts in protocol layering in the Internet is encapsulation/ decapsulation. Fig. 23 shows
this concept for the small internet in Fig. 20. We have not shown the layers for the link-layer switches because
no encapsulation/ decapsulation occurs in this device. In Fig. 23, we show the encapsulation in the source host,
decapsulation in the destination host, and encapsulation and decapsulation in the router

Department of ECE,CEC 31
MODULE-1 V SEM Computer Communication Networks[21EC53]

➢ Encapsulation at the Source Host


At the source, we have only encapsulation.

• At the application layer, the data to be exchanged is referred to as a message. A message normally does
not contain any header or trailer, but if it does, we refer to the whole as the message. The message is
passed to the transport layer.

• The transport layer takes the message as the payload, the load that the transport layer should take care of.
It adds the transport layer header to the payload, which contains the identifiers of the source and
destination application programs that want to communicate plus some more information that is needed
for the end-to end delivery of the message, such as information needed for flow, error control, or
congestion control. The result is the transport-layer packet, which is called the segment (in TCP) and the
user datagram (in UDP). The transport layer then passes the packet to the network layer.

• The network layer takes the transport-layer packet as data or payload and adds its own header to the
payload. The header contains the addresses of the source and destination hosts and some more
information used for error checking of the header, fragmentation information, and so on. The result is the
network-layer packet, called a datagram. The network layer then passes the packet to the data-link layer.

• The data-link layer takes the network-layer packet as data or payload and adds its own header, which
contains the link-layer addresses of the host or the next hop (the router). The result is the link-layer
packet, which is called a frame. The frame is passed to the physical layer for transmission.

Department of ECE,CEC 32
MODULE-1 V SEM Computer Communication Networks[21EC53]
Fig. 23: Encapsulation/Decapsulation

➢ Decapsulation and Encapsulation at the Router

• At the router, we have both decapsulation and encapsulation because the router is connected to two or
more links.

• After the set of bits are delivered to the data-link layer, this layer decapsulates the datagram from the
frame and passes it to the network layer.

• The network layer only inspects the source and destination addresses in the datagram header and consults
its forwarding table to find the next hop to which the datagram is to be delivered. The contents of the
datagram should not be changed by the network layer in the router unless there is a need to fragment the
datagram if it is too big to be passed through the next link. The datagram is then passed to the data-link
layer of the next link.

• The data-link layer of the next link encapsulates the datagram in a frame and passes it to the physical
layer for transmission.

➢ Decapsulation at the Destination Host


At the destination host, each layer only decapsulates the packet received, removes the payload, and delivers the
payload to the next-higher layer protocol until the message reaches the application layer. It is necessary to say
that decapsulation in the host involves error checking.

1.14 ADDRESSING

It is worth mentioning another concept related to protocol layering in the Internet, addressing. Here, we have
logical communication between pairs of layers in this model. Any communication that involves two parties
needs two addresses: source address and destination address.
Although it looks as if we need five pairs of addresses, one pair per layer, we normally have only four because
the physical layer does not need addresses; the unit of data exchange at the physical layer is a bit, which cannot
have an address. Fig. 24 shows the addressing at each layer.
As the Fig. 24 shows, there is a relationship between the layer, the address used in that layer, and the packet
name at that layer.

➢ At the application layer, we normally use names to define the site that provides services, such as
someorg.com, or the e-mail address, such as somebody@coldmail.com.

Department of ECE,CEC 33
MODULE-1 V SEM Computer Communication Networks[21EC53]

➢ At the transport layer, addresses are called port numbers, and these define the application-layer programs
at the source and destination. Port numbers are local addresses that distinguish between several programs
running at the same time.

Fig. 24: Addressing in the TCP/IP protocol suite

➢ At the network-layer, the addresses are global, with the whole Internet as the scope. A network-layer
address uniquely defines the connection of a device to the Internet. The link-layer addresses, sometimes
called MAC addresses, are locally defined addresses, each of which defines a specific host or router in a
network (LAN or WAN).

1.15 MULTIPLEXING AND DEMULTIPLEXING

➢ Since the TCP/IP protocol suite uses several protocols at some layers, we can say that we have multiplexing
at the source and demultiplexing at the destination. Multiplexing in this case means that a protocol at a layer can
encapsulate a packet from several next-higher layer protocols (one at a time); demultiplexing means that a
protocol can decapsulate and deliver a packet to several next-higher layer protocols (one at a time). Fig. 25
shows the concept of multiplexing and demultiplexing at the three upper layers.

➢ To be able to multiplex and demultiplex, a protocol needs to have a field in its header to identify to which
protocol the encapsulated packets belong. At the transport layer, either UDP or TCP can accept a message from
several application-layer protocols. At the network layer, IP can accept a segment from TCP or a user datagram
from UDP. IP can also accept a packet from other protocols such as ICMP, IGMP, and so on. At the data-link
layer, a frame may carry the payload coming from IP or other protocols such as ARP.

Department of ECE,CEC 34
MODULE-1 V SEM Computer Communication Networks[21EC53]

Fig. 25: Multiplexing and demultiplexing

1.16 THE OSI MODEL

➢ Although, when speaking of the Internet, everyone talks about the TCP/IP protocol suite, this suite is not the
only suite of protocols defined. Established in 1947, the International Organization for Standardization (ISO) is a
multinational body dedicated to worldwide agreement on international standards. Almost three-fourths of the
countries in the world are represented in the ISO. An ISO standard that covers all aspects of network
communications is the Open Systems Interconnection (OSI) model. It was first introduced in the late 1970s.

Fig. 26: The OSI model

➢ An open system is a set of protocols that allows any two different systems to communicate regardless of their
underlying architecture. The purpose of the OSI model is to show how to facilitate communication between
different systems without requiring changes to the logic of the underlying hardware and software. The OSI
model is not a protocol; it is a model for understanding and designing a network architecture that is flexible,

Department of ECE,CEC 35
MODULE-1 V SEM Computer Communication Networks[21EC53]

robust, and interoperable. The OSI model was intended to be the basis for the creation of the protocols in the OSI
stack.

➢ The OSI model is a layered framework for the design of network systems that allows communication between
all types of computer systems. It consists of seven separate but related layers, each of which defines a part of the
process of moving information across a network (see Fig. 26).
OSI versus TCP/IP
➢ When we compare the two models, we find that two layers, session and presentation, are missing from the TCP/IP
protocol suite. These two layers were not added to the TCP/IP protocol suite after the publication of the OSI model.
The application layer in the suite is usually considered to be the combination of three layers in the OSI model, as
shown in Fig. 27.

Fig. 27: TCP/IP and OSI model


Two reasons were mentioned for this decision. First, TCP/IP has more than one transport-layer protocol. Some
of the functionalities of the session layer are available in some of the transport-layer protocols. Second, the
application layer is not only one piece of software. Many applications can be developed at this layer. If some of
the functionalities mentioned in the session and presentation layers are needed for a particular application, they
can be included in the development of that piece of software.
Lack of OSI Model’s Success
The OSI model appeared after the TCP/IP protocol suite. Most experts were at first excited and thought that the
TCP/IP protocol would be fully replaced by the OSI model. This did not happen for several reasons, but we
describe only three, which are agreed upon by all experts in the field.
➢ OSI was completed when TCP/IP was fully in place and a lot of time and money had been spent on the suite;
changing it would cost a lot.

Department of ECE,CEC 36
MODULE-1 V SEM Computer Communication Networks[21EC53]

➢ Some layers in the OSI model were never fully defined. For example, although the services provided by the
presentation and the session layers were listed in the document, actual protocols for these two layers were not
fully defined, nor were they fully described, and the corresponding software was not fully developed.

➢ When OSI was implemented by an organization in a different application, it did not show a high enough level
of performance to entice the Internet authority to switch from the TCP/IP protocol suite to the OSI model.
DATA LINK LAYER
INTRODUCTION

➢ The Internet is a combination of networks glued together by connecting devices (routers or switches).
If a packet is to travel from a host to another host, it needs to pass through these networks.
➢ Fig.1 shows communication at the data-link layer. Communication at the data-link layer is made up of
five separate logical connections between the data-link layers in the path.

Fig. 1: Communication at the data-link layer

➢ The data-link layer at Alice’s computer communicates with the data-link layer at router R2. The data-
link layer at router R2 communicates with the data-link layer at router R4, and so on. Finally, the data-
link layer at router R7 communicates with the data-link layer at Bob’s computer. Only one data-link
layer is involved at the source or the destination, but two data- link layers are involved at each router.
Department of ECE,CEC 37
MODULE-1 V SEM Computer Communication Networks[21EC53]

➢ The reason is that Alice’s and Bob’s computers are each connected to a single network, but each router
takes input from one network and sends output to another network. Note that

although switches are also involved in the data-link-layer communication, for simplicity we have not
shown them in the Fig. 1.

NODES AND LINKS

➢ Communication at the data-link layer is node-to-node. A data unit from one point in the Internet needs
to pass through many networks (LANs and WANs) to reach another point. Theses LANs and WANs
are connected by routers.
➢ It is customary to refer to the two end hosts and the routers as nodes and the networks in between as
links. Fig. 2 is a simple representation of links and nodes when the path of the data unit is only six
nodes.

Fig. 2: Nodes and Links

➢ The first node is the source host; the last node is the destination host. The other four nodes are four
routers. The first, the third, and the fifth links represent the three LANs; the second and the fourth links
represent the two WANs.

SERVICES

➢ The data-link layer is located between the physical and the network layers. The datalink layer provides
services to the network layer; it receives services from the physical layer.

Let us discuss services provided by the data-link layer.


➢ The duty scope of the data-link layer is node-to-node. When a packet is travelling in the Internet, the
data-link layer of a node (host or router) is responsible for delivering a datagram to the next node in the
Department of ECE,CEC 38
MODULE-1 V SEM Computer Communication Networks[21EC53]

path. For this purpose, the data-link layer of the sending node needs to encapsulate the datagram
received from the network in a frame and the data-link layer of the receiving node needs to decapsulate
the datagram from the frame. In other words, the data- link layer of the source host needs only to
encapsulate, the data-link layer of the destination host needs to decapsulate, but each intermediate node
needs to both encapsulate and decapsulate.
➢ The reason for encapsulation and decapsulation at each intermediate node is that each link may be
using a different protocol with a different frame format. Even if one link and the next are using the
same protocol, encapsulation and decapsulation are needed because the link- layer addresses are
normally different. An analogy may help in this case.
➢ Assume a person needs to travel from her home to her friend’s home in another city. The traveler can
use three transportation tools. She can take a taxi to go to the train station in her own city, then travel
on the train from her own city to the city where her friend lives, and finally reach her friend’s home
using another taxi. Here we have a source node, a destination node, and two intermediate nodes. The
traveler needs to get into the taxi at the source node, get out of the taxi and get into the train at the first
intermediate node (train station in the city where she lives), get out of the train and get into another taxi
at the second intermediate node (train station in the city where her friend lives), and finally get out of
the taxi when she arrives at her destination. A kind of encapsulation occurs at the source node,
encapsulation and decapsulation occur at the intermediate nodes, and decapsulation occurs at the
destination node. Our traveler is the same, but she uses three transporting tools to reach the destination.
Fig. 3 shows the encapsulation and decapsulation at the data-link layer.

Fig. 3: A communication with only three nodes


➢ For simplicity, we have assumed that we have only one router between the source and destination. The
datagram received by the data-link layer of the source host is encapsulated in a frame. The frame is
logically transported from the source host to the router. The frame is decapsulated at the data-link layer
of the router and encapsulated at another frame. The new frame is logically transported from the router
to the destination host. Note that, although we have shown only two data-link layers at the router, the
router actually has three data-link layers because it is connected to three physical links.

Department of ECE,CEC 39
MODULE-1 V SEM Computer Communication Networks[21EC53]

SERVICES PROVIDED BY DATA LINK LAYER

➢ Framing
• The first service provided by the data-link layer is framing. The data-link layer at each node needs
to encapsulate the datagram (packet received from the network layer) in a frame before sending it
to the next node.
• The node also needs to decapsulate the datagram from the frame received on the logical channel.
Although we have shown only a header for a frame, but frame may have both a header and a trailer.
Different data-link layers have different formats for framing.

➢ Flow Control

• Whenever we have a producer and a consumer, we need to think about flow control. If the producer
produces items that cannot be consumed, accumulation of items occurs.
• The sending data-link layer at the end of a link is a producer of frames; the receiving data-link layer
at the other end of a link is a consumer. If the rate of produced frames is higher than the rate of
consumed frames, frames at the receiving end need to be buffered while waiting to be consumed
(processed).
• We cannot have an unlimited buffer size at the receiving side. We have two choices. The first
choice is to let the receiving data-link layer drop the frames if its buffer is full. The second choice
is to let the receiving data-link layer send feedback to the sending data-link layer to ask it to stop or
slow down.
• Different data-link-layer protocols use different strategies for flow control. Since flow control also
occurs at the transport layer, with a higher degree of importance.

➢ Error Control

• At the sending node, a frame in a data-link layer needs to be changed to bits, transformed to
electromagnetic signals, and transmitted through the transmission media.
• At the receiving node, electromagnetic signals are received, transformed to bits, and put together to
create a frame.
• Since electromagnetic signals are susceptible to error, a frame is susceptible to error. The error
needs first to be detected. After detection, it needs to be either corrected at the receiver node or
discarded and retransmitted by the sending node. And also, error detection and correction are an

Department of ECE,CEC 40
MODULE-1 V SEM Computer Communication Networks[21EC53]

issue in every layer (node-to-node or host-to-host).

➢ Congestion Control

• Although a link may be congested with frames, which may result in frame loss, most data-link-
layer protocols do not directly use a congestion control to alleviate congestion, although some
wide-area networks do.
• In general, congestion control is considered an issue in the network layer or the transport layer
because of its end-to-end nature.

TWO CATEGORIES OF LINKS

➢ Although two nodes are physically connected by a transmission medium such as cable or air, we need
to remember that the data-link layer controls how the medium is used.
➢ We can have a data-link layer that uses the whole capacity of the medium; we can also have a data-link
layer that uses only part of the capacity of the link. In other words, we can have a point-to-point link or
a broadcast link.
➢ In a point-to-point link, the link is dedicated to the two devices; in a broadcast link, the link is shared
between several pairs of devices. For example, when two friends use the traditional home phones to
chat, they are using a point-to-point link; when the same two friends use their cellular phones, they are
using a broadcast link (the air is shared among many cell phone users).

TWO SUBLAYERS

➢ To better understand the functionality of and the services provided by the link layer, we can divide the
data-link layer into two sublayers: data link control (DLC) and media access control (MAC). This is
not unusual because LAN protocols use the same strategy.

➢ The data link control sublayer deals with all issues common to both point-to-point and broadcast links;
the media access control sublayer deals only with issues specific to broadcast links. In other words, we
separate these two types of links at the data-link layer, as shown in Fig. 4.

Department of ECE,CEC 41
MODULE-1 V SEM Computer Communication Networks[21EC53]
Fig. 4: Dividing the data-link layer into two sublayers

LINK-LAYER ADDRESSING

➢ The data-link layer is the link-layer addresses where IP addresses used as the identifiers at the network
layer that define the exact points in the Internet where the source and destination hosts are connected.
However, in a connectionless internetwork such as the Internet we cannot make a datagram reach its
destination using only IP addresses.
➢ The reason is that each datagram in the Internet, from the same source host to the same destination
host, may take a different path. The source and destination IP addresses define the two ends but cannot
define which links the datagram should pass through.
➢ Here, IP addresses in a datagram should not be changed. If the destination IP address in a datagram
change, the packet never reaches its destination; if the source IP address in a datagram change, the
destination host or a router can never communicate with the source if a response needs to be sent back or an
error needs to be reported back to the source. The above discussion shows that we need another addressing
mechanism in a connectionless internetwork: the link-layer addresses of the two nodes.

➢ A link-layer address is sometimes called a link address, sometimes a physical address, and sometimes a
MAC address. We use these terms interchangeably in this book. Since a link is controlled at the data-
link layer, the addresses need to belong to the data-link layer. When a datagram passes from the
network layer to the data-link layer, the datagram will be encapsulated in a frame and two data-link
addresses are added to the frame header. These two addresses are changed every time the frame moves
from one link to another. Fig. 5 demonstrates the concept in a small internet.

Fig. 5: IP addresses and link-layer addresses in a small internet


Department of ECE,CEC 42
MODULE-1 V SEM Computer Communication Networks[21EC53]

➢ In the internet in Fig. 5, we have three links and two routers. We also have shown only two hosts:
Alice (source) and Bob (destination). For each host, we have shown two addresses, the IP addresses
(N) and the link-layer addresses (L). Note that a router has as many pairs of addresses as the number of
links the router is connected to. We have shown three frames, one in each link. Each frame carries the
same datagram with the same source and destination addresses (N1 and N8), but the link-layer
addresses of the frame change from link to link. In link 1, the link-layer addresses are L1 and L2. In link 2,
they are L4 and L5. In link 3, they are L7 and L8.
➢ Note that the IP addresses and the link-layer addresses are not in the same order. For IP addresses, the
source address comes before the destination address; for link-layer addresses, the destination address
comes before the source. The datagrams and frames are designed in this way, and we follow the
design.

➢ We may raise several questions:


• If the IP address of a router does not appear in any datagram sent from a source to a destination,
why do we need to assign IP addresses to routers? The answer is that in some protocols a router
may act as a sender or receiver of a datagram. For example, in routing protocols, a router is a
sender or a receiver of a message. The communications in these protocols are between routers.
• Why do we need more than one IP address in a router, one for each interface? The answer is that an
interface is a connection of a router to a link. We will see that an IP address defines a point in the
Internet at which a device is connected. A router with n interfaces is connected to the Internet at n
points. This is the situation of a house at the corner of a street with two gates; each gate has the
address related to the corresponding street.
• How are the source and destination IP addresses in a packet determined? The answer is that the
host should know its own IP address, which becomes the source IP address in the packet. As we
know, the application layer uses the services of DNS to find the destination address of the packet
and passes it to the network layer to be inserted in the packet.
• How are the source and destination link-layer addresses determined for each link? Again, each hop
(router or host) should know its own link-layer address and the destination link- layer address is
determined by using the Address Resolution Protocol.
• What is the size of link-layer addresses? The answer is that it depends on the protocol used by the
link. Although we have only one IP protocol for the whole Internet, we may be using different
data-link protocols in different links. This means that we can define the size of the address when
we discuss different link-layer protocols.

Department of ECE,CEC 43
MODULE-1 V SEM Computer Communication Networks[21EC53]

THREE TYPES OF ADDRESSES

Some link-layer protocols define three types of addresses: unicast, multicast, and broadcast.

➢ Unicast Address
Each host or each interface of a router is assigned a unicast address. Unicasting means one- to-one
communication. A frame with a unicast address destination is destined only for one entity in the link.

Example:
The unicast link-layer addresses in the most common LAN, Ethernet, are 48 bits (six bytes) that are
presented as 12 hexadecimal digits separated by colons; for example, the following is a link-layer
address of a computer.
A3:34:45:11:92:F1
➢ Multicast Address
Some link-layer protocols define multicast addresses. Multicasting means one-to-many
communication. However, the jurisdiction is local (inside the link).

Example:
The multicast link-layer addresses in the most common LAN, Ethernet, are 48 bits (six bytes) that are
presented as 12 hexadecimal digits separated by colons.

The second digit, however, needs to be an even number in hexadecimal. The following shows a
multicast address:
A2:34:45:11:92:F1

➢ Broadcast Address
Some link-layer protocols define a broadcast address. Broadcasting means one-to-all communication.
A frame with a destination broadcast address is sent to all entities in the link.

Example:
The broadcast link-layer addresses in the most common LAN, Ethernet, are 48 bits, all 1s, that are
presented as 12 hexadecimal digits separated by colons. The following shows a broadcast address:
FF:FF:FF:FF:FF:FF

Department of ECE,CEC 44
MODULE-1 V SEM Computer Communication Networks[21EC53]

ADDRESS RESOLUTION PROTOCOL (ARP)


➢ Anytime a node has an IP datagram to send to another node in a link, it has the IP address of the
receiving node. The source host knows the IP address of the default router. Each router except the last
one in the path gets the IP address of the next router by using its forwarding table. The last router
knows the IP address of the destination host. However, the IP address of the next node is not helpful in
moving a frame through a link; we need the link-layer address of the next node. This is the time when
the Address Resolution Protocol (ARP) becomes helpful.
➢ The ARP protocol is one of the auxiliary protocols defined in the network layer, as shown in Figure
9.6. It belongs to the network layer, but we discuss it in this chapter because it maps an IP address to a
logical-link address. ARP accepts an IP address from the IP protocol, maps the address to the
corresponding link-layer address, and passes it to the data-link layer.

Fig. 6: Position of ARP in TCP/IP protocol suite

➢ Anytime a host or a router needs to find the link-layer address of another host or router in its network,
it sends an ARP request packet. The packet includes the link-layer and IP addresses of the sender and
the IP address of the receiver. Because the sender does not know the link- layer address of the receiver,
the query is broadcast over the link using the link-layer broadcast address (see Fig. 7).

Fig. 7: ARP operation


➢ Every host or router on the network receives and processes the ARP request packet, but only the
Department of ECE,CEC 45
MODULE-1 V SEM Computer Communication Networks[21EC53]

intended recipient recognizes its IP address and sends back an ARP response packet. The response
packet contains the recipient’s IP and link-layer addresses. The packet is unicast directly to the node
that sent the request packet.
➢ In Fig. 7a, the system on the left (A) has a packet that needs to be delivered to another system
(B) with IP address N2. System A needs to pass the packet to its data-link layer for the actual delivery,
but it does not know the physical address of the recipient. It uses the services of ARP by asking the
ARP protocol to send a broadcast ARP request packet to ask for the physical address of a system with
an IP address of N2.
➢ This packet is received by every system on the physical network, but only system B will answer it, as
shown in Fig. 7b. System B sends an ARP reply packet that includes its physical

address. Now system A can send all the packets it has for this destination using the physical address it
received.
CACHING
➢ A question that is often asked is this: If system A can broadcast a frame to find the link layer address of
system B, why can’t system A send the datagram for system B using a broadcast frame? In other
words, instead of sending one broadcast frame (ARP request), one unicast frame (ARP response), and
another unicast frame (for sending the datagram), system A can encapsulate the datagram and send it to
the network. System B receives it and keep it; other systems discard it.
➢ To answer the question, we need to think about the efficiency. It is probable that system A has more
than one datagram to send to system B in a short period of time. For example, if system B is supposed
to receive a long e-mail or a long file, the data do not fit in one datagram.
➢ Let us assume that there are 20 systems connected to the network (link): system A, system B, and 18
other systems. We also assume that system A has 10 datagrams to send to system B in one second.
• Without using ARP, system A needs to send 10 broadcast frames. Each of the 18 other systems
need to receive the frames, decapsulate the frames, remove the datagram and pass it to their
network-layer to find out the datagrams do not belong to them. This means processing and
discarding 180 broadcast frames.
• Using ARP, system A needs to send only one broadcast frame. Each of the 18 other systems need
to receive the frames, decapsulate the frames, remove the ARP message and pass the message to
their ARP protocol to find that the frame must be discarded. This means processing and discarding
only 18 (instead of 180) broadcast frames. After system B responds with its own data-link address,
system A can store the link-layer address in its cache memory. The rest of the nine frames are only
unicast. Since processing broadcast frames is expensive (time consuming), the first method is
preferable.
Department of ECE,CEC 46
MODULE-1 V SEM Computer Communication Networks[21EC53]

PACKET FORMAT
➢ Fig. 8 shows the format of an ARP packet. The names of the fields are self-explanatory. The hardware
type field defines the type of the link-layer protocol; Ethernet is given the type 1.
➢ The protocol type field defines the network-layer protocol: IPv4 protocol is (0800)16. The source
hardware and source protocol addresses are variable-length fields defining the link- layer and network-
layer addresses of the sender. The destination hardware address and destination protocol address fields
define the receiver link-layer and network-layer addresses.
➢ An ARP packet is encapsulated directly into a data-link frame. The frame needs to have a field to show
that the payload belongs to the ARP and not to the network-layer datagram.

Fig. 8: ARP packet


Example:
A host with IP address N1 and MAC address L1 has a packet to send to another host with IP address N2
and physical address L2 (which is unknown to the first host). The two hosts are on the same network. Fig.
9 shows the ARP request and response messages.

Fig. 9: Example for ARP Packet

Department of ECE,CEC 47

You might also like