0% found this document useful (0 votes)
14 views

NS Unit 1 notes_5fddd0c4737f6c19f0ca3e38e31e9c56

Uploaded by

alonesaddy28
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)
14 views

NS Unit 1 notes_5fddd0c4737f6c19f0ca3e38e31e9c56

Uploaded by

alonesaddy28
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/ 66

UNIT I NETWORK MODELS AND LINK LAYER

Overview of Networks and its Attributes – Network Models – OSI, TCP/IP, Addressing
– Physical Layer – Overview of Data and Signals-Introduction to Data link layer-Error
Detection and Correction

OVERVIEW OF NETWORKS AND ITS ATTRIBUTES

Q1.Write the criteria for effective data communications.(2 marks)[MAY/JUNE


2016]
Q2.Define the term protocol and interface.(2 marks) [NOV/DEC 2019]
Q3.Define the term protocol.(2 marks) [NOV/DEC 2015]

Data Communications
• 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).

Characteristics of Data Communications

The effectiveness of a data communications system depends on four characteristics: delivery,


accuracy, timeliness, and jitter.

• Delivery. The system must deliver data to the correct destination. Data must be received by the
receiver device.

• Accuracy. The system must deliver the data accurately. Data that have been altered (changed
during transmission) in transmission and left uncorrected are unusable.

• Timeliness. The system must deliver data in exact time. 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 (any delay) significant delay. This kind of
deliveryiscalledreal-timetransmission.

• Jitter. Jitter refers tothevariation in thepacket arrivaltime. It istheuneven delay in the delivery of
audio and video packets.
For example, let us assume that video packets are sent every 30 ms. If some of the packets
arrive with 30-ms delay and others with 40-ms delay, an uneven quality in the video occurs.

1
Components Required

Fig 1.1: Five components for Communication

The components required for communication is shown in Fig1.1. They are:


a) Message:
The message is the information (data) to be communicated. Popular forms of information
include text, numbers, pictures, audio, and video.

b) Sender:
The sender is the device that sends the data message. It can be a computer, workstation,
telephone handset, video camera, and so on.

c) Receiver:
The receiver is the device that receives the message. It can be a computer, workstation,
telephone handset, television, and so on.

d) 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.

e) Protocol. A protocol is a set of rules that govern data communications. It represents an agreement
between the communicating devices (Between sender and Receiver). Withoutaprotocol,twodevices
may be connected but not communicating, just as a person speaking French cannot be
understood by a person who speaks only Japanese.

Data Representation:
Information today (available) comes in different forms such as text, numbers, images, audio,
and Video.

A) Text:
Text is represented as a bit pattern, a sequence of bits (0s or 1s).
What is bit pattern? All data inside a computer is transmitted as a series of electrical signals
that are either on or off. Therefore, in order for a computer to be able to process any kind of data,
including text, images and sound, they must be converted into binary form. 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.

2
B) Numbers:
Numbers are also represented by bit patterns. The number is directly converted to a binary number
to simplify mathematical operations. ie: Conversion of decimal to binary.

C) Images:
Images are also represented by bit patterns.
Representing image by bit pattern: Images also need to be converted into binary in order
for a computer to process them so that they can be seen on our screen. Digital images are made up of
pixels. Each pixel in an image is made up of binary numbers. If we say that 1 is black (or on) and 0 is
white(oroff), thena simple black and white picture can be created using binary.

D) Audio:
Audio refers to the recording or broadcasting of sound or music. It is continuous, not discrete.

E) Video:
Video refers to the 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, which is a discrete entity
and can be arranged to convey the idea of motion.

Data Flow
Communication between two devices can be simplex, half-duplex, or full-duplex and is shown in
Fig1.2.

Fig1.2: Mode of communication

a) 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 Figure 1.2a). Keyboards and
traditional monitors are examples of simplex devices. In Simplex mode, the
communicationisunidirectional,i.e.,thedataflowinonedirection.
• A device can only send the data but cannot receive it or it can receive the data but cannot send the
data.
• This transmission mode is not very popular as mainly communications require the two-way
exchange of data. The simplex mode is used in thebusiness field as in sales that do not require any
corresponding reply.
• The radio station is a simplex channel as it transmits the signal to the listeners but never allows
them to transmit back.
3
b) 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 Figure 1.2b). Messages flow in both
the directions, but not at the same time.
• Theentirebandwidthofthe communication channelisutilized inonedirection at a time.
• In half-duplex mode, it is possible to perform the error detection, and if any error occurs, then the
receiver requests the sender to retransmit the data. Walkie- talkies are half-duplex
systems.

c) Full-Duplex:

In full-duplex mode (also called duplex), both stations can transmit and receive
simultaneously (at the same time), (see Figure 1.2c).
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.

NETWORKS

Q1. Present the evolution and the types of Networks. (13 marks)[Nov/dec
2021]

What is a Network?
A network is the interconnection of a set of devices capable of communication. A device can be a
host (called as end system) such as a large computer, desktop, laptop, workstation, cellular
phone, or security system.

4
Network Criteria
Anetworkmustbeabletomeetacertainnumberofcriteria. Themostimportantof these are
performance, reliability, and security.

A) 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.

1. the number of users.


2. the type of transmission medium.
3. the capabilities of the connected hardware.
4. the efficiency of the software.
Performance is often evaluated by two networking metrics: throughput and delay.

B) Reliability
In addition to accuracy ofdelivery, network reliabilityis measured bythe frequencyoffailure,the
timeittakesalinktorecoverfromafailure,andthe network’s robustness in a catastrophe.
C) Security
Networksecurityissuesincludeprotectingdatafromunauthorizedaccess, protecting data from
damage and development, and implementing policies and procedures for recovery from data
losses.

Physical Structures 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.
Point-to-Point: Apoint-to-pointconnectionprovidesadedicated link betweentwo devices.
The entire capacity of the link is reserved for transmission between those two devices.

Fig1.3: Types of Connections

Multipoint: A multipoint (also called multidrop) connection is one in which more than two
specific devices share a single link (see Figure1.3 below). 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.

