[go: up one dir, main page]

0% found this document useful (0 votes)
24 views126 pages

Understanding Computer Networks

CN

Uploaded by

gayathri devi
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)
24 views126 pages

Understanding Computer Networks

CN

Uploaded by

gayathri devi
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/ 126

UNIT-1

Computer Networks and the Internet

1. What Is the Internet?


The Internet is a computer network that interconnects hundreds of millions of
computing devices throughout the world.
A Nuts-and-Bolts Description
Computer networking is a collection of computers and other devices that can
exchange data and share resources with each other.
The devices are called hosts or end systems, devices were primarily traditional
desktop PCs, workstations, servers, smart phones, laptops etc.,

Fig: Some pieces of the Internet


 End systems are connected together by a network of communication links and
packet switches.
 there are many types of communication links, which are made up of different
types of physical media, including coaxial cable, copper wire, optical fiber, and radio
spectrum.
 Different links can transmit data at different rates, with the transmission rate of a

1
link measured in bits/second.
 When one end system has data to send to another end system, the sending end
system segments the data and adds header bytes to each segment. The resulting
packages of information, known as packets.
 A packet switch takes a packet arriving on one of its incoming communication
links and forwards that packet on one of its outgoing communication links. The two
most prominent types in today’s Internet are routers and link-layer switches. Both
types of switches forward packets toward their ultimate destinations.
 The sequence of communication links and packet switches traversed by a packet
from the sending end system to the receiving end system is known as a route or
path.
 End systems access the Internet through Internet Service Providers
(ISPs),including residential ISPs such as local cable or telephone companies;
corporate ISPs; university ISPs; and ISPs that provide WiFi access in airports, hotels,
coffee shops, and other public places.
 End systems, packet switches, and other pieces of the Internet run protocols that
control the sending and receiving of information within the Internet. The
Transmission Control Protocol (TCP) and the Internet Protocol (IP) are two of the
most important protocols in the Internet.
 The IP protocol specifies the format of the packets that are sent and received
among routers and end systems. The Internet’s principal protocols are collectively
known as TCP/IP.

A Services Description
 As an infrastructure that provides services to applications. These applications
include electronic mail, Web surfing, social networks, instant messaging, video
streaming, distributed games, peer-to-peer (P2P) file sharing, television over the
Internet, remote login, and much, much more.
 The applications are said to be distributed applications, since they involve
multiple end systems that exchange data with each other. Importantly, Internet
applications run on end systems—they do not run in the packet switches in the
network core.
 End systems attached to the Internet provide an Application Programming
Interface (API) that specifies how a program running on one end system asks the
Internet infrastructure to deliver data to a specific destination program running on
another end system.
 This Internet API is a set of rules that the sending program must follow so that
the Internet can deliver the data to the destination program.

What Is a Protocol?
A protocol defines the format and the order of messages exchanged between two or
more communicating entities, as well as the actions taken on the transmission
and/or receipt of a message or other event.

A Human Analogy and Network Protocols

2
Fig: A human protocol and a computer network protocol

Human protocol Computer Network Protocols


 Entities exchanging messages  Machines rather than humans.
 There are specific messages we  All communication activity in
send, and specific actions we take in internet governed by protocols.
response to the received reply
messages or other event.
Protocols in routers determine a packet’s path from source to destination.
Protocols are running everywhere in the Internet. The Internet and computer network
make extensive use of protocols. Different protocols are used to accomplish
different communication tasks.

2. The Network Edge


 The network edge refers to the area where a device or local network interfaces
with the internet. The edge is close to the devices it is communicating with and is the
entry point to the network.
 The network edge refers to endpoints. It is the first step between endpoints and
the core of the network.
 The internet end systems include desktop computers, servers (web and email
servers) and mobile computers (laptops, smart phones, tablets).

3
Fig: Access Networks

 End systems are also referred to as hosts because they run application programs
such as a Web browser program, a Web server program, an e-mail client program, or
an e-mail server program.
 Hosts are sometimes further divided into two categories: clients and servers.

Access Networks
The network that physically connects an end system to the first router (also known
as the “edge router”) on a path from the end system to any other distant end system.

Home Access: DSL, Cable, FTTH, Dial-Up, and Satellite

i) DSL (digital subscriber line): Today, the two most prevalent types of broadband
residential access are digital subscriber line (DSL) and cable.
 DSL is a wire line transmission technology that transmits data faster.
 A residence typically obtains DSL Internet access from the same local telephone
company (telco) that provides its wired local phone access. When DSL is used, a
customer’s telco is also its ISP.

Fig: DSL Internet access

4
 As shown in Figure, each customer’s DSL modem uses the existing telephone
line to exchange data with a digital subscriber line access multiplexer (DSLAM)
located in the telco’s local central office (CO).
 The home’s DSL modem takes digital data and translates it to high frequency
tones for transmission over telephone wires to the CO; the analog signals from many
such houses are translated back into digital format at the DSLAM.
 The residential telephone line carries both data and traditional telephone signals
simultaneously.
 On the customer side, a splitter separates the data and telephone signals arriving
to the home and forwards the data signal to the DSL modem.
 On the telco side, in the CO, the DSLAM separates the data and phone signals
and sends the data into the Internet. Hundreds or even thousands of households
connect to a single DSLAM.

ii) Cable: While DSL makes use of the telco’s existing local telephone infrastructure,
cable Internet access makes use of the cable television company’s existing cable
television infrastructure.
A residence obtains cable Internet access from the same company that provides its
cable television.

Fig: A hybrid fiber-coaxial access network

 As shows in Figure, fiber optics connects the cable head end to neighborhood-
level junctions, from which traditional coaxial cable is then used to reach individual
houses and apartments.
 Because both fiber and coaxial cable are employed in this system, it is often
referred to as hybrid fiber coax (HFC).
 Cable internet access requires special modems, called cable modems. The cable
modem is typically an external device and connects to the home PC through an
Ethernet port.
 At the cable head end, the cable modem termination system (CMTS) serves a
similar function as the DSL network’s DSLAM—turning the analog signal sent from
the cable modems in many downstream homes back into digital format.
 Cable modems divide the HFC network into two channels, a downstream and an
upstream channel.
 One important characteristic of cable Internet access is that it is a shared
broadcast medium. In particular, every packet sent by the head end travels
downstream on every link to every home and every packet sent by a home travels on
the upstream channel to the head end.

iii) FTTH (Fiber To The Home): FTTH includes fiber-optic access solutions designed
for residential deployments. In FTTH networks, fibers are directly connected to
individual homes or buildings.
5
 The FTTH can provide an optical fiber path from the CO directly to the home.
 There are two competing optical-distribution network architectures that perform
this splitting: active optical networks (AONs) and passive optical networks (PONs).

Fig: FTTH Internet access

 Figure shows FTTH using the PON distribution architecture. Each home has an
optical network terminator (ONT), which is connected by dedicated optical fiber to a
neighborhood splitter.
 The splitter combines a number of homes (typically less than 100) onto a single,
shared optical fiber, which connects to an optical line terminator (OLT) in the telco’s
CO.
 The OLT, providing conversion between optical and electrical signals, connects to
the Internet via a telco router.
 In the home, users connect a home router (typically a wireless router) to the ONT
and access the Internet via this home router.
 In the PON architecture, all packets sent from OLT to the splitter are replicated at
the splitter (similar to a cable head end).
 FTTH can potentially provide Internet access rates in the gigabits per second
range.

iv) Dial-Up, and Satellite: Dial-up access over traditional phone lines is based on the
same model as DSL—a home modem connects over a phone line to a modem in the
ISP. Compared with DSL and other broadband access networks, dial-up access is
excruciatingly slow at 56 kbps.

Satellite link can be used to connect a residence to the Internet at speeds of more
than 1 Mbps; StarBand and HughesNet are two such satellite access providers.

v) Access in the Enterprise (and the Home): Ethernet and WiFi


Ethernet: On corporate and university campuses a local area network (LAN) is used to
connect an end system to the edge router.
 There are many types of LAN technologies; Ethernet is the most prevalent access
technology in corporate, university, and home networks.
 As shown in Figure, Ethernet users use twisted-pair copper wire to connect to an
Ethernet switch.
 With Ethernet access, users typically have 100 Mbps access to the Ethernet
switch, whereas servers may have 1 Gbps or even 10 Gbps access.

6
Fig: Ethernet Internet access

WiFi: Increasingly, however, people are accessing the Internet wirelessly from
laptops, smart phones, tablets, and other devices.
 In a wireless LAN setting, wireless users transmit/receive packets to/from an
access point that is connected into the enterprise’s network (most likely including
wired Ethernet), which in turn is connected to the wired Internet.
 A wireless LAN user must typically be within a few tens of meters of the access
point.
 Wireless LAN access based on IEEE 802.11 technology, more colloquially known
as WiFi, is now just about everywhere—universities, business offices, cafes, airports,
homes, and even in airplanes.
 802.11 today provides a shared transmission rate of up to 54 Mbps.

3. The Network Core


The network core—the mesh of packet switches and links that interconnects the
Internet’s end systems. Figure highlights the network core with thick, shaded lines.

Figure: The network core


 The network edge refers to endpoints. The network core refers to the
components that provide services to those at the edge.
 Routing and forwarding are the two key network core functions.
7
There are two fundamental approaches to moving data through a network of links
and switches: circuit switching and packet switching.
Packet Switching
 In a network application, end systems exchange messages with each other.
Messages can contain anything the application designer wants.
 Messages may perform a control function or can contain data, such as an email
message, a JPEG image, or an MP3audio file.
 To send a message from a source end system to a destination end system, the
source breaks long messages into smaller chunks of data known as packets.
 Between source and destination, each packet travels through communication
links and packet switches (for which there are two types, routers and linklayer
switches).
 Packets are transmitted over each communication link at a rate equal to the full
transmission rate of the link.
 If a source end system or a packet switch is sending a packet of L bits over a link
with transmission rate R bits/sec, then the time to transmit the packet is L/R
seconds.

Store-and-Forward Transmission: Most packet switches use store-and-forward


transmission at the inputs to the links.
 Store-and-forward transmission means that the packet switch must receive the
entire packet before it can begin to transmit the first bit of the packet onto the
outbound link.
 To explore store-and-forward transmission in more detail, consider a simple
network consisting of two end systems connected by a single router, as shown in
Figure.

Fig: Store-and-forward packet switching

 A router will typically have many incident links, since its job is to switch an
incoming packet onto an outgoing link.
 In this example, the source has three packets, each consisting of L bits, to send
to the destination.
 The source has transmitted some of packet 1, and the front of packet 1has
already arrived at the router. Because the router employs store-and-forwarding, at
this instant of time, the router cannot transmit the bits it has received; instead it
must first buffer (i.e., “store”) the packet’s bits.
 Only after the router has received all of the packet’s bits can it begin to transmit
(i.e., “forward”) the packet onto the outbound link.

Let’s now consider the general case of sending one packet from source to
destination over a path consisting of N links each of rate R. Applying the same logic
as above, we see that the end-to-end delay is:

8
Queuing Delays and Packet Loss: Each packet switch has multiple links attached
to it. For each attached link, the packet switch has an output buffer (also called an
output queue), which stores packets that the router is about to send into that link.
 The output buffers play a key role in packet switching. If an arriving packet needs
to be transmitted onto a link but finds the link busy with the transmission of another
packet, the arriving packet must wait in the output buffer.
 Thus, in addition to the store-and-forward delays, packets suffer output buffer
queuing delays. These delays are variable and depend on the level of congestion in
the network.
 The amount of buffer space is finite, an arriving packet may find that the buffer is
completely full with other packets waiting for transmission. In this case, packet loss
will occur—either the arriving packet or one of the already-queued packets will be
dropped.

Figure illustrates a simple packet-switched network.

Fig: Packet switching

Forwarding Tables and Routing Protocols: In the Internet, every end system has
an address called an IP address. When a source end system wants to send a packet
to a destination end system, the source includes the destination’s IP address in the
packet’s header.
 When a packet arrives at a router in the network, the router examines a portion of
the packet’s destination address and forwards the packet to an adjacent router.
 More specifically, each router has a forwarding table that maps destination
addresses (or portions of the destination addresses) to that router’s outbound links.
 When a packet arrives at a router, the router examines the address and searches
its forwarding table, using this destination address, to find the appropriate outbound
link. The router then directs the packet to this outbound link.
 The Internet has a number of special routing protocols that are used to
automatically set the forwarding tables. A routing protocol may, for example,
determine the shortest path from each router to each destination and use the
shortest path results to configure the forwarding tables in the routers.

Circuit Switching
 In circuit-switched networks, the resources needed along a path (buffers, link
transmission rate) to provide for communication between the end systems are
reserved for the duration of the communication session between the end systems.
 In packet-switched networks, these resources are not reserved; a session’s
messages use the resources on demand, and as a consequence, may have to wait
(that is, queue) for access to a communication link.
 Traditional telephone networks are examples of circuit-switched networks.
 A circuit-switched network is made of a set of switches connected by physical
9
links, in which each link is divided into n channels.
 Each link is divided into n (n is 3 in the figure) channels by using FDM or TDM.

Three phases: A circuit-switched network consists of 3 phases: 1) Setup


phase (establish),2) Data transfer phase (transfer), 3) Tear down phase (disconnect).
 Setup Phase: Before the two parties can communicate, a dedicated circuit needs
to be established. The end systems are normally connected through dedicated lines
to the switches, so connection setup means creating dedicated channels between
the switches.
 Data-Transfer Phase: After the establishment of the dedicated circuit (channels),
the two parties can transfer data.
 Teardown Phase: When one of the parties needs to disconnect, a signal is sent to
each switch to release the resources.

Figure illustrates a circuit-switched network. In this network, the four circuit switches
are interconnected by four links. Each of these links has four circuits, so that each
link can support four simultaneous connections.
 The hosts are each directly connected to one of the switches. When two hosts
want to communicate, the network establishes a dedicated end-to-end connection
between the two hosts.

Fig: A simple circuit-switched network consisting of four switches and four links

For example: When end system A needs to communicate with end system B, system
A needs to request a connection to B that must be accepted by all switches as well
as by B itself. This is called the setup phase; after the dedicated path made of
connected circuits (channels) is established, the data-transfer phase can take place.
After all data have been transferred, the circuits are tearing down.
In circuit switching, the resources need to be reserved during the setup phase; the
resources remain dedicated for the entire duration of data transfer until the
teardown phase.

Multiplexing in Circuit-Switched Networks: A circuit in a link is implemented with


either frequency-division multiplexing (FDM) or time-division multiplexing (TDM).

With FDM, the frequency spectrum of a link is divided up among the connections
established across the link.
 The link dedicates a frequency band to each connection for the duration of the
connection. The width of the band is called, not surprisingly, the bandwidth.
 FM radio stations also use FDM to share the frequency spectrum between 88
MHz and 108 MHz, with each station being allocated a specific frequency band.

For a TDM link, time is divided into frames of fixed duration, and each frame is
divided into a fixed number of time slots. When the network establishes a
10
connection across a link, the network dedicates one time slot in every frame to this
connection.

Figure shows FDM and TDM for a specific network link supporting up to four circuits.
For FDM, the frequency domain is segmented into four bands, each of bandwidth 4
kHz. For TDM, the time domain is segmented into frames, with four time slots in
each frame

Fig: FDM & TDM

4. Delay, Loss, and Throughput in Packet-Switched Networks


Overview of Delay in Packet-Switched Networks
A packet starts in a host (the source), passes through a series of routers, and ends
its journey in another host (the destination). As a packet travels from one node (host
or router) to the subsequent node (host or router) along this path, the packet suffers
from several types of delays at each node along the path.
The most important of these delays are the nodal processing delay, queuing delay,
transmission delay, and propagation delay; together, these delays accumulate to
give a total nodal delay.

Fig: The nodal delay at router A

Types of Delay: The end-to-end route between source and destination, a packet is
sent from the upstream node through router A to router B. Our goal is to characterize
the nodal delay at router A.

i) Processing Delay: The time required to examine the packet’s header and
determine where to direct the packet is part of the processing delay.
 The processing delay can also include other factors, such as the time needed to
check for bit-level errors in the packet that occurred in transmitting the packet’s bits
from the upstream node to router A.
 Processing delays in high-speed routers are typically on the order of
microseconds or less. After this nodal processing, the router directs the packet to
the queue that precedes the link to router B.

11
ii) Queuing Delay: At the queue, the packet experiences a queuing delay as it waits
to be transmitted onto the link.
 The length of the queuing delay of a specific packet will depend on the number of
earlier-arriving packets that are queued and waiting for transmission onto the link.
 If the queue is empty and no other packet is currently being transmitted, then our
packet’s queuing delay will be zero.
On the other hand, if the traffic is heavy and many other packets are also waiting to
be transmitted, the queuing delay will be long.
 Queuing delays can be on the order of microseconds to milliseconds in practice.

iii) Transmission Delay: This is the amount of time required to push (that is, transmit)
all of the packet’s bits into the link.
 Denote the length of the packet by L bits, and denote the transmission rate of the
link from router A to router B by R bits/sec.
 For example, for a 10 Mbps Ethernet link, the rate is R = 10 Mbps; for a 100 Mbps
Ethernet link, the rate is R = 100 Mbps.
 The transmission delay is L/R. Transmission delays are typically on the order of
microseconds to milliseconds in practice.

iv) Propagation Delay: Once a bit is pushed into the link, it needs to propagate to
router B. The time required to propagate from the beginning of the link to router B is
the propagation delay.
 The bit propagates at the propagation speed of the link. The propagation speed
depends on the physical medium of the link (that is, fiber optics, twisted-pair copper
wire, and so on)
 The propagation delay is the distance between two routers divided by the
propagation speed. That is, the propagation delay is d/s, where d is the distance
between router A and router B and s is the propagation speed of the link.
Propagation delays are on the order of milliseconds.

The total nodal delay is given by


dnodal = dproc + dqueue + dtrans + dprop

Queuing Delay and Packet Loss


The queuing delay can vary from packet to packet. For example, if 10 packets arrive
at an empty queue at the same time, the first packet transmitted will suffer no
queuing delay, while the last packet transmitted will suffer a relatively large queuing
delay (while it waits for the other nine packets to be transmitted).
On the other hand, if the traffic is heavy and many other packets are also waiting to
be transmitted, the queuing delay will be long.

The ratio of the traffic intensity is La/R


Let a denote the average rate at which packets arrive to the queue (a is units of
packets/sec), R is the transmission rate, i.e., it is the rate (in bits/sec) and L is
average packet length (in bits).

Fig: Dependence of average queuing delay on traffic intensity

12
The fact that as the traffic intensity approaches 1, the average queuing delay
increases rapidly. A small percentage increase in the intensity will result in a much
larger percentage-wise increase in delay.
Packet Loss: we have assumed that the queue is capable of holding an infinite
number of packets. In reality a queue preceding a link has finite capacity, although
the queuing capacity greatly depends on the router design and cost. Because the
queue capacity is finite, packet delays do not really approach infinity as the traffic
intensity approaches 1. Instead, a packet can arrive to find a full queue.
With no place to store such a packet, a router will drop that packet; that is, the
packet will be lost.

End-to-End Delay: nodal delay is the delay at a single router. Let’s now consider
the total delay from source to destination. To get a handle on this concept, suppose
there are N-1 routers between the source host and the destination host.
The nodal delays accumulate and give an end-to-end delay,

Throughput in Computer Networks


In data transmission, network throughput is the amount of data moved successfully
from one place to another in a given time period, and typically measured in bits per
second (bps), as in megabits per second (Mbps) or gigabits per second (Gbps).
Network throughput refers to how much data can be transferred from source to
destination within a given timeframe.
To define throughput, consider transferring a large file from Host A to Host B across
a computer network.
The instantaneous throughput at any instant of time is the rate (in bits/sec) at which
Host B is receiving the file.
If the file consists of F bits and the transfer takes T seconds for Host B to receive all
F bits, then the average throughput of the file transfer is F/T bits/sec.

Example: Figure (a) shows two end systems, a server and a client, connected by two
communication links and a router. Consider the throughput for a file transfer from
the server to the client.
Let Rs denote the rate of the link between the server and the router; and Rc denote
the rate of the link between the router and the client.
For this simple two-link network, the throughput is min{Rc, Rs}, that is, it is the
transmission rate of the bottleneck link. Having determined the throughput, we can
now approximate the time it takes to transfer a large file of F bits from server to
client as F/min{Rs, Rc}.

Fig: Throughput for a file transfer from server to client


13
Figure (b) now shows a network with N links between the server and the client, with
the transmission rates of the N links being R1, R2,..., RN. Applying the same analysis
as for the two-link network, we find that the throughput for a file transfer from server
to client is min{R1, R2,..., RN},

5. Reference Models
Layered Architecture or Protocol Layering
A layered architecture allows us to discuss a well-defined, specific part of a large and
complex system. In layered architecture of network model, one whole network
process is divided into small tasks. Each small task is then assigned to a particular
layer which works dedicatedly to process the task only. Every layer does only specific
work.
The layer provides the same service to the layer above it, and uses the same services
from the below it.

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.

Fig: A single-layer protocol

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 by using protocol layering.

14
Fig: multiple protocols layering

Two models have been devised to define computer network operations: the TCP/IP
protocol suite and the OSI model. The protocol layering is used in both models.

Reference Models
i) OSI model
The OSI model is based on a proposal developed by the International Standards
Organization (ISO). The model is called the ISO OSI (Open Systems Interconnection),
which allows different systems to communicate.
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 a layered framework for the design of network systems that allows
communication between all types of computer systems.

It consists of seven layers: 1. Physical Layer, 2. Data link Layer, 3. Network Layer,
4.transport Layer, 5. Session Layer, 6. Presentation layer, 7. Application Layer.

15
Fig: The interaction between layers in the OSI model
i) Physical layer: the physical layer is responsible for movement of individual bits
from one node to the next.
 The physical layer required to carry a bit stream over a physical medium.
 It deals with the mechanical and electrical specifications of the interface and
transmission medium.

Responsibilities of physical layer:


Physical characteristics of interfaces and medium: The physical layer defines the
characteristics of the interface between the devices and the transmission medium. It
also defines the type of transmission medium.
Physical topology: The physical topology defines how devices are connected to
make a network.
Transmission mode: The physical layer also defines the direction of transmission
between two devices: simplex, half-duplex, or full-duplex.

ii) Data Link Layer: The data link layer is responsible for moving frames from one
node to the next.
Frame: Frame is a series of bits that form a unit of data.

Responsibilities of the data link layer:


Framing: The data link layer divides the stream of bits received from the network
layer into manageable data units called frames.
Physical addressing: The physical address, also known as the link address, is the
address of a node as defined by its LAN or WAN. It is included in the frame used by
the data link layer. It is the lowest-level address.
Flow control: If the rate at which the data are absorbed by the receiver is less than
the rate at which data are produced in the sender, the data link layer imposes a flow
control mechanism to avoid overwhelming the receiver.
Error control: The data link layer adding a mechanisms to detect and retransmit
damaged or lost frames. It also uses a mechanism to recognize duplicate frames.
Access control: When two or more devices are connected to the same link, data link
layer protocols are necessary to determine which device has control over the link at
any given time.

iii) Network Layer: The network layer is responsible for the source-to-destination
delivery of a packet, possibly across multiple networks (links).
The network layer is responsible for the delivery of individual packets from the
source host to the destination host.
Responsibilities of the network layer
Logical addressing: Addressing system to help to differentiate the source and
destination systems. The network layer adds a header to the packet coming from the
upper layer that includes the logical addresses of the sender and receiver.
Routing: When independent networks or links are connected to create internetworks
(network of networks) or a large network, the connecting devices (called routers or
switches) route or switch the packets to their final destination.

iv) Transport Layer: The transport layer is responsible for process-to-process


delivery of the entire message. A process is an application program running on a
host.
Responsibilities of the transport layer:
Service-point addressing: Source-to-destination delivery means delivery not only
from one computer to the next but also from a specific process (running program)
on one computer to a specific process (running program) on the other. The transport
layer header includes a type of address called a service-point address (or port
16
address).
Segmentation and reassembly: A message is divided into transmittable segments,
with each segment containing a sequence number. These numbers enable the
transport layer to reassemble the message correctly upon arriving at the destination.
Connection control: The transport layer can be either connectionless or connection
oriented. A connectionless transport layer treats each segment as an independent
packet and delivers it to the transport layer at the destination machine. A connection
oriented transport layer makes a connection with the transport layer at the
destination machine first before delivering the packets. After all the data are
transferred, the connection is terminated.

Fig: process-to-process delivery of a message

v) Session Layer: The session layer is responsible for dialog control and
synchronization. The session layer is the network dialog controller. It establishes,
maintains, and synchronizes the interaction among communicating systems
Responsibilities of the session layer:
Dialog control: The session layer allows two systems to enter into a dialog. It allows
the communication between two processes to take place in either half-duplex (one
way at a time) or full-duplex (two ways at a time) mode.
Synchronization: The session layer allows a process to add checkpoints, or
synchronization points, to a stream of data.
For example, if a system is sending a file of 2000 pages, it is advisable to insert
checkpoints after every 100 pages to ensure that each 100-page unit is received and
acknowledged independently. In this case, if a crash happens during the
transmission of page 523, the only pages that need to be resent after system
recovery are pages 501 to 523. Pages previous to 501 need not be resent.

vi) Presentation Layer: The presentation layer is responsible for translation,


compression, and encryption. The presentation layer is concerned with the syntax
and semantics of the information exchanged between two systems.
Responsibilities of the presentation layer:
Translation: The presentation layer at the sender machine changes the information
from its sender-dependent format into a common format. The presentation layer at
the receiving machine changes the common format into its receiver-dependent
format.
Encryption: To carry sensitive information, a system must be able to ensure privacy.
Encryption means that the sender transforms the original information to another
form and sends the resulting message out over the network. Decryption reverses the
original process to transform the message back to its original form.
Compression: Data compression reduces the number of bits contained in the
information. Data compression becomes particularly important in the transmission
of multimedia such as text, audio, and video.

vii) Application Layer: The application layer is responsible for providing services to
17
the user.
The application layer enables the user, whether human or software, to access the
network. It provides user interfaces and support for services such as electronic mail,
remote file access and transfer, shared database management, and other types of
distributed information services.
Services provided by the application layer:
Network virtual terminal: A network virtual terminal is a software version of a
physical terminal, and it allows a user to log on to a remote host.
File transfer, access, and management: This application allows a user to access
files in a remote host (to make changes or read data), to retrieve files from a remote
computer for use in the local computer, and to manage or control files in a remote
computer locally.
Mail services: This application provides the basis for e-mail forwarding and storage.
Directory services: This application provides distributed database sources and
access for global information about various objects and services.

ii) TCP/IP Protocol Suite


The TCPIIP protocol suite was developed prior to the OSI model. The original TCP/IP
protocol suite was defined as having four layers: Host-To-Network (Network
Interface), Internet, Transport, and Application.
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.

Fig: Layers in the TCP/IP protocol suite

 Physical Layer: We can say that the physical layer is responsible for carrying
individual bits in a frame across the link. The physical layer is the lowest level in the
TCP/IP protocol suite. There is a hidden layer, the transmission media, under the
physical layer. Two devices are connected by a transmission medium (cable or
air).The transmission medium does not carry bits; it carries electrical or optical
signals.

 Data-link Layer: 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. We can also have different protocols
used with any link type.
TCP/IP does not define any specific protocol for the data-link layer, but it uses the
HDLC and PPP protocols. It supports all the standard and proprietary protocols.

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

18
In network layer the main protocol is Internet Protocol (IP), which 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.
The network layer also has some auxiliary protocols that help IP in its delivery and
routing tasks. 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. The Dynamic Host
Configuration Protocol (DHCP) helps IP to get the network-layer address for a host.
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: 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.
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.
The other common protocol, User Datagram Protocol (UDP), is a connectionless
protocol that transmits user datagram 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.

 Application Layer: The logical connection between the two application layers is
end to-end. The two application layers exchange messages between each other as
though there were a bridge between the two layers.
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. The Simple Network
Management Protocol (SNMP) is used by an administrator to manage the Internet at
global and local levels. The Domain Name System (DNS) is used by other protocols
to find the network-layer address of a computer.

6. Transmission Media
Introduction: Transmission media are actually located below the physical layer and
are directly controlled by the physical layer. We could say that transmission media
belong to layer zero. Figure shows the position of transmission media in relation to
the physical layer.

Fig: Transmission medium and physical layer

A transmission medium can be broadly defined as anything that can carry


information from a source to a destination. It is also called physical medium.
The transmission medium is usually free space, metallic cable, or fiber-optic cable.
The information is usually a signal that is the result of a conversion of data from
another form.

Transmission media can be divided into two broad categories: guided and unguided.
19
Guided media include twisted-pair cable, coaxial cable, and fiber-optic cable.
Unguided medium is free space.

Fig: Classes of transmission media

i) Guided Media: Wired


Guided media, which are those that provide a channel from one device to another,
include twisted-pair cable, coaxial cable, and fiber-optic cable. A signal traveling
along any of these media is directed and contained by the physical limits of the
medium.
Twisted-pair and coaxial cable use metallic (copper) conductors that accept and
transport signals in the form of electric current. Optical fiber is a cable that accepts
and transports signals in the form of light.

Twisted-Pair Cable: A twisted pair consists of two conductors (normally


copper), each with its own plastic insulation, twisted together, as shown in Figure

Fig: Twisted-pair cable

One of the wires is used to carry signals to the receiver, and the other is used only as
a ground reference. The receiver uses the difference between the two. In addition to
the signal sent by the sender on one of the wires, interference (noise) and crosstalk
may affect both wires and create unwanted signals.
Unshielded Versus Shielded Twisted-Pair Cable: The most common twisted-pair
cable used in communications is referred to as unshielded twisted-pair (UTP).
IBM has also produced a version of twisted-pair cable for its use, called shielded
twisted-pair (STP). STP cable has a metal foil or braided mesh covering that encases
each pair of insulated conductors. Although metal casing improves the quality of
cable by preventing the penetration of noise or crosstalk, it is bulkier and more
expensive.

Fig: UTP and STP cables

Performance: One way to measure the performance of twisted-pair cable is to


compare attenuation versus frequency and distance. A twisted-pair cable can pass a
wide range of frequencies.

20
Applications: Twisted-pair cables are used in telephone lines to provide voice and
data channels.
 Local-area networks also use twisted-pair cables.

Coaxial Cable: Coaxial cable (or coax) carries signals of higher frequency
ranges than those in twisted pair cable, in part because the two media are
constructed quite differently. Instead of having two wires, coax has a central core
conductor of solid or stranded wire (usually copper) enclosed in an insulating sheath,
which is, in turn, encased in an outer conductor of metal foil, braid, or a combination
of the two.
The outer metallic wrapping serves both as a shield against noise and as the second
conductor, which completes the circuit. This outer conductor is also enclosed in an
insulating sheath, and the whole cable is protected by a plastic cover.

Fig: Coaxial cable

Performance we measure the performance of a coaxial cable. The attenuation is


much higher in coaxial cable than in twisted-pair cable. In other words, although
coaxial cable has a much higher bandwidth, the signal weakens rapidly and requires
the frequent use of repeaters.

Applications Coaxial cable was widely used in analog telephone networks where a
single coaxial network could carry 10,000 voice signals.
 Later it was used in digital telephone networks where a single coaxial cable could
carry digital data up to 600 Mbps.
 However, coaxial cable in telephone networks has largely been replaced today
with fiber optic cable.
 Cable TV networks also use coaxial cables. Later, however, cable TV providers
replaced most of the media with fiber-optic cable.
 Another common application of coaxial cable is in traditional Ethernet LANs.
Because of its high bandwidth, and consequently high data rate, coaxial cable was
chosen for digital transmission in early Ethernet LANs.

Fiber-Optic Cable: A fiber-optic cable is made of glass or plastic and transmits


signals in the form of light.
Light travels in a straight line as long as it is moving through a single uniform
substance. If a ray of light traveling through one substance suddenly enters another
substance (density), the ray changes direction.
 Figure shows how a ray of light changes direction when going from a more dense
to a less dense substance. As the figure shows, if the angle of incidence I is less
than the critical angle, the ray refracts and moves closer to the surface.
 If the angle of incidence is equal to the critical angle, the light bends along the
interface.
 If the angle is greater than the critical angle, the ray reflects (makes a turn) and
travels again in the denser substance.

21
Fig: Bending of light ray

Optical fibers use reflection to guide light through a channel. A glass or plastic core
is surrounded by a cladding of less dense glass or plastic. The difference in density
of the two materials must be such that a beam of light moving through the core is
reflected off the cladding instead of being refracted into it.

Fig: Optical fiber

Cable Composition: Figure shows the composition of a typical fiber-optic cable. The
outer jacket is made of Teflon. Inside the jacket are Kevlar strands to strengthen the
cable. Below the Kevlar is another plastic coating to cushion the fiber. The fiber is at
the center of the cable, and it consists of cladding and core.

Fig: Fiber construction


Performance: Attenuation is flatter than in the case of twisted-pair cable and coaxial
cable. The performance is such that we need fewer repeaters when we use fiber-
optic cable.

Advantages and Disadvantages of Optical Fiber:


Advantages: Fiber-optic cable has several advantages over metallic cable (twisted-
pair or coaxial).
 Higher bandwidth.
 Less signal attenuation..
 Immunity to electromagnetic interference.
 Resistance to corrosive materials.
 Light weight.
.
Disadvantages There are some disadvantages in the use of optical fiber.
 Installation and maintenance.
 Unidirectional light propagation.
 Cost.

ii) Unguided Media: Wireless


22
Unguided medium transport electromagnetic waves without using a physical
conductor. This type of communication is often referred to as wireless
communication. Signals are normally broadcast through free space and thus are
available to anyone who has a device capable of receiving them.
Figure shows the part of the electromagnetic spectrum, ranging from 3 kHz to 900
THz, used for wireless communication.

Fig: Electromagnetic spectrum for wireless communication

Unguided signals can travel from the source to the destination in several ways:
ground propagation, sky propagation, and line-of-sight propagation, as shown in
Figure 7.18.

Fig: Propagation methods

In ground propagation, radio waves travel through the lowest portion of the
atmosphere, hugging the earth. These low-frequency signals emanate in all
directions from the transmitting antenna and follow the curvature of the planet.
In sky propagation, higher-frequency radio waves radiate upward into the ionosphere
(the layer of atmosphere where particles exist as ions) where they are reflected back
to earth. This type of transmission allows for greater distances with lower output
power.
In line-of-sight propagation, very high-frequency signals are transmitted in straight
lines directly from antenna to antenna.
Radio Waves: The electromagnetic waves ranging in frequencies between 3
kHz and 1 GHz are normally called radio waves.
 Radio waves are omnidirectional. When an antenna transmits radio waves, they
are propagated in all directions. A sending antenna sends waves that can be
received by any receiving antenna.
 Radio waves, particularly those waves that propagate in the sky mode, can travel
long distances. This makes radio waves a good candidate for long-distance
broadcasting such as AM radio.
 Radio waves, particularly those of low and medium frequencies, can penetrate
walls. It is an advantage because, for example, an AM radio can receive signals
inside a building.

Omnidirectional Antenna Radio waves use omnidirectional antennas that send out
signals in all directions. Figure shows an omnidirectional antenna.

23
Fig: Omnidirectional antenna

Applications The omnidirectional characteristics of radio waves make them useful


for multicasting, in which there is one sender but many receivers.
AM and FM radio, television, cordlessphones, and paging are examples of
multicasting.

Microwaves Electromagnetic waves having frequencies between 1 and 300


GHz are called microwaves. Microwaves are unidirectional. This means that the
sending and receiving antennas need to be aligned.
The following describes some characteristics of microwave propagation:
 Microwave propagation is line-of-sight. Since the towers with the mounted
antennas need to be in direct sight of each other, towers that are far apart
need to be very tall.
 Very high-frequency microwaves cannot penetrate walls. This characteristic
can be a disadvantage if receivers are inside buildings.

Unidirectional Antenna Microwaves need unidirectional antennas that send out


signals in one direction. Two types of antennas are used for microwave
communications: the parabolic dish and the horn.

Fig: Unidirectional antennas

Applications: Microwaves, due to their unidirectional properties, are very useful when
unicast (oneto-one) communication is needed between the sender and the receiver.
They are used in cellular phones, satellite networks, and wireless LANs.
Infrared: Infrared waves, with frequencies from 300 GHz to 400 THz. It can be
used for short-range communication. Infrared waves, having high frequencies,
cannot penetrate walls.
This advantageous characteristic prevents interference between one system and
another; a short-range communication system in one room cannot be affected by
another system in the next room. When we use our infrared remote control, we do
not interfere with the use of the remote by our neighbors.
Infrared signals can be used for short-range communication in a closed area using
line-of-sight propagation

7. Example Networks
i) Internet
24
A Brief History: A network is a group of connected communicating devices such
as computers and printers. The Internet collaboration of more than hundreds of
thousands of interconnected networks.
Private individuals as well as various organizations such as government agencies,
schools, research facilities, corporations, and libraries in more than 100 countries
use the Internet. Millions of people are users. The extraordinary communication
system only came into being in 1969.

In the mid-1960s, Computers from different manufacturers were unable to


communicate with one another. The Advanced Research Projects Agency (ARPA) in
the Department of Defense (DoD) was interested in finding a way to connect
computers.

In 1967, at an Association for Computing Machinery (ACM) meeting, ARPA


presented its ideas for ARPANET, a small network of connected computers. The idea
was that each host computer would be attached to a specialized computer, called an
interface message processor (IMP).

By 1969, ARPANET was a reality. Four nodes, at the Universities were connected via
the IMPs to form a network. Software called the Network Control Protocol (NCP)
provided communication between the hosts.

In 1972, Vint Cerf and Bob Kahn, both of whom were part of the core ARPANET
group, collaborated on what they called the Internetting Project.

Cerf and Kahn's landmark 1973 paper outlined the protocols to achieve end-to-end
delivery of packets. This paper on Transmission Control Protocol (TCP) included
concepts such as encapsulation, the datagram, and the functions of a gateway.
After that split TCP into two protocols: Transmission Control Protocol (TCP) and
Internetworking Protocol (lP).