5
Physical Topology (Network 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.
Thetopologyofanetworkisthegeometricrepresentationoftherelationshipofall the links and
linking devices (usually called nodes) to one another.

There are four basic Topologies: mesh, star, bus, and ring.

A. Mesh Topology:
Inameshtopology, everydevicehasadedicated point-to-pointlinktoeveryother device as shown
in Fig 1.4. A fully connected mesh network with n nodes has n (n -
1) /2 physicalchannels.

Fig1.4: Mesh topology

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.
• A mesh topology is robust. If one link becomes unusable, it does not incapacitate the entire
system.
• Privacy orsecurity.
• Point-to-point links make fault identification and fault isolation easy.

Disadvantages:
• Every device must be connected to every other device. Installation and reconnection aredifficult.
• More number of wire connections make it greater than the available space (in walls, ceilings, or
floors) which can accommodate.
• Thehardwarerequiredtoconnecteachlink(I/Oportsandcable)canbe expensive.

One practical example of a mesh topology is the connection of telephone regional offices
inwhicheachregionalofficeneedstobeconnectedtoeveryotherregional office.

B. Star Topology:
In a star topology, each device has a dedicated point-to-point link only to a central controller,
usuallycalled ahub.Thedevicesarenotdirectlyconnectedtooneanother. Unlike a mesh topology, A
star topology does not allow direct traffic between devices. Thecontrolleractsasanexchange:Ifone
device wants to send data to another, it sends the data to the controller, which then relays the data to
theotherconnecteddevice(see Figure1.5).

6
Fig1.5: Star topology

Advantages:
• Less expensive than a mesh topology.
• Easy to install and reconfigure.
• Less cables are required, and additions, and deletions involve only one connection: between that
device and the hub.
• ItisRobust.Ifonelinkfails,onlythatlinkisaffected.Allotherlinksremain active.

Disadvantages:
• The topology depends on one single point, the hub. If the hub goes down, the whole system is
dead.
• A star requires far less cable than a mesh; each node must be linked to a central hub. The star topology
is used in local-area networks (LANs). High- speed LANs also use a star topology with a central
hub.

C. Bus Topology:

Abustopologyismultipoint. Onelongcable act as abackbonetolinkallthedevicesin a network (see


Figure1.6). Nodes are connected to the bus cable by drop lines and taps. A drop line is a
connection between the device and the main cable. A tap is a connectorthat 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, the signal
becomes weaker and weaker as it travels farther and farther. For this reason, there is a limit on the
number of taps used in this topology.

Fig1.6: Bus Topology

Advantages:
• Ease of installation.
• Less cabling
7
Disadvantages:
• Difficult reconfiguration and fault isolation.
• Difficult to add new devices.
• Signal reflection at top can cause degradation in quality.
• If any fault in backbone occurs, then it can stop all transmission.

Ethernet LANs can use a bus topology, but they are less popular now.

D. 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
along them (see Figure1.7).

Fig1.7: Ring Topology

Advantages:
• Easy toinstall.
• Easy toreconfigure.
• Fault identification is easy.

Disadvantages:
• Unidirectional traffic.
• Break in a single ring can break entire network.

Ring topologies are found in some office buildings or school campuses. Today high- speed LANs
made this topology less popular.

E. Tree Topology
Tree topology is shown in Fig 1.8.
• It has a root node and all other nodes are connected to it forming a hierarchy.
• It is also called hierarchical topology.
• It should at least have three levels to the hierarchy.
• Tree topology is ideal if workstations are located in groups.
• They are used in Wide Area Network.

8
Fig 1.8: Tree Topology
F. Hybrid Topology
• Hybrid Topology (see Fig 1.9) is a combination of one or more basic topologies.
• For example if one department in an office uses ring topology, the other departments uses star
and bus topology, then connecting these topologies will result in Hybrid Topology.
• Hybrid Topology inherits the advantages and disadvantages of the topologies included.

Fig 1.9: Hybrid Topology

1.2. BUILDING NETWORK AND ITS TYPES


Q1. Explain the challenges in building an network. (10 marks) [ APR/MAY 2017]
Q2. Explain the challenges faced in building a network. What are the essential
requirements to be taken into consideration for building a network in an
organization
A computer network is a group of computers linked to each other that enables the computer to
communicate with another computer and share their resources, data, and applications.
Acomputernetworkcanbecategorizedbytheirsize.Acomputernetworkismainlyof three types:

A. Local Area Network (LAN)


B. Wide Area Network (WAN)
C. Metropolitan Area Network (MAN)

9
Local Area Network

• LocalAreaNetworkisagroupofcomputersconnectedtoeachotherina small area such as building,


office.LAN is used for connecting two or more personal computers through a communication
medium such as twisted pair, coaxial cable, etc.
• Itislesscostlyasitisbuiltwithinexpensivehardwaresuchashubs,network adapters, and ethernet
cables.
• The data is transferred at an extremely faster rate in Local Area Network.
• LAN can be connected using a common cable or a Switch.

Fig1.10: LAN connections

B. Wide Area Network (WAN)


• A Wide Area Network is a network that extends over a large geographical area such as states or
countries.
• A Wide Area Network is quite bigger network than the LAN.
• Awidearea networkisaninterconnection ofdevices capableofcommunication.
• AWideArea Networkisnotlimited toasinglelocation,butitspansoveralarge geographical area
through a telephone line, fiber optic cable or satellite links.
• The internet is one of the biggest WAN in the world.
• A Wide Area Network is widely used in the field of business, government, and education.
• WAN can be either a point-to-point WAN or Switched WAN.

10
Fig 1.11 Wide Area Network

A) Point-to-Point WAN
A point-to-point WAN (see Fig1.12) is a network that connects two communicating devices through
a transmission media (cable or air).

Fig1.12: point-to-point WANS.

B) Switched WAN
A switched WAN is a network with more than two ends (see Fig1.13). A switched WAN is a
combination of several point-to-point WANs that are connected by switches.

Fig1.13: Switched WAN.

There are some differences between a LAN and a WAN.


1. 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.
2. A LAN interconnects hosts; a WAN interconnects connecting devices such as switches, routers, or
modems.
3. 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.

C. Metropolitan Area Network (MAN)

• A metropolitan area network is a network that covers a larger geographic area by interconnecting a
11
different LAN to form a larger network.
• It generally covers towns and cities (50 km)
• In MAN, various LANs are connected to each other through a telephone exchange line.
• Communication medium used for MAN are optical fibers, cables etc.
• It has a higher range than Local Area Network (LAN).It is adequate for distributed
computingapplications.

Fig 1.14 Metropolitan Area Network


Internetwork

When two or more networks are connected, they make an internetwork or internet. As an
example, assumethat an organization has two offices, one on the east coast and theotheronthewest
coast.EachofficehasaLANthatallowsallemployeesintheoffice to communicate with each other.

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.

A) Circuit-Switched Network

In a circuit-switched network, a dedicated connection, called a circuit, is always available


between the two end systems (or between two computers).

Fig1.15: Circuit-switched network

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.
12
B) Packet-Switched Network

• In a computernetwork, the communication between the two ends is done in blocks


of data called packets.

• In other words, instead of the continuous communication 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.

• A router in a packet-switched network has a queue that can store and forward the
packet.

Fig1.16: Packet-Switched Network

OVERVIEW OF INTERNET

The Internet

An internet (lower case 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. Figure1.17 shows a conceptual
view of the Internet.
It 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 backbone networks are connected
throughsomecomplexswitchingsystems,calledpeeringpoints.

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 Internet.

Accessing the Internet

• The Internet today is an internetwork that allows any user to become part of it. The
user, however, needs to be physically connected to an ISP. The physical connection is
13
done through a point-to-point WAN.

Fig1.17: Internet

b. Using Telephone Networks

Since most telephone networks have already connected themselves to the Internet, one option for
residences and small businesses to connect to the Internet is to change the voice line between the
residence or business and the telephone center to a point-to- point WAN. This can be done in two
ways.

• Dial-up service. The first solution is to add to the telephone line a modem that
converts data to voice. The software installed on the computer dials the ISP and
imitates making a telephone connection.
• DSL Service.
The DSL service allows the line to be used simultaneously for voice and data
communication.

c. Using Cable Networks


The cable companies have been upgrading their cable networks and connecting to
the Internet.

d. Using Wireless Networks

A household or a small business can use a combination of wireless and wired


14
connections to access the Internet. Small business centers can be connected to the
Internet through a wireless WAN.

e. Direct Connection to the Internet


A large organization can become a local ISP and be connected to the Internet. This can
be done if the organization or the corporation leases a high-speed WAN from a carrier
provider and connects itself to a regional ISP (Internet service provider). For example,
a large university with several campuses can create an internetwork and then connect
the internetwork to the Internet.

1.2 NETWORK MODELS


PROTOCOL LAYERING

Q1. What are the key benefits of layered network?(2 marks)[NOV/DEC 2019]
When communication is simple, we 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 a teach layer, or protocol layering. Dividing the task
between different layers is called Protocol layering.
Need of layering:

 It decomposes the problem of building a network into more manageable components.


Each layer solves one part of the problem.

 It provides a more modular design. i.e, If we want to add new service, it require only
modifying the functionality at the respective layers and refusing the functions provided
at all other layers.

Scenarios
Two simple scenarios are available to understand the need for protocol layering.

First Scenario
In the first scenario, communication is 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 Figure1.18.

Fig1.18: Single layer protocol Set of rules followed in this scenario:

First, Maria and Ann know that they should greet each other when they meet. Second,
they know that they should confine their vocabulary to the level of their friendship.
Third, each party knows that she should refrain (not talking) from speaking when the
other party is speaking.
Fourth, each party knows that the conversation should be a dialog.
15
Fifth, they should exchange some nice words when they leave

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.
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.

Fig1.19: Three layer protocol

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. 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, takes the ciphertext, puts it in an envelope, adds the sender
and receiver addresses, and mails it. Protocol layering enables us to divide a complex
task into several smaller and simpler tasks. For example, in the Figure 1.19, 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.

16
Principles of Protocol Layering

First Principle
If we want bidirectional communication, we need to make each layer so that it is able
to 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 cipher text letter. The object under layer 1 at both sites should be a piece
of mail.

Logical Connections

Logical connection between each layer is shown in Figure1.20.

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.

Fig1.20: the concept of logical connection between layers.

THE OSI MODEL

Q1. Draw the OSI network architecture and explain the functionalities of every
layer in detail. (13 MARKS) [NOV/DEC 2015]
Q2. Draw the block diagram and explain the functionalities of different OSI layers.
(13 MARKS) [NOV/DEC 2019]
Q3. Data Link Control (DLC) and Media Access Control (MAC) are part of which
layer in OSI model? What is their role? (13 MARKS) [NOV/DEC 2020]
Q4. Discuss the layering principles of OSI mode of communication networks.
(13 MARKS) [NOV/DEC 2021]
17
ISO defines a common way to connect computer by the architecture called Open System
Interconnection(OSI) architecture. Network functionality is divided into seven layers.

Organization of the layers


The 7 layers can be grouped into 3 subgroups

A. Network Support Layers


Layers 1,2,3 - Physical, Data link and Network are the network support layers. They deal
with the physical aspects of moving data from one device to another such as electrical
specifications, physical addressing, transport timing and reliability.

B. Transport Layer
Layer4, transport layer, ensures end-to-end reliable data transmission on a single link.

C. User Support Layers


Layers 5,6,7 – Session, presentation and application are the user support layers. They
allow interoperability among unrelated software systems

Fig 1.21 The interaction between layers in the OSI model

18
Fig 1.22 A Data exchange using the OSI model

Functions of the Layers

1. PHYSICAL LAYER

The physical layer coordinates the functions required to transmit a bit stream over a physical
medium.

Fig 1.23 Physical Layer


The physical layer is concerned with the following:

⚫ Physical characteristics of interfaces and media - The physical layer defines the
characteristics of the interface between the devices and the transmission medium.
⚫ Representation of bits - To transmit the stream of bits, it must be encoded to signals.
The physical layer defines the type of encoding.
⚫ Data Rate or Transmission rate - The number of bits sent each second – is also
defined by the physical layer.
⚫ Synchronization of bits - The sender and receiver must be synchronized at thebit
level. Their clocks must be synchronized.
⚫ Line Configuration - In a point-to-point configuration, two devices are connected
together through a dedicated link. In a multipoint configuration, a link is shared
between several devices.
⚫ Physical Topology - The physical topology defines how devices are connectedto
make a network. Devices can be connected using a mesh, bus, star or ring topology.

19
⚫ Transmission Mode - The physical layer also defines the direction of transmission
between two devices: simplex, half-duplex or full-duplex.

2. DATA LINK LAYER

It is responsible for transmitting frames from one node to next node.

Fig 1.24 Data Link Layer


The other responsibilities of this layer are

⚫ Framing - Divides the stream of bits received into data units called frames.
⚫ Physical addressing – If frames are to be distributed to different systems on the n/w,
data link layer adds a header to the frame to define the sender and receiver.
⚫ Flow control- If the rate at which the data are absorbed by the receiver is less than
the rate produced in the sender ,the data link layer imposes a flow control mechanism.
⚫ Error control- Used for detecting and retransmitting damaged or lost frames andto
prevent duplication of frames. This is achieved through a trailer added at the end of
the frame.
⚫ Access control -Used to determine which device has control over the link at any given
time.

3. NETWORK LAYER

This layer is responsible for the delivery of packets from source to destination.

Fig 1.25 Network Layer


The other responsibilities of this layer are

⚫ Logical addressing - If a packet passes the n/w boundary, we need another


addressing system for source and destination called logical address.
⚫ Routing – The devices which connects various networks called routers are
responsible for delivering packets to final destination.

20
4. TRANSPORT LAYER

It is responsible for Process to Process delivery. It also ensures whether the message arrives in
order or not.

Fig 1.26 Transport Layer


The other responsibilities of this layer are

• Port addressing - The header in this must therefore include an address called port
address. This layer gets the entire message to the correct process on that computer.
• Segmentation and reassembly - The message is divided into segments and each
segment is assigned a sequence number. These numbers are arranged correctly on
the arrival side by this layer.
• Connection control - This can either be connectionless or connection-oriented. The
connectionless treats each segment as an individual packet and delivers to the
destination. The connection-oriented makes connection on the destination side
before the delivery. After the delivery the termination will be terminated.
• Flow and error control - Similar to data link layer, but process to process take place.

5. SESSIONLAYER

This layer establishes, manages and terminates connections between applications.

Fig 1.27 Session Layer


The other responsibilities of this layer are
Dialog control - This session allows two systems to enter into a dialog either in half
duplex or full duplex.
Synchronization-This allows to add checkpoints into a stream of data.

6. PRESENTATION LAYER

It is concerned with the syntax and semantics of information exchanged between


two systems.

21
Fig 1.28 Presentation Layer

The other responsibilities of this layer are

• Translation – Different computers use different encoding system, this layer


is responsible for interoperability between these different encoding methods.
It will change message into some common format.
• Encryption and decryption-It means that sender transforms the original
information to another form and sends the resulting message over the n/w.
and vice versa.
• Compression and expansion-Compression reduces the number of bits
contained in the information particularly in text, audio and video.

7. APPLICATION LAYER

Thislayer enablesthe userto accessthen/w. This allowstheusertolog on to remote user.

Fig 1.29 Application Layer

The other responsibilities of this layer are

⚫ FTAM (file transfer, access, mgmt.) - Allows user to access files in a remote host.
⚫ Mail services - Provides email forwarding and storage.
⚫ Directory services - Provides database sources to access information about various sources and
objects.

22
TCP/IP PROTOCOL SUITE / TCP/IP REFERENCE MODEL [INTERNET
ARCHITECTURE]
Q1. Explain TCP/IP Model with neat sketch.

• The TCP/IP architecture is also called as Internet architecture.


• It is developed by the US Defense Advanced Research Project Agency (DARPA) for its
packet switched network (ARPANET).
• TCP/IP is a protocol suite used in the Internet today.
• It is a 5-layer model. The layers of TCP/IP are

• Application layer
• Transport Layer (TCP/UDP)
• Internet Layer
• Network Interface Layer

• The host-to-network layer is equivalent to the combination of the physical and data
link layers. The internet layer is equivalent to the network layer, and the application
layer is roughly doing the job of the session, presentation, and application layers with
the transport layer in TCPIIP taking care of part of the duties of the session layer. So,
the TCP/IP protocol suite is made of five layers:
physical, data link, network, transport, and application.

• The first four layers provide physical standards, network interfaces, internetworking,
and transport functions that correspond to the first four layers of the OSI model.
• The three topmost layers in the OSI model, however, are represented in TCPIIP by a
single layer called the application layer.

Fig 1.30 Layer Organization

23
Fig 1.31 Flow of data between layers

Physical Layer

The 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.
• Two devices are connected by a transmission medium (cable or air).
• So, the bits received in a frame from the data-link layer are transformed and sent
through the transmission media, but the logical unit between two physical layers in
two devices is a bit.
• There are several protocols that transform a bit to a signal.

24
Data-link Layer
o 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.
o 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. The link can be a wired LAN with a link-layer
switch, a wireless LAN, a wired WAN, or a wireless WAN. It supports all the standard and
proprietary protocols.

o 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. 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
• 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.
• 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.
• At the network layer (or, more accurately, the internetwork layer), TCP/IP supports the
Internetworking Protocol. IP, in turn, uses four supporting protocols: ARP, RARP, ICMP,
and IGMP.

Transport Layer

• Traditionally the transport layer was represented in TCP/IP by two protocols: TCP and
UDP. IP is a host-to-host protocol, meaning that it can deliver a packet from one physical
device to another.
• UDP and TCP are transport level protocols responsible for delivery of a message from a
process (running program) to another process.
• 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.
• TCP provides flow control, error control and congestion control to reduce the loss of
segments due to congestion in the network.
• 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

25
user datagram is an independent entity without being related to the

• previous or the next one. UDP is a simple protocol that does not provide flow, error, or
congestion control.
• A new protocol, Stream Control Transmission Protocol (SCTP) is designed to respond to
new applications that are emerging in the multimedia

Application Layer

• The application layer in TCP/IP is equivalent to the combined session, presentation, and
application layers in the OSI model. Many protocols are defined at this layer.
• Communication at the application layer is between two processes. The application layer
in the Internet includes many predefined protocols.
• The Hypertext Transfer Protocol (HTTP) is a vehicle for accessing the World Wide Web
(WWW).
• The Simple Mail Transfer Protocol (SMTP) is the main protocol used in electronic mail
(e-mail) service.
• The File Transfer Protocol (FTP) is used for transferring files from one host to another.
The Terminal Network (TELNET) and Secure Shell (SSH) are used for accessing a site
remotely.

26
Fig 1.32 OSI Verses TCP/IP

Encapsulation and Decapsulation

One of the important concepts in protocol layering in the Internet is encapsulation/


decapsulation.

Encapsulation at the Source Host


At the source, we have only encapsulation.
1. 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.

2. 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

27
the identifiers of the source and destination application programs that want to
communicate plus some more information that is needed for the end-toend 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.

3. 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.

4. 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.

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.
1. 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.
2. 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.

3. 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.

Addressing

28
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 [email protected]. 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. 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).