The Internet Today: Today most end users who want Internet connection use the
services of Internet service providers (lSPs). There are international service providers,
national service providers, regional service providers, and local service providers.

Fig: Structure of a national ISP

Fig: Interconnection of national ISPs

ii) Third-Generation Mobile Phone Networks


25
People love to talk on the phone even more than they like to surf the Internet, and
this has made the mobile phone network the most successful network in the world.
It has more than four billion subscribers worldwide.
First-generation mobile phone systems transmitted voice calls as continuously
varying (analog) signals rather than sequences of (digital) bits. AMPS (Advanced
Mobile Phone System), which was deployed in the United States in 1982, was a
widely used first generation system.
Second-generation mobile phone systems switched to transmitting voice calls in
digital form to increase capacity, improve security, and offer text messaging. GSM
(Global System for Mobile communications), which was deployed starting in 1991
and has become the most widely used mobile phone system in the world, is a 2G
system.
The third generation, or 3G, systems were initially deployed in 2001 and offer both
digital voice and broadband digital data services. UMTS (Universal Mobile
Telecommunications System), also called WCDMA (Wideband Code Division
Multiple Access), is the main 3G system that is being rapidly deployed worldwide.

iii) Wireless LANs: 802.11


The wireless LAN standard was dubbed 802.11. A common slang name for it is WiFi
but it is an important standard and deserves respect, so we will call it by its proper
name, 802.11.

802.11 networks are made up of clients, such as laptops and mobile phones, and
infrastructure called APs (access points) that is installed in buildings. Access points
are sometimes called base stations. The access points connect to the wired
network, and all communication between clients goes through an access point.

Fig: Wireless network with an access point

26
UNIT-2
The Data Link Layer, Access Networks, and LANs

1. Data Link Layer Design Issues


The data link layer uses the services of the physical layer to send and receive bits
over communication channels. It has a number of functions, including:
1. Providing a well-defined service interface to the network layer.
2. Dealing with transmission errors.
3. Regulating the flow of data so that slow receivers are not swamped by fast
senders.
The data link layer takes the packets it gets from the network layer and encapsulates
them into frames for transmission.
Each frame contains three parts: frame header, payload field for holding packets,
and frame trailer.

Fig: Frame

Header:The header consists of control information whose role is to guide the whole
frame to its correct destination.
Frame header includes Source and Destination address field,Physical Link Control
field, Flow control field, and Congestion Control field etc.,

Trailer: Data-link Layer adds also a trailer at the end of each frame. The trailer is
responsible for ensuring that frames are received intact or undamaged.

Services Provided to the Network Layer


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 three major types of services offered by data link layer are:
1. Unacknowledged connectionless service.
2. Acknowledged connectionless service.
3. Acknowledged connection-oriented service.

1. Unacknowledged Connectionless Service


(a) In this type of service source machine sends frames to destination machine but
the destination machine does not send any acknowledgement of these frames back
to the source. Hence it is called unacknowledged service.
(b) There is no connection establishment between source and destination machine
before data transfer or release after data transfer. Therefore, it is known as
connectionless service.
(c) There is no error control i.e. if any frame is lost due to noise on the line; no
attempt is made to recover it.
(d) This type of service is used when error rate is low.
(e) It is suitable for real time traffic such as speech.

2. Acknowledged Connectionless Service


(a) In this service, neither the connection is established before the data transfer nor
is it released after the data transfer between source and destination.
(b) When the sender sends the data frames to destination, destination machine
sends back the acknowledgement of these frames.

1
(c) This type of service provides additional reliability because source machine
retransmit the frames if it does not receive the acknowledgement of these frames
within the specified time.
(d) This service is useful over unreliable channels, such as wireless systems.

3. Acknowledged Connection - Oriented Service


(a) This service is the most sophisticated service provided by data link layer to
network layer.
(b) It is connection-oriented. It means that connection is establishment between
source & destination before any data is transferred.
(c) In this service, data transfer has three distinct phases: -
(i) Connection establishment
(ii) Actual data transfer
(iii) Connection release
(d) Here, each frame being transmitted from source to destination is given a specific
number and is acknowledged by the destination machine.
(e) All the frames are received by destination in the same order in which they are
sending by the source.

Framing:A packet at the data-link layer is normally called a frame.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. We have shown that a frame may have
both a header and a trailer. Different data-link layers have different formats for
framing.

Frame Size
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. 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: 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.
To separate one frame from the next, an 8-bit (1-byte) flag is added at the beginning
and the end of a frame. Figure shows the format of a frame in a character-oriented
protocol.

Fig:A frame in a character-oriented protocol

Character-oriented framing was popular when only text was exchanged by the data-
link layers. The flag could be selected to be any character not used for text
communication.
Now we send other types of information such as graphs, audio, and video; any
character used for the flag could also be part of the information.
2
To solve this problem, a byte-stuffing strategy was added to character-oriented
framing. In byte stuffing is the process of adding one extra byte whenever there is a
flag or escape character in the text. The data section is stuffed with an extra byte.
This byte is usually called the escape character (ESC) and has a predefined bit
pattern.

Fig:Byte stuffing and unstuffing

 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, as shown in Figure.

Fig: 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 to prevent the
pattern from looking like a flag. The strategy is called bit stuffing. In bit stuffing, if 0
and five consecutive 1 bits are encountered, an extra 0 is added.

3
Fig: Bit stuffing and unstuffing

Flow and Error Control: One of the responsibilities of the data-link control
sublayer is flow and error control at the data-link layer.
Flow Control: Whenever an entity produces items and another entity consumes them,
there should be a balance between production and consumption rates. If the items
are produced faster than they can be consumed, the consumer can be overwhelmed
and may need to discard some items. We need to prevent losing the data items at
the consumer site.

Fig: Flow control at the data-link layer

Buffers
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: we need to implement error control at the data-link layer to prevent the
receiving node from delivering corrupted packets to its network layer. 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.
4
 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.

2. Error Detection and Correction and Error-Detection and -Correction


Techniques
Bit-level error detection and correction
Detecting and correcting the corruption of bits in a link-layer frame sent from one
node to another physically connected neighboring node.
Data can be corrupted during transmission, some applications require that errors
can be detected and corrected.

 Redundancy: 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.

 Detection versus Correction


The correction of errors is more difficult than the detection. 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.
In error correction, we need to know the exact number of bits that are corrupted and,
more importantly, their location in the message. The number of errors and the size of
the message are important factors.

Fig: Error-detection and -correction scenario

We divide our message into blocks, each of d bits, called datawords. We add r
redundant bits to each block to make the length n = d+ r. The resulting n-bit blocks
are called codewords. How the extra r bits are chosen or calculated.

Error-Detection and -Correction Techniques


Parity Checks
The simplest form of error detection is the use of a single parity bit. Suppose that
the information to be sent, D in Figure, has d bits. In an even parity scheme, the
sender simply includes one additional bit and chooses its value such that the total
number of 1s in the d + 1 bits (the original information plus a parity bit) is even.
For odd parity schemes, the parity bit value is chosen such that there is an odd
number of 1s. Figure illustrates an even parity scheme, with the single parity bit
being stored in a separate field.

5
Fig: One-bit even parity

Receiver operation is also simple with a single parity bit. The receiver need only
count the number of 1s in the received d + 1 bits. If an odd number of 1- valued bits
are found with an even parity scheme, the receiver knows that at least one bit error
has occurred.

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

Fig: Encoder and decoder for simple parity-check code

Suppose now that a single bit error occurs in the original d bits of information. With
this two-dimensional parity scheme, the parity of both the column and the row
containing the flipped bit will be in error. The receiver can thus not only detect the
fact that a single bit error has occurred, but can use the column and row indices of
the column and row with parity errors to actually identify the bit that was corrupted
and correct that error.

6
Fig: Two-dimensional even parity

ii) Cyclic Redundancy Check

The cyclic redundancy check (CRC), which is used in networks such as LANs and
WANs.

CRC encoder and decoder:

Fig: CRC encoder and decoder

CRC encoder

 In the encoder, the dataword has k bits (4 here); the codeword has n bits (7 here).
The size of the dataword is increased by adding n − k (3 here) 0s to the right-hand
side of the word.

 The n-bit result is providing to the generator. The generator uses a divisor of size
n − k + 1 (4 here), predefined.

 The generator divides the increased dataword by the divisor (modulo-2 division).
The quotient of the division is discarded; the remainder (r2r1r0) is appended to the
dataword to create the codeword.

CRC decoder

 The decoder receives the codeword. A copy of all n bits is fed to the checker,
which is a copy of the generator.

 The remainder produced by the checker is a syndrome of n − k (3 here) bits,


which is fed to the decision logic analyzer.

 The analyzer has a simple function. If the syndrome bits are all 0s, the 4 leftmost
bits of the codeword are accepted as the dataword (interpreted as no error);
otherwise, the 4 bits are discarded (error).

7
Example:
Encoder

Decoder:

Polynomials: A better way to understand cyclic codes and how they can be
analyzed is to represent them as polynomials. A pattern of 0s and 1s can be
represented as a polynomial with coefficients of 0 and 1. The power of each term
shows the position of the bit; the coefficient shows the value of the bit.
Figure shows a binary pattern and its polynomial representation. In Figure a we show
how to translate a binary pattern into a polynomial; in Figure b we show how the
polynomial can be shortened by removing all terms with zero coefficients and
replacing x1 by x and x0 by 1.

8
Fig: A polynomial to represent a binary word
Degree of a Polynomial The degree of a polynomial is the highest power in the
polynomial. For example, the degree of the polynomial x6 + x + 1 is 6.
3
Cyclic Code Encoder Using Polynomials:The dataword 1001 is represented as x + 1.
The divisor 1011 is represented as x3 + x + 1. To find the augmented dataword, we
have left-shifted the dataword 3 bits (multiplying by x3). The result is x6 + x3.

iii) Checksum
Checksum is an error-detecting technique that can be applied to a message of any
length.

 In checksum error detection scheme, the data is divided into k segments each of
m bits.
 In the source, the segments are added using 1’s complement arithmetic to get
the sum. The sum is complemented to get the checksum.
 The checksum segment is sent along with the data segments.
 At the destination, all received segments are added using 1’s complement
arithmetic to get the sum. The sum is complemented.
 If the result is zero, the received data is accepted; otherwise discarded.

Fig: Checksum

Example:

9
iv) Forward Error Correction
Numbers of methods are used for error detection and retransmission. However,
retransmission of corrupted and lost packets is not useful for real-time multimedia
transmission because it creates an unacceptable delay in reproducing: we need to
wait until the lost or corrupted packet is resent. We need to correct the error or
reproduce the packet immediately.
Several schemes have been designed and used in these cases that are collectively
referred to as forward error correction (FEC) techniques.

Hamming code example: The key to the Hamming Code is the use of extra parity
bits to allow the identification of a single error. Create the code word as follows:

a) Mark all bit positions that are powers of two as parity bits. (Positions 1, 2, 4, 8, 16,
32, 64, etc.)
b) All other bit positions are for the data to be encoded. (Positions 3, 5, 6, 7, 9, 10, 11,
12, 13, 14, 15, 17, etc.)
c) Each parity bit calculates the parity for some of the bits in the code word. The
position of the parity bit determines the sequence of bits that it alternately checks
and skips.
 Parity bit 1 covers all the bits positions whose binary representation includes
a 1 in the least significantposition (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 fromthe 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 fromthe 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 fromthe least significant bit bits (8–15, 24–31,
40–47, etc).
d) 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.

Codeword: data word + additional bits (parity)


P4 D4 D3 D2 P3 D1 P2 P1

Example:
Data word: 1001, we check for even parity.

10
 P1 bit is calculated using the bits positions: 1, 3, 5, and 7. To find the parity bit
P1, we check for even parity. Since the total number of 1’s in all the bit
positions corresponding to P1 is an even number value (parity bit’s value) = 0.
 P2 bit is calculated using the bits positions: 2, 3, 6, and 7. Since the total
number of 1’s in all the bit positions corresponding to P2 is an even number
value (parity bit’s value) = 0.
 P3 bit is calculated using the bits positions: 4 , 5, 6 and 7. Since the total
number of 1’s in all the bit positions corresponding to P2 is an even number
value (parity bit’s value) = 1.
Thus, the data transferred is:

If the data transfer perfectly, there is no error.

Error detection and correction: Suppose in the above example the 3rd bit is changed
from 1 to 0 during data transmission, then it gives new parity values in the binary
number:

P1 bit positions(1,3,5,7), even parity value=1


P2 bit positions(2,3,6,7), even parity value=1
P3 bit positions(4,5,6,7), even parity value=0
The bits give the binary number as 011 whose decimal representation is 3. Thus, the
bit 3 contains an error. To correct the error the 3rd bit is changed from 0 to 1.

3. Data-Link Layer Protocols


The how the data link layer can combine framing, flow control, and error control to
achieve the delivery of data from one node to another. The protocols are normally
implemented in software by using one of the common programming languages.
 Protocols for noiseless channel: Simplest, Stop-and-Wait
 Protocols for noisy channel: Stop-and-Wait ARQ, Go-Back-N ARQ, Selective
Repeat ARQ.

Elementary Data Link Protocols (Noiseless Channels)


Let us first assume we have an ideal channel in which no frames are lost, duplicated,
or corrupted. We introduce two protocols for this type of channel: Simplest, Stop-
and-Wait

 Simplest Protocol: Our first protocol, which we call the Simplest, is one that has
no flow or error control. It is a unidirectional protocol in which data frames are
traveling in only one direction-from the sender to receiver.
We assume that the receiver can immediately handle any frame it receives with a
processing time. The data link layer of the receiver immediately removes the header
from the frame and hands the data packet to its network layer, which can also
accept the packet immediately.
Design:

11
Fig: The design of the simplest protocol with no flow or error control
Flow diagram:

 Stop-and-Wait: The receiver does not have enough storage space, especially if it
is receiving data from many sources. This may result in either the discarding of
frames or denial of service.
To prevent the receiver from becoming overwhelmed with frames, we somehow
need to tell the sender to slow down. There must be feedback from the receiver to
the sender.
The protocol we discuss now is called the Stop-and-Wait Protocol because the
sender sends one frame, stops until it receives confirmation from the receiver, and
then sends the next frame.
We still have unidirectional communication for data frames, but auxiliary ACK frames
(simple tokens of acknowledgment) travel from the other direction. We add flow
control to protocol.

Design:

Fig: Design of Stop-and-Wait Protocol

Flow diagram:

12
Sliding Window Protocols (Noisy Channels): Although the Stop-and-Wait
Protocol gives us an idea of how to add flow control to its predecessor, noiseless
channels are nonexistent. We can ignore the error or we need to add error control to
our protocols. We discuss three protocols in this section that use error control.

 Stop-and-Wait Automatic Repeat Request: the Stop-and-Wait Automatic Repeat


Request (Stop-and-Wait ARQ), adds a simple error control mechanism to the Stop-
and-Wait Protocol. Let us see how this protocol detects and corrects errors.

To detect and correct corrupted frames, we need to add redundancy bits to our data
frame. When the frame arrives at the receiver site, it is checked and if it is corrupted,
it is silently discarded.
The completed and lost frames need to be resent in this protocol. The sender keeps
a copy of the sent frame. At the same time, it starts a timer. If the timer expires and
there is no ACK for the sent frame, the frame is resent, the copy is held, and the timer
is restarted.

Sequence Numbers: the protocol specifies that frames need to be numbered. This is
done by using sequence numbers. A field is added to the data frame to hold the
sequence number of that frame.
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.

Design:

Fig: Design of the Stop-and-Wait ARQ Protocol


Flow diagram:
13
 Go-Back-N Automatic Repeat Request: To improve the efficiency of transmission
(filling the pipe), multiple frames must be in transition while waiting for
acknowledgment.
The first is called Go-Back-N Automatic Repeat Request 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. In


the Go-Back-N Protocol, the sequence numbers are modulo 2m, where m is the size
of the sequence number field in bits.

Sliding Window: In this protocol, the sliding window is an abstract concept that
defines the range of sequence numbers that is the concern of the sender and
receiver. In other words, the sender and receiver need to deal with only part of the
possible sequence numbers.

The send window the maximum size of the window is 2m.The receive window
makes sure that the correct data frames are received and that the correct
acknowledgments are sent. The size of the receive window is always 1.

Design:

Fig: Design of Go-Back-NARQ


Flow diagram:

14
 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.
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 Repeat ARQ.

Windows: The Selective Repeat Protocol also uses two windows: a send window and
a receive window. The receive window is the same size as the send window.

Design:

Fig: Design of Selective Repeat ARQ

Flow diagram:

15
4. Multiple Access Links and Protocols
When nodes or stations are connected and use a common link, called a multipoint or
broadcast link, we need a multiple-access protocol to coordinate access to the link.
The problem of controlling the access to the medium is similar to the rules of
speaking in an assembly.
Many protocols have been devised to handle access to a shared link. All of these
protocols belong to a sublayer in the data-link layer called media access control
(MAC). We categorize them into three groups, as shown in Figure.

Fig: Taxonomy of multiple-access protocols

i) Random Access: In random-access or contention methods, no station is


superior to another station and none is assigned control over another. At each
instance, a station that has data to send uses a procedure defined by the protocol to
make a decision on whether or not to send. This decision depends on the state of
the medium (idle or busy).

In a random-access method, each station has the right to the medium without being
controlled by any other station. However, if more than one station tries to send, there
is an access conflict—collision—and the frames will be either destroyed or modified.

The random-access methods: ALOHA, CSMA, CSMA/CD, CSMA/CA

ALOHA
ALOHA, the earliest random access method, was developed at the University of
Hawaii in early 1970. The medium is shared between the stations. When a station
sends data, another station may attempt to do so at the same time. The data from
the two stations collide and become distorted.
Pure ALOHA
16
The original ALOHA protocol is called pure ALOHA. This is a simple but well-
designed protocol.
The idea is that each station sends a frame whenever it has a frame to send
(multiple access). However, since there is only one channel to share, there is the
possibility of collision between frames from different stations. Figure shows an
example of frame collisions in pure ALOHA.

Fig: Frames in a pure ALOHA network

There are four stations (unrealistic assumption) that contend with one another for
access to the shared channel. The figure shows that each station sends two frames;
there are a total of eight frames on the shared medium. Some of these frames
collide because multiple frames are in contention for the shared channel. Figure
shows that only two frames survive: one frame from station 1 and one frame from
station 3.

Pure ALOHA has a method to prevent congesting the channel with retransmitted
frames. After a maximum number of retransmissions attempts Kmax, a station must
give up and try later.

Fig: Procedure for pure ALOHA protocol

Slotted ALOHA
A station may send soon after another station has started or just before another
station has finished. Slotted ALOHA was invented to improve the efficiency of pure
ALOHA.
In slotted ALOHA we divide the time into slots of Tfr seconds and force the station
to send only at the beginning of the time slot. Figure shows an example of frame
collisions in slotted ALOHA.

17
Fig: Frames in a slotted ALOHA network

Because a station is allowed to send only at the beginning of the synchronized time
slot, if a station misses this moment, it must wait until the beginning of the next time
slot. This means that the station which started at the beginning of this slot has
already finished sending its frame.

CSMA
To minimize the chance of collision and, therefore, increase the performance, the
CSMA method was developed. The chance of collision can be reduced if a station
senses the medium before trying to use it.
Carrier sense multiple access (CSMA) requires that each station first listen to the
medium (or check the state of the medium) before sending. In other words, CSMA is
based on the principle “sense before transmit”.
CSMA can reduce the possibility of collision, but it cannot eliminate it. The reason for
this is shown in Figure, a space and time model of a CSMA network. Stations are
connected to a shared channel.

Fig: Space/time model of a collision in CSMA


The possibility of collision still exists because of propagation delay; when a station
sends a frame, it still takes time for the first bit to reach every station and for every
station to sense it.

At time t1, station B senses the medium and finds it idle, so it sends a frame. At time
t2 (t2 >t1), station C senses the medium and finds it idle because, at this time, the
first bits from station B have not reached station C. Station C also sends a frame.
The two signals collide and both frames are destroyed.

Persistence Methods: Three methods have been devised to answer these


questions: the 1-persistentmethod, the nonpersistent method, and the p-persistent
method. Figure shows the behavior of three persistence methods when a station
finds a channel busy.

1-Persistent: The 1-persistent method is simple and straightforward. In this method,


after the station finds the line idle, it sends its frame immediately (with probability 1).
This method has the highest chance of collision because two or more stations may
find the line idle and send their frames immediately.

18
Fig: 1-Persistent

Nonpersistent: In the nonpersistent method, a station that has a frame to send


senses the line. If the line is idle, it sends immediately. If the line is not idle, it waits a
random amount of time and then senses the line again. The nonpersistent approach
reduces the chance of collision because it is unlikely that two or more stations will
wait the same amount of time and retry to send simultaneously

Fig: Nonpersistent

P-Persistent: The p-persistent method is used if the channel has time slots with a
slot duration equal to or greater than the maximum propagation time. It reduces the
chance of collision and improves efficiency. In this method, after the station finds
the line idle it follows these steps:
1. With probability p, the station sends its frame.
2. With probability q = 1 − p, the station waits for the beginning of the next time slot
and checks the line again.
a. If the line is idle, it goes to step 1.
b. If the line is busy, it acts as though a collision has occurred and uses the backoff
procedure.

Fig: p-Persistent
CSMA/CD
The CSMA method does not specify the procedure following a collision. Carrier
sense multiple access with collision detection (CSMA/CD) augments the algorithm
to handle the collision.
In this method, a station monitors the medium after it sends a frame to see if the
transmission was successful. If so, the station is finished. If, however, there is a
collision, the frame is sent again.
19
To better understand CSMA/CD, let us look at the first bits transmitted by the two
stations involved in the collision. Although each station continues to send bits in the
frame until it detects the collision, we show what happens as the first bits collide. In
Figure, stations A and C are involved in the collision.

Fig: Collision of the first bits in CSMA/CD

Procedure: Now let us look at the flow diagram for CSMA/CD in Figure.

Fig: Flow diagram for the CSMA/CD

The sending of a short jamming signal to make sure that all other stations become
aware of the collision.

CSMA/CA
Carrier sense multiple access with collision avoidance (CSMA/CA) was invented for
wireless networks. Collisions are avoided through the use of CSMA/CA’s three
strategies: the inter frame space, the contention window, and acknowledgments, as
shown in Figure.

Inter Frame Space (IFS). First, collisions are avoided by deferring transmission even
if the channel is found idle. When an idle channel is found, the station does not send
immediately. It waits for a period of time called the interframe space or IFS.

Contention Window. The contention window is an amount of time divided into slots.
A station that is ready to send chooses a random number of slots as its wait time.
The number of slots in the window changes according to the binary exponential
backoff strategy.

Fig: Contention window

Acknowledgment. With all these precautions, there still may be a collision resulting
in destroyed data. In addition, the data may be corrupted during the transmission.
The positive acknowledgment and the time-out timer can help guarantee that the
receiver has received the frame.
20
ii) Controlled Access: In controlled access, the stations consult one another to
find which station has the right to send. A station cannot send unless it has been
authorized by other stations. We discuss three controlled-access methods.

Reservation:
 In the reservation method, a station needs to make a reservation before sending
data. Time is divided into intervals.
 In each interval, a reservation frame precedes the data frames sent in that
interval. If there are N stations in the system, there are exactly N reservation
minislots in the reservation frame. Each minislot belongs to a station. When a station
needs to send a data frame, it makes a reservation in its own minislot.
 The stations that have made reservations can send their data frames after the
reservation frame. Figure shows a situation with five stations and a five-minislot
reservation frame.
 In the first interval, only stations 1, 3, and 4 have made reservations. In the
second interval, only station 1 has made a reservation.

Fig: Reservation access method

Polling
 Polling works with topologies in which one device is designated as a primary
station and the other devices are secondary stations.
 All data exchanges must be made through the primary device even when the
ultimate destination is a secondary device.
 The primary device controls the link; the secondary devices follow its instructions.
It is up to the primary device to determine which device is allowed to use the channel
at a given time.
 This method uses poll and select functions to prevent collisions.

Fig: Select and poll functions in polling-access method

Select: The select function is used whenever the primary device has something to
send. Remember that the primary controls the link. If the primary is neither sending
nor receiving data, it knows the link is available.
 The primary must alert the secondary to the upcoming transmission and wait for
an acknowledgment of the secondary’s ready status.
 Before sending data, the primary creates and transmits a select (SEL) frame, one
21
field of which includes the address of the intended secondary.

Poll: The poll function is used by the primary device to request transmissions from
the secondary devices.
 When the primary is ready to receive data, it must ask (poll) each device in turn if
it has anything to send.
 When the first secondary is approached, it responds either with a NAK frame if it
has nothing to send or with data (in the form of a data frame) if it does.
 If the response is negative (a NAK frame), then the primary polls the next
secondary in the same manner until it finds one with data to send.
 When the response is positive (a data frame), the primary reads the frame and
returns an acknowledgment (ACK frame), verifying its receipt.

Token Passing
 In the token-passing method, the stations in a network are organized in a logical
ring. For each station, there is a predecessor and a successor.
 The predecessor is the station which is logically before the station in the ring; the
successor is the station which is after the station in the ring.
 The current station is the one that is accessing the channel now. The right to this
access has been passed from the predecessor to the current station.
 The right will be passed to the successor when the current station has no more
data to send.

But how is the right to access the channel passed from one station to another? In
this method, a special packet called a token circulates through the ring.

Token management is needed for this access method. Stations must be limited in
the time they can have possession of the token. The token must be monitored to
ensure it has not been lost or destroyed.
Another function of token management is to assign priorities to the stations and to
the types of data being transmitted. And finally, token management is needed to
make low-priority stations release the token to high-priority stations.

Logical Ring: In a token-passing network, stations do not have to be physically


connected in a ring; the ring can be a logical one. Figure shows four different
physical topologies that can create a logical ring.

Fig: Logical ring and physical topology in token-passing access method

iii) Channelization: Channelization (or channel partition, as it is sometimes called)


is a multiple-access method in which the available bandwidth of a link is shared in
time, frequency, or through code, among different stations. We discuss three
channelization protocols: FDMA, TDMA, and CDMA.

FDMA
 In frequency-division multiple access (FDMA), the available bandwidth is divided
into frequency bands.
22
 Each station is allocated a band to send its data. In other words, each band is
reserved for a specific station, and it belongs to the station all the time.
 Each station also uses a bandpass filter to confine the transmitter frequencies.
 To prevent station interferences, the allocated bands are separated from one
another by small guard bands. Figure shows the idea of FDMA.

Fig: Frequency-division multiple access (FDMA)

TDMA
In time-division multiple access (TDMA), the stations share the bandwidth of the
channel in time. Each station is allocated a time slot during which it can send data.
Each station transmits its data in its assigned time slot. Figure shows the idea
behind TDMA.

Fig: Time-division multiple access (TDMA)


CDMA
Code-division multiple access (CDMA) was conceived several decades ago. In CDMA,
one channel carries all transmissions simultaneously.
In CDMA, the stations use different codes to achieve multiple accesses. CDMA is
based on coding theory and uses sequence of numbers called chips.

Let us assume we have four stations, 1, 2, 3, and 4, connected to the same channel.
The data from station 1 are d1, from station 2 are d2, and so on. The code assigned
to the first station is c1, to the second is c2, and so on.
We assume that the assigned codes have two properties.
1. If we multiply each code by another, we get 0.
2. If we multiply each code by itself, we get 4 (the number of stations).

Fig: Simple idea of communication with code

23
5. Switched Local Area Networks
Figure shows a switched local network connecting three departments, two servers
and a router with four switches. Because these switches operate at the link layer,
they switch link-layer frames.

Fig: An institutional network connected together by four switches

Instead of using IP addresses, we will soon see that they use link-layer addresses to
forward link-layer frames through the network of switches.

Link-Layer Addressing
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.
So, 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.
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.

Address Resolution Protocol (ARP): 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. It
belongs to the network layer; 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.

24
Fig: Position of ARP in TCP/IP protocol suite

ARP operation: ARP request, ARP response.


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.

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

ARP Packet Format: Figure shows the format of an ARP packet. The hardware type
field defines the type of the link-layer protocol; the protocol type field defines the
network-layer protocol.
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.

25
Fig: ARP packet

Ethernet (IEEE Standard 802.3)


Ethernet is the traditional technology for connecting devices in a wired local area
network (LAN) or wide area network (WAN). Ethernet was the first widely deployed
high-speed LAN.
 Frame Format: The Ethernet frame contains seven fields, as shown in Figure.

Preamble. This field contains 7 bytes (56 bits) of alternating 0s and 1s that alert the
receiving system to the coming frame and enable it to synchronize its clock if it’s out
synchronization. The pattern provides only an alert and a timing pulse.

Destination address (DA). This field is six bytes (48 bits) and contains the link-layer
address of the destination station or stations to receive the packet.

Source address (SA). This field is also six bytes and contains the link-layer address
of the sender of the packet.

Type. This field defines the upper-layer protocol whose packet is encapsulated in the
frame. This protocol can be IP, ARP, OSPF, and so on.

Data. This field carries data encapsulated from the upper-layer protocols. It is a
minimum of 46 and a maximum of 1500 bytes.

Cyclic redundancy check (CRC) (4 bytes). the purpose of the CRC field is to allow the
receiving adapter, adapter B, to detect bit errors in the frame.

Ethernet Technologies:
1. Standard Ethernet (l0 Mbps),
2. Fast Ethernet (100 Mbps),
3. Gigabit Ethernet (l Gbps)
4. Ten-Gigabit Ethernet (l0 Gbps)
Standard Ethernet: A standard Ethernet network can transmit data at a rate up to 10
Megabits per second (10 Mbps). The Institute for Electrical and Electronic Engineers
developed an Ethernet standard known as IEEE Standard 802.3. This standard
defines rules for configuring an Ethernet network and specifies how the elements in
an Ethernet network interact with one another.

Fast Ethernet (100 Mbps): 802.3u


26
Ethernet made a big jump by increasing the transmission rate to 100 Mbps, and the
new generation was called the Fast Ethernet.
The goals of Fast Ethernet can be summarized as follows:
1. Upgrade the data rate to 100 Mbps.
2. Make it compatible with Standard Ethernet.
3. Keep the same 48-bit address.
4. Keep the same frame format.
5. Keep the same minimum and maximum frame lengths.

Gigabit Ethernet (1 Gbps): 802.3z


The need for an even higher data rate resulted in the design of the Gigabit Ethernet
Protocol (1000 Mbps). The IEEE committee calls it the Standard 802.3z. The goals of
the Gigabit Ethernet were to upgrade the data rate to 1 Gbps.
The goals of the Gigabit Ethernet design can be summarized as follows:
1. Upgrade the data rate to 1 Gbps.
2. Make it compatible with Standard or Fast Ethernet.
3. Use the same 48-bit address.
4. Use the same frame format.
5. Keep the same minimum and maximum frame lengths.

10 Gigabit Ethernet (10 Gbps): 802.3ae


1. Upgrade the data rate to 10 Gbps.
2. Make it compatible with Standard or Fast Ethernet.
3. Use the same 48-bit address.
4. Use the same frame format.
5. Keep the same minimum and maximum frame lengths.

6. Link Virtualization: A Network as a Link Layer


 A switch that supports virtual local area networks (VLANs). As the name
suggests, a switch that supports VLANs allows multiple virtual local area networks
to be defined over a single physical local area network infrastructure.
 Hosts within a VLAN communicate with each other as if they (and no other hosts)
were connected to the switch. In a port-based VLAN, the switch’s ports (interfaces)
are divided into groups by the network manager.
 Each group constitutes a VLAN, with the ports in each VLAN forming a broadcast
domain (i.e., broadcast traffic from one port can only reach other ports in the group).
 Figure shows a single switch with 16 ports. Ports2 to 8 belong to the EE VLAN,
while ports 9 to 15 belong to the CS VLAN (ports1 and 16 are unassigned).

Fig: A single switch with two configured VLANs


A more scalable approach to interconnecting VLAN switches is known as VLAN
trunking. In the VLAN trunking approach shown in Figure, a special port on each
switch (port 16 on the left switch and port 1 on the right switch) is configured as a
trunk port to interconnect the two VLAN switches. The trunk port belongs to all
VLANs, and frames sent to any VLAN are forwarded over the trunk link to the other
switch.
27
The IEEE has defined an extended Ethernet frame format, 802.1Q, for frames
crossing a VLAN trunk. As shown in Figure, the 802.1Q frame consists of the
standard Ethernet frame with a four-byte VLAN tag added into the header that
carries the identity of the VLAN to which the frame belongs.

Fig: Connecting two VLAN switches with two VLANs: (a) two cables (b) trunked

7. Data Center Networking


In recent years, Internet companies such as Google, Microsoft, Facebook, and
Amazon have built massive data centers, each housing tens to hundreds of
thousands of hosts, and concurrently supporting many distinct cloud applications
(e.g., search, email, social networking, and e-commerce).
 A data center is a facility that centralizes an organization’s shared IT operations
and equipment for the purposes of storing, processing, and disseminating data and
applications.
 Each data center has its own data center network that interconnects its hosts with
each other and interconnects the data center with the Internet.
 The hosts in data centers, called blades and like pizza boxes, are generally
commodity hosts that include CPU, memory, and disk storage. The hosts are
stacked in racks, with each rack typically having 20 to 40 blades.
 At the top of each rack there is a switch, aptly named the Top of Rack (TOR)
switch, that interconnects the hosts in the rack with each other and with other
switches in the data center.
 Specifically, each host in the rack has a network interface card that connects to its
TOR switch, and each TOR switch has additional ports that can be connected to
other switches. Each host is also assigned its own data-center-internal IP address.
 The data center network supports two types of traffic: traffic flowing between
external clients and internal hosts and traffic flowing between internal hosts. To
handle flows between external clients and internal hosts, the data center network
includes one or more border routers, connecting the data center network to the
public Internet. The data center network therefore interconnects the racks with each
other and connects the racks to the border routers.
 Figure shows an example of a data center network. Data center network design,
the art of designing the interconnection network and protocols that connect the
racks with each other and with the border routers.

28
Fig: A data center network with a hierarchical topology

Load Balancing
 A cloud data center, such as a Google or Microsoft data center, provides many
applications concurrently, such as search, email, and video applications.
 To support requests from external clients, each application is associated with a
publicly visible IP address to which clients send their requests and from which they
receive responses.
 Inside the data center, the external requests are first directed to a load balancer
whose job it is to distribute requests to the hosts, balancing the load across the
hosts as a function of their current load.
 A large data center will often have several load balancers, each one devoted to a
set of specific cloud applications.

8. Retrospective: A Day in the Life of a Web Page Request


Getting Started: DHCP, UDP, IP, and Ethernet
Let’s suppose that Bob boots up his laptop and then connects it to an Ethernet
cable connected Ethernet switch.
When Bob first connects his laptop to the network, he can’t do anything (e.g.,
download a Web page) without an IP address. Thus, the first network-related
action taken by Bob’s laptop is to run the DHCP protocol to obtain an IP address,
as well as other information, from the local DHCP server:

1. The operating system on Bob’s laptop creates a DHCP request message


and puts this message within a UDP segment with destination port 67
(DHCP server) and source port 68 (DHCP client). The UDP segment is then
placed within an IP datagram with a broadcast IP destination address
(255.255.255.255) and a source IP address of 0.0.0.0, since Bob’s laptop
doesn’t yet have an IP address.

2. The IP datagram containing the DHCP request message is then placed


within an Ethernet frame. The Ethernet frame has a destination MAC
addresses of FF:FF:FF:FF:FF:FF so that the frame will be broadcast to all
devices connected to the switch (hopefully including a DHCP server); the
frame’s source MAC address is that of Bob’s laptop, 00:16:D3:23:68:8A.

29
3. The broadcast Ethernet frame containing the DHCP request is the first
frame sent by Bob’s laptop to the Ethernet switch. The switch broadcasts
the incoming frame on all outgoing ports, including the port connected to
the router.
4. The router receives the broadcast Ethernet frame containing the DHCP
request on its interface with MAC address 00:22:6B:45:1F:1B and the IP
datagram is extracted from the Ethernet frame. The DHCP request message
is extracted from the UDP segment. The DHCP server now has the DHCP
request message.

5. Let’s suppose the DHCP server allocates address 68.85.2.101 to Bob’s


laptop. The DHCP server creates a DHCP ACK message containing this IP
address. The DHCP message is put inside a UDP segment, which is put
inside an IP datagram, which is put inside an Ethernet frame.

6. The Ethernet frame containing the DHCP ACK is sent (unicast) by the router
to the switch. Because the switch is self-learning and previously received an
Ethernet frame (containing the DHCP request) from Bob’s laptop.
7. Bob’s laptop receives the Ethernet frame containing the DHCP ACK,
extracts the IP datagram from the Ethernet frame. At this point, Bob’s
laptop has initialized its networking components and is ready to begin
processing the Web page fetch.

Still Getting Started: DNS and ARP


When Bob types the URL for www.google.com into his Web browser, he begins the
long chain of events that will eventually result in Google’s home page being
displayed by his Web browser.
8. The operating system on Bob’s laptop thus creates a DNS query message,
putting the string “www.google.com” in the question section of the DNS
message. This DNS message is then placed within a UDP segment with a
destination port of 53 (DNS server).
9. Bob’s laptop then places the datagram containing the DNS query message
in an Ethernet frame. However, even though Bob’s laptop knows the IP
address of the gateway router (68.85.2.1) via the DHCP ACK message in
step 5 above, it doesn’t know the gateway router’s MAC address. To obtain
the MAC address of the gateway router, Bob’s laptop will need to use the
ARP protocol.
10.Bob’s laptop creates an ARP query message with a target IP address of
68.85.2.1 (the default gateway), places the ARP message within an Ethernet
frame with a broadcast destination address and sends the Ethernet frame
to the switch, which delivers the frame to all connected devices, including
the gateway router.