PHYSICAL LAYER:

Communication at Physical Layer:

29
Physical Layer

1.1. OVERVIEW OF DATA AND SIGNALS


Q1. Define transmission impairment. What are some of the main
reasons oftransmission impairment?(13 marks) [Nov-Dec 2020]

• To be transmitted, data must be transformed to electromagnetic signals.


• Data can be Analog or Digital.
• Analog data refers to information that is continuous; ex. sounds made by a human
voice.
• Digital data refers to information that has discrete states. Digital data take on
discrete values. For example, data are stored in computer memory in the form of
Os and 1s.

Signals can be of two types:


1. Analog Signal: They have infinite values in a range.
2. Digital Signal: They have limited number of defined values

30
Analog and Digital signal
1.7.1 ANALOG SIGNAL :

An analog signal has infinitely many levels of intensity over a period of time. As the wave
moves from value A to value B, it passes through and includes an infinite number of values
along its path as it can be seen in the figure below. A simple analog signal is a sine wave
that cannot be further decomposed into simpler signals.

Analog signal

A sine wave can be represented by three parameters: the peak amplitude, the
frequency, and the phase. These three parameters fully describe a sine wave.

Peak Amplitude
The peak amplitude of a signal is the absolute value of its highest intensity, proportional
to the energy it carries. For electric signals, peak amplitude is normally measured in volts.
Figure below shows two signals and their peak amplitudes.

Analog signal peak differences

Period and Frequency


Period refers to the amount of time, in seconds, a signal needs to complete 1 cycle.
Frequency refers to the number of periods in 1 s. Frequency is the rate of change with
respect to time. Period is the inverse of frequency, and frequency is the inverse of period,
as the following formulas shows:

Phase
The term phase, or phase shift, describes the position of the waveform relative to time.
31
Phase describes the amount of that shift. It indicates the status of the first cycle.

Sine wave with different phases

Time and Frequency Domains


A sine wave is comprehensively defined by its amplitude, frequency, and phase. Th time-
domain plot shows changes in signal amplitude with respect to time (it is an amplitude-
versus-time plot). Phase is not explicitly shown on a time-domain plot. To show the
relationship between amplitude and frequency, frequency-domain plot is used. A
frequency-domain plot is concerned with only the peak value and the frequency. Changes
of amplitude during one period are not shown.

Sine wave in time and frequency domain

Composite Signals:
A composite signal is made of many simple sine waves. The bandwidth of a composite
signal is the difference between the highest and the lowest frequencies contained in that
signal.

Composite signal

32
1.7.2 DIGITAL SIGNALS:
Apart from analog signal, information can also be represented by a digital signal.

Digital signal

Bit Rate
The bit rate is the number of bits sent in 1s, expressed in bits per second (bps).

Bit Length
The bit length is the distance one bit occupies on the transmission medium.

Transmission of Digital Signals

Baseband Transmission
Baseband transmission means sending a digital signal over a channel without changing
the digital signal to an analog signal. Figure below shows baseband transmission.

Baseband transmission requires that we have a low-pass channel, a channel with a


bandwidth that starts from zero. This is the case if we have a dedicated medium with a
bandwidth constituting only one channel.

Baseband transmission

Case 1: Low-Pass Channel with Wide Bandwidth


To preserve the exact form of a nonperiodic digital signal with vertical segments vertical
33
and horizontal segments horizontal, there is a need to send the entire spectrum, the
continuous range of frequencies between zero and infinity. This is possible if there is a
dedicated medium with an infinite bandwidth between the sender and receiver that
preserves the exact amplitude of each component of the composite signal.

Baseband transmission using dedicated medium

Case 2: Low-Pass Channel with Limited Bandwidth


In a low-pass channel with limited bandwidth, we approximate the digital signal with an
analog signal. The level of approximation depends on the bandwidth available.

Broadband Transmission (Using Modulation)


Broadband transmission or modulation means changing the digital signal to an analog
signal for transmission. Modulation allows us to use a bandpass channel—a channel with
a bandwidth that does not start from zero. This type of channel is more available than a
low-pass channel.

’’
Broadband Transmission

Modulation of a digital signal for transmission on a bandpass channel

TRANSMISSION IMPAIRMENT

34
Signals travel through transmission media, which are not perfect. The imperfection
causes signal impairment. This means that the signal at the beginning of the medium is
not the same as the signal at the end of the medium. Three causes of impairment are
attenuation, distortion, and noise.