11.The gateway router receives the frame containing the ARP query message
on the interface and finds that the target IP address of 68.85.2.1 in the ARP
message matches the IP address of its interface. The gateway router thus
prepares an ARP reply, indicating that its MAC address of 00:22:6B:45:1F:1B
corresponds to IP address 68.85.2.1.

12.Bob’s laptop receives the frame containing the ARP reply message and
extracts the MAC address of the gateway router (00:22:6B:45:1F:1B) from
the ARP reply message.

13.Bob’s laptop extracts the IP address of the server www.google.com from


30
the DNS message. Finally, after a lot of work, Bob’s laptop is now ready to
contact the www.google.com server!

Web Client-Server Interaction: TCP and HTTP


14.Now that Bob’s laptop has the IP address of www.google.com,it can create
the TCP socket that will be used to send the HTTP GET message to
www.google.com. When Bob creates the TCP socket, the TCP in Bob’s
laptop must first perform a three-way handshake with the TCP in
www.google.com. Bob’s laptop thus first creates a TCP SYN segment with
destination port 80 (for HTTP), places the TCP segment inside an IP data-
gram with a destination IP address of 64.233.169.105 (www.google.com),
places the datagram inside a frame with a destination MAC address of
00:22:6B:45:1F:1B (the gateway router) and sends the frame to the switch.

15.Eventually, the datagram containing the TCP SYN arrives at


www.google.com. A connection socket is created for the TCP connection
between the Google HTTP server and Bob’s laptop. A TCP SYNACK
segment is generated, placed inside a datagram addressed to Bob’s laptop.
16.The datagram containing the TCP SYNACK segment is forwarded through
the Google, Bob’s network, eventually arriving at the Ethernet card in Bob’s
laptop. The datagram is demultiplexed within the operating system to the
TCP socket enters the connected state.
17.With the socket on Bob’s laptop now (finally!) ready to send bytes to
www.google .com, Bob’s browser creates the HTTP GET message
containing the URL to be fetched. The TCP segment is placed in a datagram
and sent and delivered to www.google.com.

18.The HTTP server at www.google.com reads the HTTP GET message from
the TCP socket, creates an HTTP response message, places the requested
Web page content in the body of the HTTP response message, and sends
the message into the TCP socket.
19.The datagram containing the HTTP reply message is forwarded through the
Google, bob’s network, and arrives at Bob’s laptop. Bob’s Web browser
program reads the HTTP response from the socket, extracts the html for
the Web page from the body of the HTTP response, and finally displays the
Web page!

31
1

Network Layer Design Issues:

The network layer or layer 3 of the OSI (Open Systems Interconnec on) model is concerned
delivery of data packets from the source to the des na on across mul ple hops or links. It is
the lowest layer that is concerned with end − to − end transmission. The designers who are
concerned with designing this layer needs to cater to certain issues. These issues encompass
the services provided to the upper layers as well as internal design of the layer.
The design issues can be elaborated under four heads −
 Store − and − Forward Packet Switching
 Services to Transport Layer
 Providing Connec on Oriented Service
 Providing Connec onless Service

1. Store − and − Forward Packet Switching:


The network layer operates in an environment that uses store and forward packet switching.
The node which has a packet to send, delivers it to the nearest router. The packet is stored in
the router un l it has fully arrived and its checksum is verified for error detec on. Once, this
is done, the packet is forwarded to the next router. Since, each router needs to store the en re
packet before it can forward it to the next hop, the mechanism is called store − and − forward
switching.

2. Services provided to Transport Layer:


Through the network/transport layer interface, the network layer transfers its services to the
transport layer. These services are described below.
But before providing these services to the transfer layer following goals must be kept in mind:

 Offering services must not depend on router technology.


2

 The transport layer needs to be protected from the type, number and topology of the
available router.
 The network addresses for the transport layer should use uniform numbering pa ern
also at LAN and WAN connec ons.
Based on the connec ons there are 2 types of services provided:
Connec onless – The rou ng and inser on of packets into subnet is done individually.
No added setup is required.
Connec on-Oriented – Subnet must offer reliable service and all the packets must be
transmi ed over a single route.

3. Implementa on of Connec onless Service:


Packet is termed as “datagrams” and corresponding subnet as “datagram subnets”. When the
message size that has to be transmi ed is 4 mes the size of the packet, then the network
layer divides into 4 packets and transmits each packet to router via. a few protocols. Each data
packet has des na on address and is routed independently irrespec ve of the packets.

4. Implementa on of Connec on Oriented service:


To use a connec on-oriented service, first we establish a connec on, use it and then release
it. In connec on-oriented services, the data packets are delivered to the receiver in the same
order in which they have been sent by the sender.
It can be done in either two ways:
Circuit Switched Connec on – A dedicated physical path or a circuit is established
between the communica ng nodes and then data stream is transferred.
Virtual Circuit Switched Connec on – The data stream is transferred over a packet
switched network, in such a way that it seems to the user that there is a dedicated
path from the sender to the receiver. A virtual path is established here. While, other
connec ons may also be using the same path.

Rou ng Algorithms in Computer Networks:


Rou ng algorithms are basically used in computer networks to determine the most efficient
path for data to travel. They use various metrics such as distance, traffic, and available
bandwidth to make rou ng decisions and op mize network performance.
A rou ng algorithm is a way to establish the path for data packets. The path is from the source
to the des na on. It helps in leading internet traffic.
3

When a data packet leaves its origin, it can take one of many different paths. It computes the
best path (least-cost path) to send the data.

Flooding in Computer Networks:


Flooding is a technique of rou ng in computer networking, in which a sender node transmits
packets via all the outgoing links. Flooding is similar to broadcas ng in that it happens when
sender packets are transferred without rou ng data to each network node a ached.
Since flooding naturally u lizes each route in the network, flooding algorithms are designed
to find and u lize the shortest path to transfer the packets. Flooding can also be used for
D.O.S. (Denial Of Service) a acks for bringing down a network by flooding network traffic.

What is Flooding:
Flooding is a sta c rou ng technique, based on the following principle:
“When a packet reaches the router, it is transferred to all the outgoing links, except only the
link that it has reached the router through.”
Flooding is used in rou ng protocols such as O.S.P.F. (Open Shortest Path First), peer-to-peer
file transfers, systems such as Usenet, bridging, etc. Let us have a look at an example for a
be er understanding. Assume there is a network with 6 routers connected through
transmission lines, as shown in the figure ahead.

Following are the Events that Take Place in Flooding:


 Any packet incoming to A is sent to D, C, and B.
 B sends this packet to E and C.
4

 C sends this packet to F, D, and B.


 D sends this packet to F and C.
 E sends the packet to F.
 F sends the packet to E and C.

Types of Flooding:
Flooding may be of three types −
Uncontrolled flooding − Here, each router uncondi onally transmits the incoming data
packets to all its neighbours.
Controlled flooding − They use some methods to control the transmission of packets
to the neighbouring nodes. The two popular algorithms for controlled flooding are
Sequence Number Controlled Flooding (SNCF) and Reverse Path Forwarding (RPF).
Selec ve flooding − Here, the routers don't transmit the incoming packets only along
those paths which are heading towards approximately in the right direc on, instead
of every available paths.

Characteris cs of Flooding:
Following are some features of flooding:

 Every possible route between the source and the des na on for transmission is tried
in flooding.
 There always exists a minimum of one route which is the shortest.
 Any node that is connected, whether directly or indirectly, is explored.
 Flooding does not require any informa on related to the network, such as the costs of
various paths, load condi ons, topology, etc. This is why it is non-adap ve.

Advantages of Flooding:
 It is very simple to setup and implement, since a router may know only its neighbours.
 It is extremely robust. Even in case of malfunc oning of a large number routers, the
packets find a way to reach the des na on.
 All nodes which are directly or indirectly connected are visited. So, there are no
chances for any node to be le out. This is a main criteria in case of broadcast
messages.
 The shortest path is always chosen by flooding.
5

Limita ons of Flooding:


Flooding tends to create an infinite number of duplicate data packets, unless some measures
are adopted to damp packet genera on.
It is wasteful if a single des na on needs the packet, since it delivers the data packet to all
nodes irrespec ve of the des na on.
The network may be clogged with unwanted and duplicate data packets. This may hamper
delivery of other data packets.

Distance Vector Rou ng Algorithm:


Distance vector is the "Dynamic Rou ng" protocol. Distant vector protocol also called as
Bellman-Ford algorithm used to calculate the shortest path.
Explana on of Distance Vector Rou ng Algorithm:
Distance vector rou ng algorithm is also called as Bellman-Ford algorithm or Ford Fulkerson
algorithm as this algorithm is used to find the shortest route from one node to another node
in the network.
The rou ng protocol is used to calculate the best route from source to des na on based on
the distance or hops as its primary metric to define an op mal path. The distance vector refers
to the distance to the neighbour nodes, where rou ng defines the routes to the established
node.
The Distance Vector rou ng algorithm (DVR) shares the informa on of the rou ng table with
the other routers in the network and keeps the informa on up-to-date to select an op mal
path from source to des na on.
The Bellman-Ford algorithm is defined as:
6

Let's understand a few key points about the distance vector rou ng protocol:
Network Informa on:
Every node in the network should have informa on about its neighbouring node. Each node
in the network is designed to share informa on with all the nodes in the network.
Rou ng Pa ern:
In DVR the data shared by the nodes are transmi ed only to that node that is linked directly
to one or more nodes in the network.
Data sharing:
The nodes share the informa on with the neighbouring node from me to me as there is a
change in network topology.

Example of Distance Vector Rou ng:


Consider the following network; three routers are there: A, B, and C with AB=1, BC=2, and
CA=5.
Let's see the following steps to understand it be er.

Step 1:
Each router shares its rou ng table with every neighbour in this distance vector rou ng
network. As A will share its rou ng table with neighbours B and C, neighbours B and C will
share their rou ng table with A.
Rou ng table A:
7
8
9

Advantage of Distance Vector Rou ng:

 For a typical LAN se ng, bandwidth requirements are minimal.


 compared to other rou ng techniques, requires less hardware and compu ng power.
 reliable and tested approach (distance vector was the original rou ng algorithm)
 Simple to use and administer

Disadvantage of Distance Vector Rou ng:

 Time to convergence is rela vely slow (updates sent at specified intervals)


 Before making any modifica ons to forwarding, routers must recalculate their rou ng
tables.
 vulnerability to rou ng loops (count-to-infinity)
 For WAN or complex LAN situa ons, bandwidth requirements may be excessive.

hierarchical rou ng algorithms:


In hierarchical rou ng, the routers are divided into regions. Each router has complete details
about how to route packets to des na ons within its own region. But it does not have any
idea about the internal structure of other regions.
As we know, in both LS and DV algorithms, every router needs to save some informa on about
other routers. When network size is growing, the number of routers in the network will
increase. Therefore, the size of rou ng table increases, then routers cannot handle network
traffic as efficiently. To overcome this problem, we are using hierarchical rou ng.
In hierarchical rou ng, routers are classified in groups called regions. Each router has
informa on about the routers in its own region and it has no informa on about routers in
other regions. So, routers save one record in their table for every other region.
For huge networks, a two-level hierarchy may be insufficient hence, it may be necessary to
group the regions into clusters, the clusters into zones, the zones into groups and so on.
Example:
Consider an example of two-level hierarchy with five regions as shown in figure –
10

Let see the full rou ng table for router 1A which has 17 entries, as shown below –
11

Explana on:
 Step 1 − For example, the best path from 1A to 5C is via region 2, but hierarchical
rou ng of all traffic to region 5 goes via region 3 as it is be er for most of the other
des na ons of region 5.
 Step 2 − Consider a subnet of 720 routers. If no hierarchy is used, each router will
have 720 entries in its rou ng table.
 Step 3 − Now if the subnet is par oned into 24 regions of 30 routers each, then
each router will require 30 local entries and 23 remote entries for a total of 53
entries.
Example:
If the same subnet of 720 routers is par oned into 8 clusters, each containing 9 regions and
each region containing 10 routers. Then what will be the total number of table entries in
each router.
Solu on:
10 local entries + 8 remote regions + 7 clusters = 25 entries.
12

Conges on control algorithms


What is conges on?
A state occurring in network layer when the message traffic is so heavy that it slows down
network response me.
Effects of Conges on

 As delay increases, performance decreases.


 If delay increases, retransmission occurs, making situa on worse.
Conges on control algorithms

 Conges on Control is a mechanism that controls the entry of data packets into the
network, enabling a be er use of a shared network infrastructure and avoiding
conges ve collapse.
 Conges ve-Avoidance Algorithms (CAA) are implemented at the TCP layer as the
mechanism to avoid conges ve collapse in a network.

There are two conges on control algorithm which are as follows:


Leaky Bucket Algorithm
 The leaky bucket algorithm discovers its use in the context of network traffic shaping or
rate-limi ng.
 A leaky bucket execu on and a token bucket execu on are predominantly used for traffic
shaping algorithms.
 This algorithm is used to control the rate at which traffic is sent to the network and
shape the burst traffic to a steady traffic stream.
 The disadvantages compared with the leaky-bucket algorithm are the inefficient use of
available network resources.
 The large area of network resources such as bandwidth is not being used effec vely.

Let us consider an example to understand


Imagine a bucket with a small hole in the bo om. No ma er at what rate water enters the
bucket, the ou low is at constant rate. When the bucket is full with water addi onal water
entering spills over the sides and is lost.
13

Similarly, each network interface contains a leaky bucket and the following steps are
involved in leaky bucket algorithm:

 When host wants to send packet, packet is thrown into the bucket.
 The bucket leaks at a constant rate, meaning the network interface transmits packets
at a constant rate.
 Busty traffic is converted to a uniform traffic by the leaky bucket.
 In prac ce the bucket is a finite queue that outputs at a finite rate.

Token Bucket Algorithm


The leaky bucket algorithm has a rigid output design at the average rate independent of the
bursty traffic. In some applica ons, when large bursts arrive, the output is allowed to speed
up. This calls for a more flexible algorithm, preferably one that never loses informa on.
Therefore, a token bucket algorithm finds its uses in network traffic shaping or rate-limi ng.
It is a control algorithm that indicates when traffic should be sent. This order comes based
on the display of tokens in the bucket. The bucket contains tokens. Each of the tokens
defines a packet of predetermined size. Tokens in the bucket are deleted for the ability to
share a packet.
When tokens are shown, a flow to transmit traffic appears in the display of tokens. No token
means no flow sends its packets. Hence, a flow transfers traffic up to its peak burst rate in
good tokens in the bucket.
Thus, the token bucket algorithm adds a token to the bucket each 1 / r seconds. The volume
of the bucket is b tokens. When a token appears, and the bucket is complete, the token is
discarded. If a packet of n bytes appears and n tokens are deleted from the bucket, the
packet is forwarded to the network.
When a packet of n bytes appears but fewer than n tokens are available. No tokens are
removed from the bucket in such a case, and the packet is considered non-conformant. The
14

non-conformant packets can either be dropped or queued for subsequent transmission


when sufficient tokens have accumulated in the bucket.
They can also be transmi ed but marked as being non-conformant. The possibility is that
they may be dropped subsequently if the network is overloaded.

The IP version 4 protocol


IPv4:
IPv4 is a connec onless protocol used for packet-switched networks. It operates on a best-
effort delivery model, in which neither delivery is guaranteed, nor proper sequencing or
avoidance of duplicate delivery is assured. Internet Protocol Version 4 (IPv4) is the fourth
revision of the Internet Protocol and a widely used protocol in data communica on over
different kinds of networks. IPv4 is a connec onless protocol used in packet-switched layer
networks, such as Ethernet. It provides a logical connec on between network devices by
providing iden fica on for each device. There are many ways to configure IPv4 with all kinds
of devices – including manual and automa c configura ons – depending on the network type.
IPv4 uses 32-bit addresses for Ethernet communica on in five classes: A, B, C, D and E. Classes
A, B and C have a different bit length for addressing the network host. Class D addresses are
reserved for mul cas ng, while class E addresses are reserved for military purposes. IPv4 uses
32-bit (4-byte) addressing, which gives 232 addresses. IPv4 addresses are wri en in the dot-
decimal nota on, which comprises of four octets of the address expressed individually in
decimal and separated by periods, for instance, 192.168.1.5.
15

Ipv4 header format:

 VERSION: Version of the IP protocol (4 bits), which is 4 for IPv4


 HLEN: IP header length (4 bits), which is the number of 32-bit words in the header. The
minimum value for this field is 5 and the maximum is 15.
 Type of service: Low Delay, High Throughput, Reliability (8 bits)
 Total Length: Length of header + Data (16 bits), which has a minimum value 20 bytes
and the maximum is 65,535 bytes.
 Iden fica on: Unique Packet Id for iden fying the group of fragments of a single IP
datagram (16 bits)
 Flags: 3 flags of 1 bit each: reserved bit (must be zero), do not fragment flag, more
fragments flag (same order)
 Fragment Offset: Represents the number of Data Bytes ahead of the par cular
fragment in the par cular Datagram. Specified in terms of number of 8 bytes, which
has the maximum value of 65,528 bytes.
 Time to live: Datagram’s life me (8 bits), It prevents the datagram to loop through the
network by restric ng the number of Hops taken by a Packet before delivering to the
Des na on.
 Protocol: Name of the protocol to which the data is to be passed (8 bits)
 Header Checksum: 16 bits header checksum for checking errors in the datagram
header
 Source IP address: 32 bits IP address of the sender
 Des na on IP address: 32 bits IP address of the receiver
 Op on: Op onal informa on such as source route, record route. Used by the Network
administrator to check whether a path is working or not.

Advantages of IPv4

 IPv4 security permits encryp on to keep up privacy and security.


 IPV4 network alloca on is significant and presently has quite 85000 prac cal routers.
16

 It becomes easy to a ach mul ple devices across an outsized network while not NAT.
 This is a model of communica on so provides quality service also as economical
knowledge transfer.

Limita ons of IPv4

 IP relies on network layer addresses to iden fy end-points on network, and each


network has a unique IP address.
 The world’s supply of unique IP addresses is dwindling, and they might eventually run
out theore cally.
 If there are mul ple hosts, we need IP addresses of next class.

Introduc on of Classful IP Addressing


h ps://www.geeksforgeeks.org/introduc on-of-classful-ip-addressing/

IP version 6
IPv6 was developed by Internet Engineering Task Force (IETF) to deal with the problem of IPv4
exhaus on. IPv6 is a 128-bits address having an address space of 2128, which is way bigger
than IPv4. IPv6 use Hexa-Decimal format separated by colon (:).
Components in Address format

 There are 8 groups and each group represents 2 Bytes (16-bits).


 Each Hex-Digit is of 4 bits (1 nibble)
 Delimiter used – colon (:)

Need for IPv6:


1. Large address space
An IPv6 address is 128 bits long. compared with the 32-bit address of IPv4, this is a huge (2
raised 96 mes) increases in the address space.
2. Be er header format
IPv6 uses a new header format in which op ons are separated from the base header and
inserted, when needed, between the base header and the upper layer data. This simplifies
and speeds up the rou ng process because most of the op ons do not need to be checked by
routers.
3. New op ons
17