a. Attenuation
Attenuation means a loss of energy. When a signal, simple or composite, travels
through a medium, it loses some of its energy in overcoming the resistance of the
medium. Some of the electrical energy in the signal is converted to heat. To
compensate for this loss, amplifiers are used to amplify the signal. The Figure
shows the effect of attenuation and amplification.

Effect of attenuation on signalAttenuation


loss in Db:

b. Distortion
Distortion means that the signal changes its form or shape. Distortion can occur in
a composite signal made of different frequencies. Each signal component has its
own propagation speed through a medium. Differences in delay may create a
difference in phase if the delay is not exactly the same as the period duration. The
shape of the composite signal is therefore not the same. The Figure shows the
effect of distortion on a composite signal.

35
Effect of distortion on signal

c. Noise
Noise is another cause of impairment. Several types of noise, such as thermal
noise, induced noise, crosstalk, and impulse noise, may corrupt the signal. Thermal
noise is the random motion of electrons in a wire which creates an extra signal not
originally sent by the transmitter. Induced noise comes from sources such as
motors and appliances.

Effect of noise on signal

Signal-to-Noise Ratio (SNR)


The ratio of the signal power to the noise power is defined as:

SNR=average signal power / average noise power

PERFORMANCE
A. Bandwidth
One characteristic that measures network performance is bandwidth. However, the term
can be used in two different contexts with two different measuring values: bandwidth in
hertz and bandwidth in bits per second. It

Bandwidth in Hertz

Bandwidth in hertz is the range of frequencies contained in a composite signal or the


range of frequencies a channel can pass. For example, we can say the bandwidth of a
subscriber telephone line is 4 kHz. refers to the range of frequencies in a composite
signal or the range of frequencies that a channel can pass.

Bandwidth in Bits per Seconds


The term bandwidth can also refer to the number of bits per second that a channel, a link, or even a
network can transmit. For example, one can say the bandwidth of a Fast Ethernet network (or the
links in this network) is amaximum of 100 Mbps. This means that this network can send 100 Mbps.
bandwidth in bits per second, refers to the speed of bit transmission in a channel or link.

B. Throughput
The throughput is a measure of how fast we can actually send data through a network.
A link may have a bandwidth of B bps, but we can only send T bps through this link with
T always less than B. In other words, the bandwidth is a potential measurement of a
link; the throughput is an actual measurement of how fast we can send data. For
example, we may have a link with a bandwidth of 1 Mbps, but the devices connected to
the end ofthe link may handle only 200 kbps. This means that we cannot send more than
200 kbps through this link.

C.Latency(delay)
The latency or delay defines how long it takes for an entire message to completely
arrive at the destination fromthe time the first bit is sent out from the source. Latency
is made of four components: propagation time, transmission time, queuing time and
processing delay.

Propagation Time

Propagation time measures the time required for a bit to travel from the source to the
destination. The propagation time is calculated by dividing the distance by the
propagation speed.

Propagation time = Distance / (Propagation Speed)

Transmission Time
There is a time between the first bit leaving the sender and the last bit arriving at the
receiver. The first bit leavesearlier and arrives earlier; the last bit leaves later and arrives
later. The transmission time of a message depends on the size of the message and the
bandwidth of the channel.

Transmission time = (Message size) / Bandwidth

D.Bandwidth-delay product

The bandwidth-delay product defines the number of bits that can fill the
link. Bandwidth and delay are twoperformance metrics of a link.

Case 1: Let us assume that we have a link with a bandwidth of 1 bps (unrealistic, but good
for demonstration purposes). We also assume that the delay of the link is 5 s (also
unrealistic). We want to see what the bandwidth- delay product means in this case.
Looking at the figure, we can say that this product 1 x 5 is the maximum numberof bits
that can fill the link. There can be no more than 5 bits at any time on the link.
Fig. Filling the link with bits for case 1

Case 2. Now assume we have a bandwidth of 5 bps. Figure shows that there can be
maximum 5 x 5 =25 bits on the line. The reason is that, at each second, there are 5 bits on
the line; the duration of each bit is 0.20 s. The abovetwo cases show that the product of
bandwidth and delay is the number of bits that can fill the link. This measurement is
important if we need to send data in bursts and wait for the acknowledgment of each
burst beforesending the next one. To use the maximum capability of the link, we need to
make the size of our burst 2 times the product of bandwidth and delay; we need to fill up
the full-duplex channel (two directions). The sender should send a burst of data of (2 x
bandwidth x delay) bits. The sender then waits for receiver acknowledgment for part of
the burst before sending another burst. The amount 2 x bandwidth x delay is the number
of bits that can be in transition at any time.

Fig. Filling the link with bits for case 2

D. Jitter
Jitter is a problem if different packets of data encounter different delays and the
application using the data at the receiver site is time-sensitive (audio and video data, for
example). If the delay for the first packet is 20 ms, for thesecond is 45 ms, and for the third
is 40 ms, then the real-time application that uses the packets endures jitter.

INTRODUCTION TO DATA LINK LAYER

Q1.State the issues in datalink layer. (2 marks) NOV/DEC 2015


Q2. List the responsibilities of data link layer. (2 marks) NOV/DEC 2019

The Internet is a combination of networks combined 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. Figure shows the same scenario. Communication at the data-
link layer is made up of five separate logical connections between the data-link layers in
the path.

Fig.1.49 Communication at the data-link layer

The data-link layer at Alice’s computer communicates with the data-link layer at
routerR2. The data-link layer at router R2 communicates with the data-link layer at
router R4, and s on. Finally, the data-link layer at router R7 communicates with the data-
linklayer 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. 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.

A. 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.1.50 Nodes and links.

• Figure1.50 shows a simple representation of links and nodes when the path of the
data unit is only six nodes. 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.

B. Services

The data-link layer is located between the physical and the network layers. The data
link layer provides services to the network layer; it receives services from the physical
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 path.
• 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.

Services provided by the data-link layer:


A. Framing
B. Flow control
C. Error control
D. Congestion control

A. 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 de capsulate the datagram from the frame received on the logical
channel.
• A packet at the data-link layer is normally called a frame

B. Flow Control

Controlling the flow of frames at the sender side to avoid overflow and loss of data at
the receiver side is called flow control.
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.

C. 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 affected by error, a frame is also get affected by
error. The error should be detected.
• After detection, it needs to be either corrected at the receiver node or discarded and
retransmitted by the sending node.
D. Congestion Control
• 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 prevent congestion.
• 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


• Point-to-point link
• 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.

Two Sub layers


The data-link layer has two sub layers:

Data link control (DLC) and media access control (MAC).


The data link control sub layer deals with all issues common to both point-to-point and
broadcast links; the media access control sub layer deals only with issues specific to
broadcast links.
1.3. LINK-LAYER ADDRESSING
A link-layer address is called a link address, sometimes called a physical address, and
sometimes a MAC address. 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.

Figure shows, IP addresses and link-layer addresses in a small internet. In the diagram,
three links and two routers. There are 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).

A router has as many pairs of addresses as the number of links the router is connected to.
Three frames are shown, 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.
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.

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

Three types of Address:


A. 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
B. Multicast Address
Some link-layer protocols define multicast addresses. Multicasting means one-to- many
communications.

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, needstobeanevennumberin
hexadecimal.Thefollowingshowsamulticastaddress:

A2:34:45:11:92:F1

C. 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

Address Resolution Protocol (ARP)