IPv6 has new op ons to allow for addi onal func onali es.
4. Allowance for extension
IPv6 is designed to allow the extension of the protocol if required by new technologies or
applica ons.
5. Support for resource alloca on
In IPv6, the type of service field has been removed, but two new fields, traffic class and flow
label have been added to enables the source to request special handling of the packet. this
mechanism can be used to support traffic such as real- me audio and video.
6. Support for more security
The encryp on and authen ca on op ons in IPv6 provide confiden ality and integrity of the
packet.

In IPv6 representa on, we have three addressing methods

 Unicast
 Mul cast
 Anycast
Addressing methods
1. Unicast Address
Unicast Address iden fies a single network interface. A packet sent to a unicast address is
delivered to the interface iden fied by that address.

2. Mul cast Address


Mul cast Address is used by mul ple hosts, called as groups, acquires a mul cast des na on
address. These hosts need not be geographically together. If any packet is sent to this mul cast
address, it will be distributed to all interfaces corresponding to that mul cast address. And
every node is configured in the same way. In simple words, one data packet is sent to mul ple
des na ons simultaneously.

3. Anycast Address
Anycast Address is assigned to a group of interfaces. Any packet sent to an anycast address
will be delivered to only one member interface (mostly nearest host possible).
Note: Broadcast is not defined in IPv6.
18

Ipv6 header format:

 Version (4-bits): It represents the version of Internet Protocol, i.e., 0110.


 Traffic Class (8-bits): These 8 bits are divided into two parts. The most significant 6 bits
are used for Type of Service to let the Router Known what services should be provided
to this packet. The least significant 2 bits are used for Explicit Conges on No fica on
(ECN).
 Flow Label (20-bits): This label is used to maintain the sequen al flow of the packets
belonging to a communica on. The source labels the sequence to help the router
iden fy that a par cular packet belongs to a specific flow of informa on. This field
helps avoid re-ordering of data packets. It is designed for streaming/real- me media.
 Payload Length (16-bits): This field is used to tell the routers how much informa on a
par cular packet contains in its payload. Payload is composed of Extension Headers
and Upper Layer data. With 16 bits, up to 65535 bytes can be indicated; but if the
Extension Headers contain Hop-by-Hop Extension Header, then the payload may
exceed 65535 bytes and this field is set to 0
 Next Header (8-bits): This field is used to indicate either the type of Extension Header,
or if the Extension Header is not present then it indicates the Upper Layer PDU. The
values for the type of Upper Layer PDU are same as IPv4’s.
 Hop Limit (8-bits): This field is used to stop packet to loop in the network infinitely.
This is same as TTL in IPv4. The value of Hop Limit field is decremented by 1 as it passes
a link (router/hop). When the field reaches 0 the packet is discarded.
 Source Address (128-bits): This field indicates the address of originator of the packet.
 Des na on Address (128-bits): This field provides the address of intended recipient of
the packet.
19

Extension Headers
In IPv6, the Fixed Header contains only that much informa on which is necessary, avoiding
that informa on which is either not required or is rarely used. All such informa on is put
between the Fixed Header and the Upper layer header in the form of Extension Headers. Each
Extension Header is iden fied by a dis nct value.
When Extension Headers are used, IPv6 Fixed Header’s Next Header field points to the first
Extension Header. If there is one more Extension Header, then the first Extension Header’s
‘Next-Header’ field points to the second one, and so on. The last Extension Header’s ‘Next-
Header’ field points to the Upper Layer Header. Thus, all the headers’ points to the next one
in a linked list manner.
If the Next Header field contains the value 59, it indicates that there are no headers a er this
header, not even Upper Layer Header.
The following Extension Headers must be supported as per RFC 2460:

Extension Headers are arranged one a er another in a linked list manner, as depicted in the
following diagram:
20

IP addresses
All the computers of the world on the Internet network communicate with each other with
underground or underwater cables or wirelessly. If I want to download a file from the internet
or load a web page or literally do anything related to the internet, my computer must have an
address so that other computers can find and locate mine in order to deliver that par cular
file or webpage that I am reques ng. In technical terms, that address is called IP Address or
Internet Protocol Address.
Let us understand it with another example, like if someone wants to send you a mail then
he/she must have your home address. Similarly, your computer too needs an address so that
other computers on the internet can communicate with each other without the confusion of
delivering informa on to someone else’s computer. And that is why each computer in this
world has a unique IP Address. Or in other words, an IP address is a unique address that is
used to iden fy computers or nodes on the internet. This address is just a string of numbers
wri en in a certain format. It is generally expressed in a set of numbers for example
192.155.12.1. Here each number in the set is from 0 to 255 range. Or we can say that a full IP
address ranges from 0.0.0.0 to 255.255.255.255. And these IP addresses are assigned by IANA
(known as Internet Corpora on for Internet Assigned Numbers Authority).

Working of IP addresses
It can also use some set of rules to send informa on. Using these protocols, we can easily
send, and receive data or files to the connected devices. There are several steps behind the
scenes. Let us look at them

 Your device directly requests your Internet Service Provider which then grants your
device access to the web.
 And an IP Address is assigned to your device from the given range available.
 Your internet ac vity goes through your service provider, and they route it back to you,
using your IP address.
 Your IP address can change. For example, turning your router on or off can change your
IP Address.
 When you are out from your home loca on your home IP address doesn’t accompany
you. It changes as you change the network of your device.

Types of IP Address
IP Address is of two types:
1. IPv4:
21

Internet Protocol version 4. It consists of 4 numbers separated by the dots. Each number can
be from 0-255 in decimal numbers. But computers do not understand decimal numbers, they
instead change them to binary numbers which are only 0 and 1. Therefore, in binary, this (0-
255) range can be wri en as (00000000 – 11111111). Since each number N can be
represented by a group of 8-digit binary digits. So, a whole IPv4 binary address can be
represented by 32-bits of binary digits. In IPv4, a unique sequence of bits is assigned to a
computer, so a total of (2^32) devices approximately = 4,294,967,296 can be assigned with
IPv4.
IPv4 can be wri en as:
189.123.123.90

2. IPv6:
But there is a problem with the IPv4 address. With IPv4, we can connect only the above
number of 4 billion devices uniquely, and apparently, there are much more devices in the
world to be connected to the internet. So, gradually we are making our way to IPv6 Address
which is a 128-bit IP address. In human-friendly form, IPv6 is wri en as a group of 8
hexadecimal numbers separated with colons (:). But in the computer-friendly form, it can be
wri en as 128 bits of 0s and 1s. Since, a unique sequence of binary digits is given to
computers, smartphones, and other devices to be connected to the internet. So, via IPv6 a
total of (2^128) devices can be assigned with unique addresses which are actually more than
enough for upcoming future genera ons.
IPv6 can be wri en as:
2011:0bd9:75c5:0000:0000:6b3e:0170:8394

Classifica on of IP Address
An IP address is classified into the following types:
1. Public IP Address:
This address is available publicly and it is assigned by your network provider to your router,
which further divides it to your devices. Public IP Addresses are of two types,

 Dynamic IP Address: When you connect a smartphone or computer to the internet,


your Internet Service Provider provides you an IP Address from the range of available
IP Addresses. Now, your device has an IP Address and you can simply connect your
device to the Internet and send and receive data to and from your device. The very
next me when you try to connect to the internet with the same device, your provider
provides you with different IP Addresses to the same device and also from the same
22

available range. Since IP Address keeps on changing every me when you connect to
the internet, it is called a Dynamic IP Address.
 Sta c IP Address: Sta c address never changes. They serve as a permanent internet
address. These are used by DNS servers. What are DNS servers? Actually, these are
computers that help you to open a website on your computer. Sta c IP Address
provides informa on such as device is located on which con nent, which country,
which city, and which Internet Service Provider provides internet connec on to that
par cular device. Once, we know who is the ISP, we can trace the loca on of the device
connected to the internet. Sta c IP Addresses provide less security than Dynamic IP
Addresses because they are easier to track.

2. Private IP Address:
This is an internal address of your device which are not routed to the internet and no exchange
of data can take place between a private address and the internet.

3. Shared IP addresses:
Many websites use shared IP addresses where the traffic is not huge and very much
controllable, they decide to rent it to other similar websites so to make it cost-friendly. Several
companies and email sending servers use the same IP address (within a single mail server) to
cut down the cost so that they could save for the me the server is idle.

4. Dedicated IP addresses:
A dedicated IP Address is an address used by a single company or an individual which gives
them certain benefits using a private Secure Sockets Layer (SSL) cer ficate which is not in the
case of a shared IP address. It allows to access the website or log in via File Transfer Protocol
(FTP) by IP address instead of its domain name. It increases the performance of the website
when the traffic is high. It also protects from a shared IP address that is black-listed due to
spam.

Introduc on of Classful IP Addressing


IP address is an address having informa on about how to reach a specific host, especially
outside the LAN. An IP address is a 32 bit unique address having an address space of 232.
Generally, there are two nota ons in which IP address is wri en, do ed decimal nota on and
hexadecimal nota on.
23

Do ed Decimal Nota on:

Some points to be noted about do ed decimal nota on:

 The value of any segment (byte) is between 0 and 255 (both included).
 There are no zeroes preceding the value in any segment (054 is wrong, 54 is correct).

Classful Addressing
The 32-bit IP address is divided into five sub-classes. These are:
Class A
Class B
Class C
Class D
Class E
Each of these classes has a valid range of IP addresses. Classes D and E are reserved for
mul cast and experimental purposes respec vely. The order of bits in the first octet
determines the classes of IP address.
IPv4 address is divided into two parts:

 Network ID
 Host ID
The class of IP address is used to determine the bits used for network ID and host ID and the
number of total networks and hosts possible in that par cular class. Each ISP or network
administrator assigns IP address to each device that is connected to its network.
24

Class A:
IP address belonging to class A are assigned to the networks that contain a large number of
hosts.

 The network ID is 8 bits long.


 The host ID is 24 bits long.
The higher order bit of the first octet in class A is always set to 0. The remaining 7 bits in first
octet are used to determine network ID. The 24 bits of host ID are used to determine the host
in any network. The default subnet mask for class A is 255.x.x.x. Therefore, class A has a total
of:

 2^7-2= 126 network ID (Here 2 address is subtracted because 0.0.0.0 and 127.x.y.z are
special address.)
 2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 1.x.x.x – 126.x.x.x
25

Class B:
IP address belonging to class B are assigned to the networks that ranges from medium-sized
to large-sized networks.

 The network ID is 16 bits long.


 The host ID is 16 bits long.
The higher order bits of the first octet of IP addresses of class B are always set to 10. The
remaining 14 bits are used to determine network ID. The 16 bits of host ID is used to determine
the host in any network. The default sub-net mask for class B is 255.255.x.x. Class B has a total
of:

 2^14 = 16384 network address


 2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.x.x – 191.255.x.x.

Class C:
IP address belonging to class C are assigned to small-sized networks.

 The network ID is 24 bits long.


 The host ID is 8 bits long.
The higher order bits of the first octet of IP addresses of class C are always set to 110. The
remaining 21 bits are used to determine network ID. The 8 bits of host ID is used to determine
the host in any network. The default sub-net mask for class C is 255.255.255.x. Class C has a
total of:

 2^21 = 2097152 network address


 2^8 – 2 = 254 host address
IP addresses belonging to class C ranges from 192.0.0.x – 223.255.255.x.
26

Class D:
IP address belonging to class D are reserved for mul -cas ng. The higher order bits of the first
octet of IP addresses belonging to class D are always set to 1110. The remaining bits are for
the address that interested hosts recognize.
Class D does not possess any sub-net mask. IP addresses belonging to class D ranges from
224.0.0.0 – 239.255.255.255.

Class E:
IP addresses belonging to class E are reserved for experimental and research purposes. IP
addresses of class E ranges from 240.0.0.0 – 255.255.255.254. This class doesn’t have any sub-
net mask. The higher order bits of first octet of class E are always set to 1111.

Summary of Classful addressing:


27

Problems with Classful Addressing:


The problem with this classful addressing method is that millions of class A address are
wasted, many of the class B address are wasted, whereas, number of addresses available in
class C is so small that it cannot cater the needs of organiza ons. Class D addresses are used
for mul cast rou ng and are therefore available as a single block only. Class E addresses are
reserved.
Since there are these problems, Classful networking was replaced by Classless Inter-Domain
Rou ng (CIDR) in 1993.

OSPF
h ps://www.scaler.com/topics/ospf-protocol/
h ps://www.javatpoint.com/ospf-protocol

BGP
h ps://www.scaler.com/topics/computer-network/bgp-border-gateway-protocol/
1
UNIT-4
UNIT- IV: TRANSPORT LAYER
UDP – Segment header, Remote procedure call, Real- me transport protocols; TCP – service
model, Protocol, Segment header, Connec on establishment, Connec on release, Sliding
window, Timer management, Conges on control.

UDP – Segment header:


User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of the Internet
Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is an unreliable and connectionless
protocol. So, there is no need to establish a connection prior to data transfer. The UDP helps to
establish low-latency and loss-tolerating connections establish over the network. The UDP
enables process to process communication.
Though Transmission Control Protocol (TCP) is the dominant transport layer protocol used
with most of the Internet services; provides assured delivery, reliability, and much more but all
these services cost us additional overhead and latency. Here, UDP comes into the picture. For
real-time services like computer gaming, voice or video communication, live conferences; we
need UDP. Since high performance is needed, UDP permits packets to be dropped instead of
processing delayed packets. There is no error checking in UDP, so it also saves bandwidth.
User Datagram Protocol (UDP) is more efficient in terms of both latency and bandwidth.

UDP Header –
UDP header is an 8-bytes fixed and simple header, while for TCP it may vary from 20 bytes to
60 bytes. The first 8 Bytes contains all necessary header information and the remaining part
consist of data. UDP port number fields are each 16 bits long, therefore the range for port
numbers is defined from 0 to 65535; port number 0 is reserved. Port numbers help to distinguish
different user requests or processes.
2
UNIT-4
Source Port: Source Port is a 2 Byte long field used to identify the port number of the
source.
Destination Port: It is a 2 Byte long field, used to identify the port of the destined packet.
Length: Length is the length of UDP including the header and the data. It is a 16-bits
field.
Checksum: Checksum is 2 Bytes long field. It is the 16-bit one’s complement of the
one’s complement sum of the UDP header, the pseudo-header of information from the
IP header, and the data, padded with zero octets at the end (if necessary) to make a
multiple of two octets.
Notes – Unlike TCP, the Checksum calculation is not mandatory in UDP. No Error control or
flow control is provided by UDP. Hence UDP depends on IP and ICMP for error reporting.
Also, UDP provides port numbers so that is can differentiate between users’ requests.

Applications of UDP:
 Used for simple request-response communication when the size of data is less and
hence there is lesser concern about flow and error control.
 It is a suitable protocol for multicasting as UDP supports packet switching.
 UDP is used for some routing update protocols like RIP (Routing Information
Protocol).
 Normally used for real-time applications which cannot tolerate uneven delays
between sections of a received message.

Advantages of UDP:
1. Speed: UDP is faster than TCP because it does not have the overhead of establishing a
connection and ensuring reliable data delivery.
2. Lower latency: Since there is no connection establishment, there is lower latency and faster
response time.
3. Simplicity: UDP has a simpler protocol design than TCP, making it easier to implement
and manage.

Disadvantages of UDP:
1. No reliability: UDP does not guarantee delivery of packets or order of delivery, which can
lead to missing or duplicate data.
2. No congestion control: UDP does not have congestion control, which means that it can
send packets at a rate that can cause network congestion.
3. No flow control: UDP does not have flow control, which means that it can overwhelm the
receiver with packets that it cannot handle.
3
UNIT-4
Remote Procedure Call (RPC):
A remote procedure call is an inter process communication technique that is used for client-
server-based applications. It is also known as a subroutine call or a function call.
A client has a request message that the RPC translates and sends to the server. This request may
be a procedure or a function call to a remote server. When the server receives the request, it
sends the required response back to the client. The client is blocked while the server is
processing the call and only resumed execution after the server is finished.

The sequence of events in a remote procedure call are given as follows −


 The client stub (A network which has only one entry and exit point) is called by the
client.
 The client stub makes a system call to send the message to the server and puts the
parameters in the message.
 The message is sent from the client to the server by the client’s operating system.
 The message is passed to the server stub by the server operating system.
 The parameters are removed from the message by the server stub.
 Then, the server procedure is called by the server stub.
A diagram that demonstrates this is as follows –

Advantages of Remote Procedure Call:


Some of the advantages of RPC are as follows −
 Remote procedure calls support process oriented and thread-oriented models.
 The internal message passing mechanism of RPC is hidden from the user.
 The effort to re-write and re-develop the code is minimum in remote procedure calls.
4
UNIT-4
Disadvantages of Remote Procedure Call:
Some of the disadvantages of RPC are as follows −
 The remote procedure call is a concept that can be implemented in different ways. It is
not a standard.
 There is no flexibility in RPC for hardware architecture. It is only interaction based.
 There is an increase in costs because of remote procedure call.

Real Time Transport Protocol (RTP):


A protocol is designed to handle real-time traffic (like audio and video) of the Internet, is known
as Real Time Transport Protocol (RTP). RTP must be used with UDP. It does not have any
delivery mechanism like multicasting or port numbers. RTP supports different formats of files
like MPEG and MJPEG. It is very sensitive to packet delays and less sensitive to packet loss.
History of RTP: This protocol is developed by Internet Engineering Task Force (IETF) of four
members:
 S. Casner (Packet Design)
 V. Jacobson (Packet Design)
 H. Schulzrinne (Columbia University)
 R. Frederick (Blue Coat Systems Inc.)
Applications of RTP:
 RTP mainly helps in media mixing, sequencing and time-stamping.
 Voice over Internet Protocol (VoIP)
 Video Teleconferencing over Internet.
 Internet Audio and video streaming.
RTP Header Format: The diagram of header format of RTP packet is shown below:
5
UNIT-4
The header format of RTP is very simple and it covers all real-time applications. The
explanation of each field of header format is given below:
Version: This 2-bit field defines version number. The current version is 2.
P – The length of this field is 1-bit. If value is 1, then it denotes presence of padding (Bits or
characters that fill up unused portions of a data structure, such as a field, packet or frame.
Typically, padding is done at the end of the structure to fill it up with data, with the padding
usually consisting of 1 bits, blank characters or null characters.) at end of packet and if value
is 0, then there is no padding.
X – The length of this field is also 1-bit. If value of this field is set to 1, then its indicates an
extra extension header between data and basic header and if value is 0 then, there is no extra
extension.
Contributor count – This 4-bit field indicates number of contributors. Here maximum possible
number of contributors is 15 as a 4-bit field can allows number from 0 to 15.
M – The length of this field is 1-bit and it is used as end marker by application to indicate end
of its data.
Payload types – This field is of length 7-bit to indicate type of payload. We list applications of
some common types of payloads.
Sequence Number – The length of this field is 16 bits. It is used to give serial numbers to RTP
packets. It helps in sequencing. The sequence number for first packet is given a random number
and then every next packet’s sequence number is incremented by 1. This field mainly helps in
checking lost packets and order mismatch.
Time Stamp – The length of this field is 32-bit. It is used to find relationship between times of
different RTP packets. The timestamp for first packet is given randomly and then time stamp
for next packets given by sum of previous timestamp and time taken to produce first byte of
current packet. The value of 1 clock tick is varying from application to application.
Synchronization Source Identifier – This is a 32-bit field used to identify and define the source.
The value for this source identifier is a random number that is chosen by source itself. This
mainly helps in solving conflict arises when two sources started with the same sequencing
number.
Contributor Identifier – This is also a 32-bit field used for source identification where there is
more than one source present in session. The mixer source use Synchronization source
identifier and other remaining sources (maximum 15) use Contributor identifier.