The ARP protocol is one of the protocols defined in the network layer, as shown in Figure. It belongs to
the network layer. It maps an IP address to a logical-link address.

The main work of ARP:


• 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.

Fig1.53 ARP
• If 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.

Fig 1.54 ARP operation

• Every host or router on the network receives and processes the ARP request packet, but only the
intended recipient recognizes its IP address and sends back an AR 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 Figure, 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 Figure above.

• 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.
Packet Format
• Figure 1.55 shows the format of an ARP packet.
• 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 1.55 ARP packet

Example

1.4. ERROR DETECTION AND CORRECTION

Q1. Explain any two error detection mechanisms in detail. (13 marks)[MAY/JUNE
2016]
Q2. Obtain the 4 bit CRC for the data sequence 10011011100 using the polynomial
X4+X2+1
Q3. Enumerate any one method for error detection and any one method for
correction. . (13 marks)[NOV/DEC 2021]

Types of Errors
• Whenever bits flow from one point to another, they are subject to unpredictable
changes because of interference.
• The term single-bit error means that only 1 bit of a given data unit (such as a byte,
character, or packet) is changed from 1 to 0 or from 0 to 1.
• The term burst error means that 2 or more bits in the data unit have changed from 1 to
0 or from 0 to 1. Figure shows the effect of a single-bit and a burst error on a data unit.

• A burst error is more likely to occur than a single-bit error because the duration of the
noise signal is normally longer than the duration of 1 bit, which means that when noise
affects data, it affects a set of bits.
• The central concept in detecting or correcting errors is redundancy. To be able to detect
or correct errors, we need to send some extra bits with our data. These redundant bits
are added by the sender and removed by the receiver. Their presence allows the receiver
to detect or correct corrupted bits.
• In error detection, we are only looking to see if any error has occurred. The answer is a
simple yes or no. We are not even interested in the number of corrupted bits. A single-bit
error is the same for us as a burst error.
• In error correction, we need to know the exact number of bits that are corrupted and,
more importantly, their location in the message.
• Redundancy is achieved through various coding schemes. We can divide coding schemes
into two broad categories: block coding and convolution coding.

ERROR DETECTION TECHNIQUES:

BLOCK CODING

• In block coding, we divide our message into blocks, each of k bits, called datawords. We
add r redundant bits to each block to make the length n = k + r. The resulting n-bit
blocks are called codewords.

• Figure shows the role of block coding in error detection. The sender creates codewords
out of datawords by using a generator that applies the rules and procedures of
encoding.

• Each codeword sent to the receiver may change during transmission. If the received
codeword is the same as one of the valid codewords, the word is accepted; the
corresponding dataword is extracted for use. If the received codeword is not valid, it is
discarded.

• However, if the codeword is corrupted during transmission but the received word still
matches a valid codeword, the error remains undetected.
Example: Even Parity
Let us assume that k = 2 and n = 3. Table shows the list of datawords and codewords.

Assume the sender encodes the dataword 01 as 011 and sends it to the receiver. Consider
the
following cases:
1. The receiver receives 011. It is a valid codeword. The receiver extracts the dataword
01 from it.
2. The codeword is corrupted during transmission, and 111 is received (the leftmost bit
is corrupted).
This is not a valid codeword and is discarded.
3. The codeword is corrupted during transmission, and 000 is received (the right two bits
are corrupted). This is a valid codeword. The receiver incorrectly extracts the dataword
00. Two corrupted bits have made the error undetectable.

Hamming Distance
• The Hamming distance between two words (of the same size) is the number of
differences between the corresponding bits.
• For example, if the codeword 00000 is sent and 01101 is received, 3 bits are in error
and the Hamming distance between the two is d(00000, 01101) = 3.
• The Hamming distance can easily be found if we apply the XOR operation on the two
words and count the number of 1s in the result.
Example
Let us find the Hamming distance between two pairs of words.
1. The Hamming distance d(000, 011) is 2 because (000 ⊕ 011) is 011 (two 1s).
2. The Hamming distance d(10101, 11110) is 3 because (10101 ⊕ 11110) is 01011
(three 1s).

Minimum Hamming Distance for Error Detection


o In a set of codewords, the minimum Hamming distance is the smallest Hamming
distance between all possible pairs of codewords.
o To guarantee the detection of up to s errors in all cases, the minimum Hamming
distance in a block code must be dmin = s + 1.

LINEAR BLOCK CODES


A linear block code is a code in which the exclusive OR of two valid codewords creates
another valid codeword.

Minimum Distance for Linear Block Codes


It is simple to find the minimum Hamming distance for a linear block code. The
minimum Hamming distance is the number of 1s in the nonzero valid codeword with
the smallest number of 1s.

Parity-Check Code
▪ Perhaps the most familiar error-detecting code is the parity-check code. This code is a
linear block code. In this code, a k-bit data word is changed to an n-bit codeword where
n = k + 1. The extra bit, called the parity bit, is selected to make the total number of 1s in
the codeword even.
▪ The minimum Hamming distance for this category is dmin = 2, which means that the
code is a single-bit error-detecting code.

Figure shows a possible structure of an encoder (at the sender) and a decoder (at the
receiver).

The encoder uses a generator that takes a copy of a 4-bit dataword (a0, a1, a2, and a3)
and generates a parity bit r0.

R0 = a3 + a2 + a1 + a0 (modulo-2)
• If the number of 1s is even, the result is 0; if the number of 1s is odd, the result is 1. In
both cases, the total number of 1s in the codeword is even.
• The sender sends the codeword, which may be corrupted during transmission. The
receiver receives a 5-bit word. The checker at the receiver does the same thing as the
generator in the sender with one exception: The addition is done over all 5 bits. The
result which is called the syndrome, is just 1 bit. The syndrome is 0 when the number of
1s in the received codeword is even; otherwise, it is 1.
S0 =b3 + b2 + b1 + b0 + q0 (modulo-2)
The syndrome is passed to the decision logic analyzer. If the syndrome is 0, there is no
detectable error in the received codeword; the data portion of the received code word is
accepted as the dataword; if the syndrome is 1, the data portion of the received
codeword is discarded.

TWO-DIMENSIONAL PARITY CHECK(LONGITUDINAL REDUNDANCY CHECK)

Parity check bits are calculated for each row, which is equivalent to a simple parity checkbit.Paritycheck
bitsarealsocalculatedforallcolumns,thenbotharesent along withthedata. At the receivingend these
arecompared with theparitybits calculated on the received data.

CYCLIC CODES

Cyclic codes are special linear block codes with one extra property. In a cyclic code, if a
codeword is cyclically shifted (rotated), the result is another codeword. For example, if
1011000 is a codeword and we cyclically left-shift, then 0110001 is also a codeword.

Cyclic Redundancy Check (CRC)

CRC is the subset of cyclic codes which is used in networks such as LANs and WANs.

CRC ENCODER and DECODER


ENCODER

DECODER
Example 2

Polynomials
A better way to understand cyclic codes and how they can be analyzed is to represent
them as polynomials.

A Polynomial to represent a binary word

The degree of a polynomial is the highest power in the polynomial. For example, the
degree of the polynomial x6 + x + 1 is 6.
Adding and Subtracting Polynomials
• Adding and subtracting polynomials in mathematics are done by adding or subtracting
the coefficients of terms with the same power. In our case, the coefficients are only 0 and
1, and adding is in modulo-2.
• Addition and subtraction are the same. Adding or subtracting is done by combining terms
and deleting pairs of identical terms.
• For example, adding x5 + x4 + x2 and x6 + x4 + x2 gives just x6 + x5. The terms x4 and x2
are deleted. However, note that if we add, for example, three polynomials and we get x2
three times, we delete a pair of them and keep the third.

Multiplying or Dividing Terms


In this arithmetic, multiplying a term by another term is very simple; we just add the
powers. For example, x3 × x4 is x7. For dividing, we just subtract the power of the
second term from the power of the first. For example, x5/x2 is x3.

Shifting
Shifting to the left means adding extra 0s as rightmost bits; shifting to the right means
deleting some rightmost bits.

Shifting to the left is accomplished by multiplying each term of the polynomial by xm,
where m is the number of shifted bits; shifting to the right is accomplished by dividing
each term of the polynomial by xm.

Check Sum
Procedure to calculate Traditional check sum
Traditionally, the Internet has used a 16-bit checksum. The sender and the receiver
follow the steps depicted in Table

Example1
Example 2

Exercise: nov/dec 2021


i) Answer the following questions: (7)

I. What is the polynomial representation of 110111?


II. What is the result of shifting 111000 three bits to the left? III Repeat part
(ii) using polynomials.
IV What is th e result of shifting 110011 four bits to the right? Repeat part (iv)
using polynomials.

Fletcher Checksum
Adler Checksum

ERROR CORRESTION TECHNIQUES:

FORWARD ERROR CORRECTION: HAMMING CODE

Hamming Code

Hamming code is a set of error-correction codes that can be used to detect and correct
the errors that can occur when the data is moved or stored from the sender to the
receiver. It is technique developed by R.W. Hamming for error correction.

Redundant bits –
Redundant bits are extra binary bits that are generated and added to the information-
carrying bits of data transfer to ensure that no bits were lost during the data transfer. The
number of redundant bits can be calculated using the following formula:

2^r ≥ m + r + 1
where, r = redundant bit, m = data bit
Suppose the number of data bits is 7, then the number of redundant bits can be calculated
using: = 2^4 ≥ 7 + 4 + 1
Thus, the number of redundant bits= 4
Parity bits –

A parity bit is a bit appended to a data of binary bits to ensure that the total number of
1’s in the data are even or odd. Parity bits are used for error detection. There are two
types of parity bits:

1. Even parity bit:

In the case of even parity, for a given set of bits, the number of 1’s are counted. If that
count is odd, the parity bit value is set to 1, making the total count of occurrences of 1’s
an even number. If the total number of 1’s in a given set of bits is already even, the parity
bit’s value is 0.

2. Odd Parity bit

In the case of odd parity, for a given set of bits, the number of 1’s are counted. If that count
is even, the parity bit value is set to 1, making the total count of occurrences of 1’s an odd
number. If the total number of 1’s in a given set of bits is already odd, the parity bit’s value
is 0.
General Algorithm of Hamming code –

• The Hamming Code is simply the use of extra parity bits to allow the
identification of an error.

• Write the bit positions starting from 1 in binary form (1, 10, 11, 100, etc).
• All the bit positions that are a power of 2 are marked as parity bits (1, 2, 4, 8,
etc).
• All the other bit positions are marked as data bits.
• Each data bit is included in a unique set of parity bits, as determined its bit
position in binary form.
• Parity bit 1 covers all the bits positions whose binary representation includes a 1
in the least significant position (1, 3, 5, 7, 9, 11,
etc).
• Parity bit 2 covers all the bits positions whose binary representation includes a 1
in the second position from the least significant bit (2, 3, 6, 7, 10, 11, etc).
• Parity bit 4 covers all the bits positions whose binary representation includes a 1
in the third position from the least significant bit (4–7, 12–15, 20–23, etc).
• Parity bit 8 covers all the bits positions whose binary representation includes a 1
in the fourth position from the least significant bit bits (8–15, 24–31, 40–47, etc).
• In general each parity bit covers all bits where the bitwise AND of the parity
position and the bit position is non-zero.
• Since we check for even parity set a parity bit to 1 if the total number of ones in
the positions it checks is odd.
• Set a parity bit to 0 if the total number of ones in the positions it checks is even.

Determining the position of redundant bits –

These redundancy bits are placed at the positions which correspond to the power of 2.
As in the above example:

The number of data bits = 7


The number of redundant bits = 4
The total number of bits = 11
The redundant bits are placed at positions corresponding to power of 2- 1, 2, 4, and 8

Suppose the data to be transmitted is 1011001, the bits will be placed as follows:

Determining the Parity bits –

1. R1 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the least significant position.
R1: bits 1, 3, 5, 7, 9, 11

To find the redundant bit R1, we check for even parity. Since the total number of 1’s in all the bit positions
correspondingtoR1isanevennumberthevalueofR1(parity bit’s value) = 0

2. R2 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1in the second position from the least significant bit.
R2: bits 2,3,6,7,10,11
To find the redundant bit R2, we check for even parity. Since the total number of 1’s in all the bit positions
correspondingtoR2isan odd numberthevalueofR2(parity bit’s value)=1

3. R4 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the third position from the least significant bit.
R4: bits 4, 5, 6, 7

To find the redundant bit R4, we check for even parity. Since the total number of 1’s in all the bit positions
correspondingtoR4isanodd numberthevalueofR4(parity bit’s value) = 1
R8 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the fourth position from the least significant bit.
R8: bit 8,9,10,11

To find the redundant bit R8, we check for even parity. Since the total number of 1’s in all the bit positions
correspondingtoR8isanevennumberthevalueofR8(parity bit’s value)=0.
Thus, the data transferred is:

Error detection and correction –

Suppose in the above example the 6th bit is changed from 0 to 1 during data transmission, then it gives new
parity values in the binary number:

The bits give the binary number as 0110 whose decimal representation is 6. Thus, the
bit 6 contains an error. To correct the error the 6th bit is changed from 1 to 0.

DATA LINK CONTROL LAYER

The data-link layer is divided into two sublayers. Data link control (DLC) and Media
access control (MAC) layer.
Data link control functions include framing and flow and error control.

Framing
• Framing in the data-link layer separates a message from one source to a destination by
adding a sender address and a destination address. The destination address defines where
the packet is to go; the sender address helps the recipient acknowledge the receipt.
• Although the whole message could be packed in one frame, that is not normally done. One
reason is that a frame can be very large, making flow and error control very inefficient.
When a message is carried in one very large frame, even a single-bit error would require the
retransmission of the whole frame. When a message is divided into smaller frames, a single-
bit error affects only that small frame.
• Frames can be of fixed or variable size. In fixed-size framing, there is no need for defining
the boundaries of the frames; the size itself can be used as a delimiter. An example of this
type of framing is the ATM WAN, which uses frames of fixed size called cells.
• In variable-size framing, we need a way to define the end of one frame and the beginning
of the next. Two approaches were used for this purpose: a character- oriented approach and
a bit-oriented approach.
Character-Oriented Framing

Frame in a Character-Oriented Protocol

• In character-oriented (or byte-oriented) framing, data to be carried are 8-bit characters from
a coding system such as ASCII. The header, which normally carries the source and
destination addresses and other control information, and the trailer, which carries error
detection redundant bits, are also multiples of 8 bits. To separate one frame from the next,
an 8-bit (1-byte) flag is added at the beginning and the end of a frame.
• The flag, composed of protocol-dependent special characters, signals the start or end of a
frame.