TCP – service model:


 TCP service is obtained by both the sender and the receiver creating end points, called
sockets.
 Each socket has a socket number (address) consisting of the IP address of the host and
a 16-bit number local to that host, called a port.
6
UNIT-4
 A port is the TCP name for a TSAP: A Transport Services Access Point is an end-point
for communication between the Transport layer and the Session layer in the OSI (Open
Systems Interconnection) reference model.
 Each TSAP is an address that uniquely identifies a specific instantiation of a service.
 TSAPs are created by concatenating the node's Network Service Access Point (NSAP)
with a transport identifier, and sometimes a packet and/or protocol type.
We explain some of the sockets calls with their respectful meaning in the following table. It
also should know that TCP does not support multicasting & broadcasting.

Different Socket Calls:


The table given below explains the socket calls in TCP service model –

 Port numbers below 1024 are reserved for standard services that can usually only be
started by privileged users (e.g., root in UNIX systems).
 They are called well-known ports.
7
UNIT-4

 Secure Shell (SSH) is a cryptographic network protocol for opera ng network services
securely over an unsecured network
 IMAP (Internet Message Access Protocol) is a standard email protocol that stores email
messages on a mail server, but allows the end user to view and manipulate the
messages as though they were stored locally on the end user's compu ng device(s).
 The Real Time Streaming Protocol (RTSP) is a network control protocol designed for
use in entertainment and communica ons systems to control streaming media
servers. The protocol is used for establishing and controlling media sessions between
end points.
 The Internet Prin ng Protocol (IPP) is a specialized Internet protocol for
communica on between client devices (computers, mobile phones, tablets, etc.) and
printers
All TCP connec ons are full duplex and point-to-point.

 Full duplex means that traffic can go in both direc ons at the same me.
 Point-to-point means that each connec on has exactly two end points.

 TCP does not support Mul cas ng or Broadcas ng.


 A TCP connec on is a byte stream, not a message stream.
 Message boundaries are not preserved end to end.

TCP-Protocol:
TCP (Transmission Control Protocol) is one of the main protocols of the Internet protocol suite.
It lies between the Application and Network Layers which are used in providing reliable
delivery services. It is a connection-oriented protocol for communications that helps in the
exchange of messages between different devices over a network. The Internet Protocol (IP),
which establishes the technique for sending data packets between computers, works with TCP.
8
UNIT-4
Working of TCP:
To make sure that each message reaches its target location intact, the TCP/IP model breaks
down the data into small bundles and afterward reassembles the bundles into the original
message on the opposite end. Sending the information in little bundles of information makes
it simpler to maintain efficiency as opposed to sending everything in one go.
After a particular message is broken down into bundles, these bundles may travel along
multiple routes if one route is jammed but the destination remains the same.

For example, In TCP, the connection is established by using three-way handshaking. The
client sends the segment with its sequence number. The server, in return, sends its segment
with its own sequence number as well as the acknowledgement sequence, which is one more
than the client sequence number. When the client receives the acknowledgment of its
segment, then it sends the acknowledgment to the server. In this way, the connection is
established between the client and the server.
Features of TCP/IP
Some of the most prominent features of Transmission control protocol are
1. Segment Numbering System
TCP keeps track of the segments being transmitted or received by assigning numbers to each
and every single one of them.
A specific Byte Number is assigned to data bytes that are to be transferred while segments are
assigned sequence numbers.
Acknowledgment Numbers are assigned to received segments.
9
UNIT-4
2. Connection Oriented
It means sender and receiver are connected to each other till the completion of the process.
The order of the data is maintained i.e., order remains same before and after transmission.
3. Full Duplex
In TCP data can be transmitted from receiver to the sender or vice – versa at the same time.
It increases efficiency of data flow between sender and receiver.
4. Flow Control
Flow control limits the rate at which a sender transfers data. This is done to ensure reliable
delivery.
The receiver continually hints to the sender on how much data can be received (using a
sliding window)
5. Error Control
TCP implements an error control mechanism for reliable data transfer
Error control is byte-oriented
Segments are checked for error detection
Error Control includes – Corrupted Segment & Lost Segment Management, Out-of-order
segments, Duplicate segments, etc.
6. Congestion Control
TCP takes into account the level of congestion in the network
Congestion level is determined by the amount of data sent by a sender

Advantages:
 It is a reliable protocol.
 It provides an error-checking mechanism as well as one for recovery.
 It gives flow control.
 It makes sure that the data reaches the proper destination in the exact order that it was
sent.
 Open Protocol, not owned by any organization or individual.

Disadvantages:
 TCP is made for Wide Area Networks; thus, its size can become an issue for small
networks with low resources.
 TCP runs several layers so it can slow down the speed of the network.
10
UNIT-4
 It is not generic in nature. Meaning, it cannot represent any protocol stack other than
the TCP/IP suite. E.g., it cannot work with a Bluetooth connection.
 No modifications since their development around 30 years ago.

TCP Segment structure


A TCP segment consists of data bytes to be sent and a header that is added to the data by TCP
as shown:

The header of a TCP segment can range from 20-60 bytes. 40 bytes are for options. If there
are no options, a header is 20 bytes else it can be of upmost 60 bytes.
Header fields:
Source Port Address –
A 16-bit field that holds the port address of the application that is sending the data segment.

Destination Port Address –


11
UNIT-4
A 16-bit field that holds the port address of the application in the host that is receiving the
data segment.

Sequence Number –
A 32-bit field that holds the sequence number, i.e., the byte number of the first byte that is
sent in that particular segment. It is used to reassemble the message at the receiving end of
the segments that are received out of order.

Acknowledgement Number –
A 32-bit field that holds the acknowledgement number, i.e., the byte number that the receiver
expects to receive next. It is an acknowledgement for the previous bytes being received
successfully.

Header Length (HLEN) –


This is a 4-bit field that indicates the length of the TCP header by a number of 4-byte words
in the header, i.e., if the header is 20 bytes (min length of TCP header), then this field will
hold 5 (because 5 x 4 = 20) and the maximum length: 60 bytes, then it’ll hold the value
15(because 15 x 4 = 60). Hence, the value of this field is always between 5 and 15.

Control flags –
These are 6 1-bit control bits that control connection establishment, connection termination,
connection abortion, flow control, mode of transfer etc. Their function is:
 URG: Urgent pointer is valid
 ACK: Acknowledgement number is valid (used in case of cumulative
acknowledgement)
 PSH: Request for push
 RST: Reset the connection
 SYN: Synchronize sequence numbers
 FIN: Terminate the connection

Window size –
This field tells the window size of the sending TCP in bytes.

Checksum –
This field holds the checksum for error control. It is mandatory in TCP as opposed to UDP.
12
UNIT-4
Urgent pointer –
This field (valid only if the URG control flag is set) is used to point to data that is urgently
required that needs to reach the receiving process at the earliest. The value of this field is
added to the sequence number to get the byte number of the last urgent byte.

TCP Connection Establishment:


TCP is a connection-oriented protocol and every connection-oriented protocol needs to
establish a connection in order to reserve resources at both the communicating ends.
Connection Establishment –
1.Sender starts the process with the following:
 Sequence number (Seq=521):
contains the random initial sequence number generated at the sender side.
 Syn flag (Syn=1):
request the receiver to synchronize its sequence number with the above-provided sequence
number.
 Maximum segment size (MSS=1460 B):
sender tells its maximum segment size, so that receiver sends datagram which won’t require
any fragmentation. MSS field is present inside Option field in TCP header.
 Window size (window=14600 B):
sender tells about his buffer capacity in which he has to store messages from the receiver.

2. TCP is a full-duplex protocol so both sender and receiver require a window for
receiving messages from one another.
 Sequence number (Seq=2000):
contains the random initial sequence number generated at the receiver side.
 Syn flag (Syn=1):
request the sender to synchronize its sequence number with the above-provided sequence
number.
 Maximum segment size (MSS=500 B):
receiver tells its maximum segment size, so that sender sends datagram which won’t require
any fragmentation. MSS field is present inside Option field in TCP header.
13
UNIT-4
Since MSS receiver < MSS sender, both parties agree for minimum MSS i.e., 500 B to avoid
fragmentation of packets at both ends.
 Window size (window=10000 B):
receiver tells about his buffer capacity in which he has to store messages from the sender.
 Acknowledgement Number (Ack no.=522):
Since sequence number 521 is received by the receiver so, it makes a request for the next
sequence number with Ack no.=522 which is the next packet expected by the receiver since
Syn flag consumes 1 sequence no.
 ACK flag (ACk=1):
tells that the acknowledgement number field contains the next sequence expected by the
receiver.

3. Sender makes the final reply for connection establishment in the following way:
 Sequence number (Seq=522):
since sequence number = 521 in 1st step and SYN flag consumes one sequence number
hence, the next sequence number will be 522.
 Acknowledgement Number (Ack no.=2001):
since the sender is acknowledging SYN=1 packet from the receiver with sequence number
2000 so, the next sequence number expected is 2001.
 ACK flag (ACK=1):
tells that the acknowledgement number field contains the next sequence expected by the
sender.
14
UNIT-4

TCP Connection Termination(release):


In TCP 3-way Handshake Process we studied that how connections are established between
client and server in Transmission Control Protocol (TCP) using SYN bit segments. In this
article, we will study how TCP close connection between Client and Server. Here we will
also need to send bit segments to a server which FIN bit is set to 1.

TCP supports two types of connection releases like most connection-oriented transport
protocols:
1) Graceful connection release –
In the Graceful connection release, the connection is open until both parties have closed their
sides of the connection.

2) Abrupt connection release –


15
UNIT-4
In an Abrupt connection release, either one TCP entity is forced to close the connection or
one user closes both directions of data transfer.

Abrupt connection release:


An abrupt connection release is carried out when an RST segment is sent. An RST segment
can be sent for the below reasons:
 When a non-SYN segment was received for a non-existing TCP connection.
 In an open connection, some TCP implementations send an RST segment when a
segment with an invalid header is received. This will prevent attacks by closing the
corresponding connection.
 When some implementations need to close an existing TCP connection, they send an
RST segment. They will close an existing TCP connection for the following reasons:
1) Lack of resources to support the connection
2) The remote host is now unreachable and has stopped responding.

When a TCP entity sends an RST segment, it should contain 00 if it does not belong to any
existing connection else it should contain the current value of the sequence number for the
connection and the acknowledgment number should be set to the next expected in- sequence
number on this connection.

Graceful Connection Release:


The common way of terminating a TCP connection is by using the TCP header’s FIN flag.
This mechanism allows each host to release its own side of the connection individually.
16
UNIT-4

How mechanism works In TCP:


Step 1 (FIN From Client) –
Suppose that the client application decides it wants to close the connection. (Note that the
server could also choose to close the connection). This causes the client to send a TCP
segment with the FIN bit set to 1 to the server and to enter the FIN_WAIT_1 state. While in
the FIN_WAIT_1 state, the client waits for a TCP segment from the server with an
acknowledgment (ACK).
Step 2 (ACK From Server) –
When the Server received the FIN bit segment from Sender (Client), Server Immediately
sends acknowledgement (ACK) segment to the Sender (Client).
Step 3 (Client waiting) –
While in the FIN_WAIT_1 state, the client waits for a TCP segment from the server with an
acknowledgment. When it receives this segment, the client enters the FIN_WAIT_2 state.
While in the FIN_WAIT_2 state, the client waits for another segment from the server with the
FIN bit set to 1.
Step 4 (FIN from Server) –
The server sends the FIN bit segment to the Sender (Client) after some time when the Server
sends the ACK segment (because of some closing process in the Server).
Step 5 (ACK from Client) –
When the Client receives the FIN bit segment from the Server, the client acknowledges the
server’s segment and enters the TIME_WAIT state. The TIME_WAIT state lets the client
resend the final acknowledgment in case the ACK is lost. The time spent by clients in the
TIME_WAIT state depends on their implementation, but their typical values are 30 seconds,
1 minute, and 2 minutes. After the wait, the connection formally closes and all resources on
the client-side (including port numbers and buffer data) are released.

TCP Timers:
Various types of TCP timers are used for making sure that excessive delay in the transmission
of data is not encountered when communication begins. Most of these timers are delicate and
handle issues that are not found immediately at the first analysis of the transmission of data.
Look at the below section to know about how the timer makes sure proper data transfers from
one end to another.
17
UNIT-4
1) Time Out Timer or Retransmission Timer:
 A timeout timer begins, when the sender transmits a segment to the receiver.
 Before expiring the timer, if the ACK is received, then nothing is lost.
 Otherwise, that particular segment is considered lost and it becomes necessary to
retransmit the segment again and restart the timer.
 It is required to look at the various RTTs for finding out how the retransmission
timeout interval is being calculated.

Measured RTT(RTTm)
The time needed by the segment to reach the destination and also get acknowledgement, even
though the acknowledgement includes another segment also, is known as measured round-
trip time (RTTm).

Smoothed RTT(RTTs)
The average weight of RTTm is known as smoothed RTT (RTTs). There is a possibility of
changes in RTTm and its fluctuation is very high that's why RTO cannot be calculated using a
single measurement.

Deviated RTT(RTTd)
RTTs alone are not used by most implementation. So, for finding the RTO (Retransmission
Time Out) RTT deviated also needs to be calculated.

2) Time Wait Timer:


 Time Wait Timer is one of the TCP timers that is used at the time of connection
termination.
 After transmitting the last ACK for the second FIN, the sender begins the time wait
timer and terminates the TCP connection.
 When the TCP connection is closed, there is a possibility that some datagrams still try
to make their way using the internet so that they can access the closed port.
 The quiet timer is designed so that it can prevent just a closed port to reopen again
quickly.
 Generally, the quiet timer is set to twice the maximum segment lifeline so that it
makes sure that all the segments still heading for the port must be terminated.

3) Keep Alive Timer:


 The keep alive timer is used by the TCP for preventing the long idle connections
between the TCPs.
18
UNIT-4
 Keep alive timer is used in the situation when the client starts a TCP connection for
transmitting data to the server, and after some time stops sending the data, then the
connection opens forever.
 Whenever the server hears from the client, the server resets the keep-alive timer for 2
hours.
 Sometimes the condition occurs when the server does not hear from the client for 2
hours, then 10 probe segments are transmitted by the server to the client.
 The server transmits these probe segments at a time interval of 75 seconds.
 After transmitting these segments, if the server does not get any response from the
client, then it is supposed that the client seems to be down.
 When the client seems to be down, the connection is discarded by the server
automatically.

4) Persistent Timer:
 The persistent timer is one of the TCP timers used in TCP for dealing with one of the
deadlock situations,i.e. zero-window-size deadlock situations.
 If the other end closes its receiver window, then also it keeps the window size
information flowing.
 Whenever the sender receives an ACK from the receiver side with a zero window
size, then it begins the persistent timer.
 In this situation, when the persistent timer goes off, then the sender transmits the
special type of segment to the receiver.
 This special type of segment is commonly known as the probe segment and this
special type of segment has only 1 byte of new data.
 The sequence number of this segment is never acknowledged.
 This sequence number is also not considered even when calculating the sequence
number for the rest data.
 When the receiver transmits the response to the probe segment, then through this
response the window size updates.
 If it is found that the updated window size is non-zero, then it represents that the data
can be transmitted now.
 And if the size of the updated window is still found to be zero, then the persistent
timer needs to be set again and this process continues till we get a non-zero window
size.

Congestion control:
Before understanding what is TCP congestion control, let’s first understand what you mean
by congestion in the TCP network. Congestion is an important factor in packet switched
network. It refers to the state of a network where the message traffic becomes so heavy that
the network response time slows down leading to the failure of the packet. It leads to packet
19
UNIT-4
loss. Due to this, it is necessary to control the congestion in the network, however, it cannot
be avoided.
TCP congestion control refers to the mechanism that prevents congestion from happening or
removes it after congestion takes place. When congestion takes place in the network, TCP
handles it by reducing the size of the sender’s window. The window size of the sender is
determined by the following two factors:
 Receiver window size
 Congestion window size

Approaches for Congestion Control:

Congestion in TCP is handled by using these three phases:


 Slow Start
 Congestion Avoidance
 Congestion Detection

1) Slow Start Phase:


In the slow start phase, the sender sets congestion window size = maximum segment size (1
MSS) at the initial stage. The sender increases the size of the congestion window by 1 MSS
after receiving the ACK (acknowledgment). The size of the congestion window increases
exponentially in this phase. The formula for determining the size of the congestion window is
Congestion window size = Congestion window size + Maximum segment size
1
UNIT-5
UNIT- V: APPLICATION LAYER
Domain Name System (DNS) - Name space, Domain resource records, Name servers;
Electronic mail - Architecture and services, User agent, Message formats, Message transfer,
Final delivery; The World Wide Web - Architectural overview, HTTP, FTP

Domain Name System (DNS):


An application layer protocol defines how the application processes running on different
systems, pass the messages to each other.
 DNS stands for Domain Name System.
 DNS is a directory service that provides a mapping between the name of a host on the
network and its numerical address.
 DNS is required for the functioning of the internet.
 Each node in a tree has a domain name, and a full domain name is a sequence of
symbols specified by dots.
 DNS is a service that translates the domain name into IP addresses. This allows the
users of networks to utilize user-friendly names when looking for other hosts instead of
remembering the IP addresses.
 For example, suppose the FTP site at Edu Soft had an IP address of 132.147.165.50,
most people would reach this site by specifying ftp.EduSoft.com. Therefore, the domain
name is more reliable than IP address.

(DNS) - Name space:


DNS is a TCP/IP protocol used on different platforms. The domain name space is divided into
three different sections: generic domains, country domains, and inverse domain.
2
UNIT-5

The DNS name space refers to the hierarchical structure of domain names that are used to
identify resources on the internet. It is a distributed database that organizes domain names into
a tree-like structure, allowing for efficient and scalable domain name resolution.
1) Generic Domains:
 It defines the registered hosts according to their generic behaviour.
 Each node in a tree defines the domain name, which is an index to the DNS database.
 It uses three-character labels, and these labels describe the organization type.
3
UNIT-5

2) Country Domain:
The format of country domain is same as a generic domain, but it uses two-character country
abbreviations (e.g., us for the United States) in place of three-character organizational
abbreviations.

3) Inverse Domain:
The inverse domain is used for mapping an address to a name. When the server has received a
request from the client, and the server contains the files of only authorized clients. To determine
whether the client is on the authorized list or not, it sends a query to the DNS server and ask
for mapping an address to the name.

Working of DNS:
 DNS is a client/server network communication protocol. DNS clients send requests to
the. server while DNS servers send responses to the client.
 Client requests contain a name which is converted into an IP address known as a