• Character-oriented framing was popular when only text was exchanged by the data- link
layers. The flag could be selected to be any character not used for text communication.
Now, however, we send other types of information such as graphs, audio, and video; any
character used for the flag could also be part of the information. If this happens, the receiver,
when it encounters this pattern in the middle of the data, thinks it has reached the end of the
frame.
• To fix this problem, a byte-stuffing strategy was added to character-oriented framing. In byte
stuffing (or character stuffing), a special byte is added to the data section of the frame when
there is a character with the same pattern as the flag. The data section is stuffed with an extra
byte. This byte is usually called the escape character (ESC) and has a predefined bit pattern.
• Whenever the receiver encounters the ESC character, it removes it from the data section
and treats the next character as data, not as a delimiting flag.
• Byte stuffing is the process of adding one extra byte whenever there is a flag or escape
character in the text.

Byte Stuffing and Un stuffing


Bit-Oriented Framing
• In bit-oriented framing, the data section of a frame is a sequence of bits to be
interpreted by the upper layer as text, graphic, audio, video, and so on. However, in
addition to headers (and possible trailers), we still need a delimiter to separate one frame
from the other. Most protocols use a special 8-bit pattern flag, 01111110, as the
delimiter to define the beginning and the end of the frame.

A frame in a bit-oriented protocol


• If the flag pattern appears in the data, we need to somehow inform the receiver that this is
not the end of the frame. We do this by stuffing 1 single bit (instead of 1 byte) to prevent
the pattern from looking like a flag. The strategy is called bit stuffing.
• In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra 0 is added. This
extra stuffed bit is eventually removed from the data by the receiver. Note that the extra
bit is added after one 0 followed by five 1s regardless of the value of the next bit.

Bit stuffing and unstuffing

Flow Control

• The figure shows that the data-link layer at the sending node tries to push frames toward
the data-link layer at the receiving node. If the receiving node cannot process and deliver
the packet to its network at the same rate that the frames arrive, it becomes overwhelmed
with frames. Flow control in this case can be feedback from the receiving node to the
sending node to stop or slow down pushing frames.
• Although flow control can be implemented in several ways, one of the solutions is normally
to use two buffers; one at the sending data-link layer and the other at the receiving data-
link layer. A buffer is a set of memory locations that can hold packets at the sender and
receiver. The flow control communication can occur by sending
signals from the consumer to the producer. When the buffer of the receiving data-link layer
is full, it informs the sending data-link layer to stop pushing frames.

Error Control
Error control at the data-link layer is normally very simple and implemented using one of
the following two methods. In both methods, a CRC is added to the frame header by the
sender and checked by the receiver.
❑ In the first method, if the frame is corrupted, it is silently discarded; if it is not corrupted,
the packet is delivered to the network layer. This method is used mostly in wired LANs such
as Ethernet.
❑ In the second method, if the frame is corrupted, it is silently discarded; if it is not
corrupted, an acknowledgment is sent (for the purpose of both flow and error control) to
the sender.

Combination of Flow and Error Control


• Flow and error control can be combined. In a simple situation, the acknowledgment that is
sent for flow control can also be used for error control to tell the sender the packet has
arrived uncorrupted. The lack of acknowledgment means that there is a problem in the sent
frame.
• Traditionally three protocols have been defined for the data-link layer to deal with flow and
error control: Stop-and-Wait, Go-Back-N, and Selective-Repeat.

1. Stop-and-Wait Automatic Repeat Request


Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and
retransmitting of the frame when the timer expires.
Sequence Numbers
• A field is added to the data frame to hold the sequence number of that frame. For example,
if we decide that the field is m bits long, the sequence numbers start from 0, go to 2m - 1, and
then are repeated.
• In Stop-and-Wait ARQ we use sequence numbers to number the frames. The sequence
numbers are based on modul0-2 arithmetic.
Acknowledgment Numbers
• Since the sequence numbers must be suitable for both data frames and ACK frames, we
use this convention: The acknowledgment numbers always announce the sequence number
of the next frame expected by the receiver. For example, if frame 0 has arrived safe and
sound, the receiver sends an ACK frame with acknowledgment 1 (meaning frame 1 is
expected next). If frame 1 has arrived safe and sound, the receiver sends an ACK frame with
acknowledgment 0 (meaning frame 0 is expected).
Flow diagram

In the above flow diagram Frame a is sent and acknowledged. Frame 1 is lost and resent
after the time-out. The resent frame 1 is acknowledged and the timer stops. Frame a is sent
and acknowledged, but the acknowledgment is lost. The sender has no idea if the frame or
the acknowledgment is lost, so after the time-out, it resends frame 0, which is
acknowledged.

2. Go-Back-N Automatic Repeat Request


In this protocol we can send several frames before receiving acknowledgments; we keep
a copy of these frames until the acknowledgments arrive.

Sequence Numbers
Frames from a sending station are numbered sequentially. If the header of the frame allows
m bits for the sequence number, the sequence numbers range from 0 to 2m - 1. For example,
if m is 4, the only sequence numbers are 0 through 15 inclusive. So the sequence numbers
are
0, 1,2,3,4,5,6, 7,8,9, 10, 11, 12, 13, 14, 15,0, 1,2,3,4,5,6,7,8,9,10, 11, ...
In other words, the sequence numbers are modulo-2m
.
Sliding Window
The sender and receiver need to deal with only part of the possible sequence numbers. The
range which is the concern of the sender is called the send sliding window; the range that
is the concern of the receiver is called the receive sliding window.
The send window can slide one or more slots when a valid acknowledgment arrives.

The receive window is an abstract concept defining an imaginary box of size 1 with one
single variable Rn• The window slides when a correct frame has arrived; sliding occurs one
slot at a time.

Acknowledgment
The receiver sends a positive acknowledgment if a frame has arrived safe and sound and in
order. If a frame is damaged or is received out of order, the receiver is silent and will discard
all subsequent frames until it receives the one it is expecting. The silence of the receiver
causes the timer of the unacknowledged frame at the sender site to expire. This, in turn,
causes the sender to go back and resend all frames, beginning with the one with the expired
timer.

Resending a Frame
When the timer expires, the sender resends all outstanding frames. For example, suppose
the sender has already sent frame 6, but the timer for frame 3 expires. This means that frame
3 has not been acknowledged; the sender goes back and sends frames 3, 4,5, and 6 again.
That is why the protocol is called Go-Back-N ARQ.
Flow diagram Frame lost

Acknowledgement lost

3. Selective Repeat Automatic Repeat Request

Go-Back-N ARQ simplifies the process at the receiver site. The receiver keeps track of only
one variable, and there is no need to buffer out-of-order frames; they are simply discarded.
However, this protocol is very inefficient for a noisy link. In a noisy link a
frame has a higher probability of damage, which means the resending of multiple frames.
• This resending uses up the bandwidth and slows down the transmission. For noisy links,
there is another mechanism that does not resend N frames when just one frame is damaged;
only the damaged frame is resent. This mechanism is called Selective RepeatARQ.

Windows
The Selective Repeat Protocol also uses two windows: a send window and a receive
window.
The send window maximum size can be 2 m- I . For example, if m = 4, the sequence numbers
go from 0 to 15, but the size of the window is just 8. The receive window is the same size
as the send window.
Sent window

Receive window

Flow diagram Frame lost


Piggybacking
Protocols have been designed in the past to allow data to flow in both directions.
However, to make the communication more efficient, the data in one direction is
piggybacked with the acknowledgment in the other direction. In other words, when
node A is sending data to node B, Node A also acknowledges the data received from
node B.

You might also like