forward DNS lookups while requests containing an IP address which is converted into
a name known as reverse DNS lookups.
 DNS implements a distributed database to store the name of all the hosts available on
the internet.
4
UNIT-5
 If a client like a web browser sends a request containing a hostname, then a piece of
software such as DNS resolver sends a request to the DNS server to obtain the IP
address of a hostname. If DNS server does not contain the IP address associated with a
hostname, then it forwards the request to another DNS server. If IP address has arrived
at the resolver, which in turn completes the request over the internet protocol.

DNS Resource Records:


 DNS records (short for "Domain Name System records") are types of data that are
stored in the DNS database and used to specify information about a domain, such as its
IP address and the servers that handle its email. There are several different types of
DNS records, including A records, MX records, CNAME records, and others, each with
its own specific purpose.
 A record (short for "address record") maps a domain or subdomain to an IP address. For
example, the domain "example.com" might have an A record that maps it to the IP
address "192.0.2.1". When someone types "example.com" into their web browser, the
browser will use the A record to find the corresponding IP address and connect to the
server at that location.
 MX records (short for "mail exchange records") are used to route email for a domain to
the correct email server. Each MX record specifies a hostname and a priority value. The
hostname is the domain name of the server that should handle email for the domain,
and the priority value is used to specify which server should be used first if there are
multiple servers available.
 CNAME records (short for "canonical name records") are used to create aliases for
domains. For example, if you have a domain "example.com" that points to a server at
"192.0.2.1" and you want to create an alias "www.example.com" that points to the same
server, you can use a CNAME record to do this.
 There are several other types of DNS records in addition to A, MX, and CNAME
records. These include TXT records (used to store arbitrary text in a domain's DNS
record), PTR records (used to map an IP address to a domain name), NS records (used
to specify the name servers for a domain), and others.

DNS Record Types:


There are several different types of DNS records, including −
 A record (Address Record) − maps a domain or subdomain to an IP address.
 MX record (Mail Exchange Record) − routes email for a domain to the correct email
server.
 CNAME record (Canonical Name Record) − creates an alias for a domain.
 TXT record (Text Record) − stores arbitrary text in a domain's DNS record.
 PTR record (Pointer Record) − maps an IP address to a domain name
5
UNIT-5
 NS record (Name Server Record) − specifies the name servers for a domain.
 SOA record (Start of Authority Record) − specifies the DNS server that is the authority
for a specific domain.
 SRV record (Service Record) − specifies the hostname and port number for a specific
service, such as a website or email server.
 AAAA record (Quad-A Record) − maps a domain or subdomain to an IPv6 address.

DNS NAME SERVERS:


DNS name servers, also known as domain name servers or simply DNS servers, are an essential
component of the Domain Name System (DNS). The DNS is a hierarchical decentralized
naming system used to translate domain names (e.g., example.com) into IP addresses (e.g.,
192.0.2.1) that computers can understand and use to communicate over the internet.
Name servers store and manage DNS records, which contain mappings between domain names
and IP addresses. When a user enters a domain name in a web browser or sends an email, the
DNS resolver (usually provided by the user's internet service provider) contacts a name server
to resolve the domain name to its corresponding IP address.
Name-to-Address Resolution:
The host requests the DNS name server to resolve the domain name. And the name server
returns the IP address corresponding to that domain name to the host so that the host can future
connect to that IP address.
6
UNIT-5

There are different types of name servers involved in the DNS resolution process:
 Root name servers: These servers are at the top of the DNS hierarchy. They are
responsible for providing information about the authoritative name servers for each top-
level domain (TLD), such as .com, .org, .net, etc.
 Top-level domain (TLD) name servers: Each TLD has its own set of name servers. They
maintain information about the authoritative name servers for the second-level domains
within their TLD. For example, the .com TLD name servers have information about the
authoritative name servers for domains ending in .com.
 Authoritative name servers: These servers hold the DNS records for specific domain
names. They are responsible for providing the IP address associated with a domain
name. Each domain has its own authoritative name servers, which are specified in the
domain's DNS settings.
When a DNS resolver needs to resolve a domain name, it starts by querying the root name
servers to find the TLD name servers for the domain's extension. Then, it contacts the
appropriate TLD name servers to obtain the authoritative name servers for the specific domain.
Finally, it queries the authoritative name servers to retrieve the IP address associated with the
domain.
Overall, DNS name servers play a crucial role in the functioning of the DNS by providing the
necessary information to translate domain names into IP addresses, enabling seamless
communication on the internet.
7
UNIT-5
Electronic mail:
Electronic mail is one of the most well-known network services. Electronic mail is a computer-
based service that allows users to communicate with one another by exchanging messages.
Email information is transmitted via email servers and uses a variety of TCP/IP protocols. For
example, the simple mail transfer protocol (SMTP) is a protocol that is used to send messages.
Similarly, IMAP or POP receives messages from a mail server.

Features Of Electronic Mail:


 Spontaneity: In a couple of seconds, you may send a message to anybody on the globe.
 Asynchronous: You may send the e-mail and let the recipient view it at their leisure.
 Attachments of data, pictures, or music, frequently in compressed forms, can be
delivered as an e-mail to a person anywhere in the world.
 Addresses can be stored in an address book and retrieved instantly.
 Through an e-mail, a user can transfer multiple copies of a message to various
individuals.

Components Of Electronic Mail


The following are the essential components of an e-mail system:
1. User Agent (UA)
2. Message Transfer Agent (MTA)
3. Message Access Agent
8
UNIT-5
 User Agent (UA):
The User-Agent is a simple software that sends and receives mail. It is also known as a mail
reader. It supports a wide range of instructions for sending, receiving, and replying to messages
and manipulating mailboxes.
Some of the services supplied by the User-Agent are listed below:
 Reading a Message
 Sending a reply to a Message
 Message Composition
 Forwarding a Message
 Handling the Message

 Message Transfer Agent:


The Message Transfer Agent manages the actual e-mail transfer operation (MTA). Simple Mail
Transfer Protocol sends messages from one MTA to another. A system must have a client MTA
and a system MTA to send an e-mail. If the recipients are connected to the same computer, it
sends mail to their mailboxes. If the destination mailbox is on another computer, it sends mail
to the receiver's MTA.

 Message Access Agent:


 The Simple Mail Transfer Protocol is used for the first and second stages of e-mail
delivery.
 The pull protocol is mainly required at the third stage of e-mail delivery, and the
message access agent is used at this point.
 POP and IMAP4 are the two protocols used to access messages.
9
UNIT-5
Electronic mail architecture:

FIG: ARCHITECTURE OF EMAIL SYSTEM


10
UNIT-5
examples:
 First Scenario:
In the first scenario, two user agents are required. The sender and recipient of the e-mail share
the same machine directly connected to the server.
For example, let us consider two user agents, Ninja1 and Ninja2. When Ninja1 sends an e-mail
to Ninja2, the user agent (UA) programme is used to prepare the message. Following that, this
e-mail gets saved in the Ninja2 inbox.

 Second Scenario:
In this case, the sender and recipient of an e-mail are essentially users on two different machines
over the internet. User-Agents and Message Transfer Agents (MTA) are required in this
scenario.
Take, for example, two user agents (Ninja1 and Ninja2), as illustrated in the diagram. When
Ninja1 sends an e-mail to Ninja2, the user agent (UA) and message transfer agents (MTAs)
programmes prepare the e-mail for transmission over the internet. Following that, this e-mail
gets stored in Ninja2's inbox.
11
UNIT-5
 Third Scenario:
The sender is connected to the system by a point-to-point WAN, which can be a dial-up modem
or a cable modem in this case. On the other hand, the receiver is directly attached to the system,
as it was in the second scenario.
The sender also needs a User agent (UA) to prepare the message in this situation. After
preparing the statement, the sender delivers it over LAN or WAN via a pair of MTAs.

 Fourth Scenario:
In this scenario, the recipient is linked to the mail server via WAN or LAN. When the message
arrives, the recipient must retrieve it, which needs additional client/server agents. This scenario
requires two user agents (UAs), two pairs of message transfer agents (MTAs), and a couple of
message access agents (MAAs).
12
UNIT-5
Services provided by E-mail system:
 Composition – The composition refer to process that creates messages and answers. For
composition any kind of text editor can be used.
 Transfer – Transfer means sending procedure of mail i.e. from the sender to recipient.
 Reporting – Reporting refers to confirmation for delivery of mail. It help user to check
whether their mail is delivered, lost or rejected.
 Displaying – It refers to present mail in form that is understand by the user.
 Disposition – This step concern with recipient that what will recipient do after receiving
mail i.e., save mail, delete before reading or delete after reading.

User agent:
13
UNIT-5
Email format:
E-mail is represented as the transmission of messages on the Internet. It is one of the most
commonly used features over communications networks containing text, files, images, or other
attachments.
Format of E-mail:
An e-mail consists of three parts that are as follows:
1. Envelope
2. Header
3. Body

E-mail Envelope:
In modern e-mail systems, there is a distinction made between the e-mail and its contents. An
e-mail envelope contains the message, destination Address, Priority security level etc. The
message transport agents use this envelope for routing.

Message:
The actual message inside the envelope is made of two parts
1. Header
2. Body
The header carries the control information while the Body contains the message contents. The
envelope and messages are shown in the figure below –
14
UNIT-5
Message Formats:
Let us understand the RFC 822 message format in an email.
Messages consist of a primitive envelope, some header fields and a blank line, and the message
body. Each header field logically includes a single line of ASCII text which contains the field
name, a colon and a field. RFC 822 is an old standard. Usually, the user agent builds a message
and passes it to be the message transfer agent with the user’s header fields to construct an
envelope.
The following table shows the principal header fields related to message transport.

RFC 822 header fields related to message transport


 The To – field:
The field gives the DNS address of the primary recipient. It is allowed to have multiple
recipients.

 The Cc – field:
Just like the physical carbon copy, CC (carbon copy) is an easy way to send copies of an email
to other people.

 The Bcc:
BCC stands for “blind carbon copy.” Just like CC, BCC is a way of sending copies of an email
to other people. The difference between the two is that, while you can see a list of recipients
when CC is used, that’s not the case with BCC. It’s called blind carbon copy because the other
recipients won’t be able to see that someone else has been sent a copy of the email.
15
UNIT-5

 From − and Sender fields:


These fields talk about who wrote the message and who sent the message, respectively, because
the person who creates the message and the person who sends it can be different.
Each message you send out has both the sender and from address. The sender domain is what
the receiving email server sees when initiating the session. The from address is what your
recipients will see.

 Received field:
A-line containing the Received field is added by each message transfer agent along the way.
This line carries the agent’s identity, date and time at which they received the message. It also
contains some other information that can be used to find bugs in the routing system.

 The Return-Path− field:


The final message transfer agent adds this field, and it is predetermined to tell how to receive
back to the sender. It can gather this information from all the received headers.

Other header fields:


In addition to the field to table below, RFC 822 messages may contain various header fields
used by user agents or human recipients. Many of them are shown in the table below

Some fields in RFC 822 message header are as follows:


16
UNIT-5

The RFC 822 allows the users to invent new headers for their private use, but these headers
must start with the string X − Event of the week.

Body:
The body of a message contains text that is the actual content/message that needs to be sent,
such as “Employees who are eligible for the new health care program should contact their
supervisors by next Friday if they want to switch.” The message body also may include
signatures or automatically generated text that is inserted by the sender’s email system.

World Wide Web:


The World Wide Web is abbreviated as WWW and is commonly known as the web. The WWW
was initiated by CERN (European library for Nuclear Research) in 1989.
WWW can be defined as the collection of different websites around the world, containing
different information shared via local servers (or computers).

History:
It is a project created, by Timothy Berner Lee in 1989, for researchers to work together
effectively at CERN. is an organization, named the World Wide Web Consortium (W3C),
which was developed for further development of the web. This organization is directed by Tim
Berner’s Lee, aka the father of the web.

System Architecture:
From the user’s point of view, the web consists of a vast, worldwide connection of documents
or web pages. Each page may contain links to other pages anywhere in the world. The pages
can be retrieved and viewed by using browsers of which internet explorer, Netscape Navigator,
Google Chrome, etc are the popular ones. The browser fetches the page requested interprets
the text and formatting commands on it, and displays the page, properly formatted, on the
screen.
The basic model of how the web works are shown in the figure below. Here the browser is
displaying a web page on the client machine. When the user clicks on a line of text that is linked
to a page on the abd.com server, the browser follows the hyperlink by sending a message to the
abd.com server asking it for the page.
17
UNIT-5

Here the browser displays a web page on the client machine when the user clicks on a line of
text that is linked to a page on abd.com, the browser follows the hyperlink by sending a message
to the abd.com server asking for the page.

Working of WWW:
The World Wide Web is based on several different technologies: Web browsers, Hypertext
Markup Language (HTML) and Hypertext Transfer Protocol (HTTP).
A Web browser is used to access web pages. Web browsers can be defined as programs which
display text, data, pictures, animation and video on the Internet. Hyperlinked resources on the
World Wide Web can be accessed using software interfaces provided by Web browsers.
Initially, Web browsers were used only for surfing the Web but now they have become more
universal. Web browsers can be used for several tasks including conducting searches, mailing,
transferring files, and much more. Some of the commonly used browsers are Internet Explorer,
Opera Mini, and Google Chrome.
Features of WWW:
 Hypertext Information System
 Cross-Platform
 Distributed
 Open Standards and Open Source
 Uses Web Browsers to provide a single interface for many services
 Dynamic, Interactive and Evolving.
 “Web 2.0”
18
UNIT-5

Components of the Web: There are 3 components of the web:


 Uniform Resource Locator (URL): serves as a system for resources on the web.
 Hypertext Transfer Protocol (HTTP): specifies communication of browser and server.
 Hyper Text Markup Language (HTML): defines the structure, organisation and content
of a webpage.

HTTP:
HTTP stands for Hypertext Transfer Protocol. Tim Berner invents it. Hypertext is the type of
text which is specially coded with the help of some standard coding language called HyperText
Markup Language (HTML). HTTP/2 is the successor version of HTTP, which was published
on May 2015. HTTP/3 is the latest version of HTTP, which is published in 2022.
The protocol used to transfer hypertext between two computers is known as HyperText Transfer
Protocol.
HTTP provides a standard between a web browser and a web server to establish
communication. It is a set of rules for transferring data from one computer to another. Data
such as text, images, and other multimedia files are shared on the World Wide Web. Whenever
a web user opens their web browser, the user indirectly uses HTTP. It is an application protocol
that is used for distributed, collaborative, hypermedia information systems.

Working of HTTP:
First of all, whenever we want to open any website then first open a web browser after that we
will type the URL of that website (e.g., www.facebook.com). This URL is now sent to Domain
Name Server (DNS). Then DNS first check records for this URL in their database, then DNS
will return the IP address to the web browser corresponding to this URL. Now the browser is
able to send requests to the actual server.
After the server sends data to the client, the connection will be closed. If we want something
else from the server, we should have to re-establish the connection between the client and the
server.
19
UNIT-5

HTTP Request:
HTTP request is simply termed as the information or data that is needed by Internet browsers
for loading a website. This is simply known as HTTP Request.
There is some common information that is generally present in all HTTP requests. These are
mentioned below.
 HTTP Version
 URL
 HTTP Method
 HTTP Request Headers
 HTTP Body

HTTP Request Headers:


HTTP Request Headers generally store information in the form of key-value and must be
present in each HTTP Request. The use of this Request Header is to provide core information
about the client’s information, etc.

HTTP Request Body:


HTTP Request Body simply contains the information that has to be transferred. HTTP
Request has the information or data to be sent to these browsers.

HTTP Method:
HTTP Methods are simply HTTP Verb. In spite of being present so many HTTP Methods, the
most common HTTP Methods are HTTP GET and HTTP POST. These two are generally
used in HTTP cases. In HTTP GET, the information is received in the form of a website.
For more, refer to the Difference Between HTTP GET and HTTP POST.
20
UNIT-5

HTTP Response:
HTTP Response is simply the answer to what a Server gets when the request is raised. There
are various things contained in HTTP Response, some of them are listed below.
 HTTP Status Code
 HTTP Headers
 HTTP Body

HTTP Response Headers:


HTTP Response headers are simply like an HTTP Request where it has that work to send
some important files and data to the HTTP Response Body.

HTTP Response Body:


HTTP Responses are the responses that are received successfully upon the request. Generally,
it comes under the requests generated by the web. In most cases, the request is of transferring
the HTML data into a webpage.

Advantages of HTTP:
 Memory usage and CPU usage are low because of fewer simultaneous connections.
 The error can be reported without closing the connection.
 HTTP allows HTTP pipe-lining of requests or responses.
21
UNIT-5
Disadvantages of HTTP:
 HTTP requires high power to establish communication and transfer data.
 HTTP is not optimized for cellular phones and it is too gabby.
 HTTP does not offer a genuine exchange of data because it is less secure.

FTP:
 FTP stands for File transfer protocol.
 FTP is a standard internet protocol provided by TCP/IP used for transmitting the files
from one host to another.
 It is mainly used for transferring the web page files from their creator to the computer
that acts as a server for other computers on the internet.
 It is also used for downloading the files to computer from other servers.

Objectives of FTP:
 It provides the sharing of files.
 It is used to encourage the use of remote computers.
 It transfers the data more reliably and efficiently.

Why FTP:
Although transferring files from one system to another is very simple and straightforward, but
sometimes it can cause problems. For example, two systems may have different file
conventions. Two systems may have different ways to represent text and data. Two systems
may have different directory structures. FTP protocol overcomes these problems by
establishing two connections between hosts. One connection is used for data transfer, and
another connection is used for the control connection.

Mechanism of FTP:
22
UNIT-5

The above figure shows the basic model of the FTP. The FTP client has three components: the
user interface, control process, and data transfer process. The server has two components: the
server control process and the server data transfer process.

There are two types of connections in FTP:

Control Connection:
The control connection uses very simple rules for communication. Through control connection,
we can transfer a line of command or line of response at a time. The control connection is made
between the control processes. The control connection remains connected during the entire
interactive FTP session.
23
UNIT-5
Data Connection:
The Data Connection uses very complex rules as data types may vary. The data connection is
made between data transfer processes. The data connection opens when a command comes for
transferring the files and closes when the file is transferred.

Characteristics of FTP:
 FTP uses TCP as a transport layer protocol.
 It is good for simple file transfers, such as during boot time.
 Errors in the transmission (lost packets, checksum errors) must be handled by the TFTP
server.
 It uses only one connection through well-known port 69.
 TFTP uses a simple lock-step protocol (each data packet needs to be acknowledged).
Thus, the throughput is limited.

Advantages of FTP:
 Speed is one of the advantages of FTP (File Transfer Protocol).
 File sharing also comes in the category of advantages of FTP in this between two
machines files can be shared on the network.
 Efficiency is more in FTP.

Disadvantages of FTP:
 File size limit is the drawback of FTP only 2 GB size files can be transferred.
 Multiple receivers are not supported by the FTP.
 FTP does not encrypt the data this is one of the biggest drawbacks of FTP.
 FTP is unsecured we use login IDs and passwords making it secure but they can be
attacked by hackers.

You might also like