Computer Networks Notes All Modules
Computer Networks Notes All Modules
MODULE 1
SECTION :A,B,C,D
Topic Portion
Introduction Data Communications: Components, Representations, Data Flow,
Chapter 1 Networks: Physical Structures, Network Types: LAN, WAN, Switching,
Internet
Network Models Protocol Layering: Scenarios, Principles, Logical Connections.
Chapter 2 TCP/IP Protocol Suite: Layered Architecture, Layers in TCP/IP suite,
Description of layers
Encapsulation and Decapsulation, Addressing, Multiplexing and
Demultiplexing, The OSI Model: OSI Versus TCP/IP
n
Data-Link Layer Introduction: Nodes and Links, Services, Categories’ of link, Sublayers,
Chapter 11
e.i
Link Layer addressing: Types of addresses, ARP.
Data Link Control (DLC) services: Framing, Flow and Error Control,
Data Link Layer Protocols: Simple Protocol, Stop and Wait protocol,
fre
Piggybacking
TEXT BOOK: Data Communications and Networking, B Forouzan, 5th Ed, McGrawHill
s4
RNSIT,ECE Page 1
Computer Communication Network
MODULE 1
Data communications
When we communicate, we are sharing information. This sharing can be local or remote.
Between individuals,
local communication usually occurs face to face, while remote communication takes place over
distance.
The term telecommunication, which includes telephony, telegraphy, and television, means
communication at a distance (tele is Greek for “far”). The word data refers to information
presented in whatever form is agreed upon by the parties creating and using the data.
n
Data communications are the exchange of data between two devices via some form of
transmission medium such as a wire cable. For data communications to occur, the
e.i
communicating devices must be part of a communication system made up of a combination of
hardware (physical equipment) and software (programs). The effectiveness of a data
fre
communications system depends on four fundamental characteristics: delivery, accuracy,
timeliness, and jitter.
s4
1. Delivery-The system must deliver data to the correct destination. Data must be received by
the intended device or user and only by that device or user.
te
2. Accuracy- The system must deliver the data accurately. Data that have been altered in
transmission and left uncorrected are unusable.
no
3. Timeliness. The system must deliver data in a timely manner. Data delivered late are useless.
In the case of video and audio, timely delivery means delivering data as they are produced, in
the same order that they are produced, and without significant delay. This kind of delivery is
called real-time transmission.
4. Jitter. Jitter refers to the variation in the packet arrival time. It is the uneven delay in the
delivery of audio or video packets. For example, let us assume that video packets are sent every
30 ms. If some of the packets arrive with 30-ms delay and others with 40-ms delay, an uneven
quality in the video is the result.
RNSIT,ECE Page 2
Computer Communication Network
Components
A data communications system has five components
n
2. Sender-. The sender is the device that sends the data message. It can be a computer,
e.i
workstation, telephone handset, video camera, and so on.
3.Receiver-. The receiver is the device that receives the message. It can be a computer,
fre
workstation, telephone handset, television, and so on
4. Transmission medium-. The transmission medium is the physical path by which a message
s4
travels from sender to receiver. Some examples of transmission media include twisted-pair
wire, coaxial cable, fiber-optic cable, and radio waves.
te
connected but not communicating, just as a person speaking French cannot be understood by a
person who speaks only Japanese.
Data Representation
Information today comes in different forms such as text, numbers, images, audio, and video.
Text -In data communications, text is represented as a bit pattern, a sequence of bits (0s or 1s).
Different sets of bit patterns have been designed to represent text symbols. Each set is called a
code, and the process of representing symbols is called coding. Today, the prevalent coding
system is called Unicode, which uses 32 bits to represent a symbol or character used in any
language in the world. The American Standard Code for Information Interchange (ASCII),
developed some decades ago in the United States, now constitutes the first 127 characters in
Unicode and is also referred to as Basic Latin.
RNSIT,ECE Page 3
Computer Communication Network
Numbers- are also represented by bit patterns. However, a code such as ASCII is not used to
represent numbers; the number is directly converted to a binary number to simplify
mathematical operations. Appendix B discusses several different numbering systems. Images
Images- are also represented by bit patterns. In its simplest form, an image is composed of a
matrix of pixels (picture elements), where each pixel is a small dot. The size of the pixel
depends on the resolution.
For example, an image can be divided into 1000 pixels or 10,000 pixels. In the second case,
there is a better representation of the image (better resolution), but more memory is needed
to store the image. After an image is divided into pixels, each pixel is assigned a bit pattern. The
size and the value of the pattern depend on the image. For an image made of only black and-
white dots (e.g., a chessboard), a 1-bit pattern is enough to represent a pixel. If an image is not
made of pure white and pure black pixels, we can increase the size of the bit pattern to include
gray scale. For example, to show four levels of gray scale, we can use 2-bit patterns. A black
n
pixel can be represented by 00, a dark gray pixel by 01, a light gray pixel by 10, and a white pixel
e.i
by 11. There are several methods to represent color images. One method is called RGB, so
called because each color is made of a combination of three primary colors: red, green, and
fre
blue. The intensity of each color is measured, and a bit pattern is assigned toit. Another method
is called YCM, in which a color is made of a combination of three other primary colors: yellow,
cyan, and magenta.
s4
Audio- Audio refers to the recording or broadcasting of sound or music. Audio is by nature
different from text, numbers, or images. It is continuous, not discrete. Even when we use a
te
Video- Video refers to the recording or broadcasting of a picture or movie. Video can either be
produced as a continuous entity (e.g., by a TV camera), or it can be a combination of images,
each a discrete entity, arranged to convey the idea of motion.
Data Flow
simplex mode- the communication is unidirectional, as on a one-way street. Only one of the
two devices on a link can transmit; the other can only receive (see Figure a).
example-Keyboards and traditional monitors are examples of simplex devices. The keyboard
can only introduce input; the monitor can only accept output.
simplex mode can use the entire capacity of the channel to send data in one direction
RNSIT,ECE Page 4
Computer Communication Network
n
fig: data flow
e.i
Half-Duplex- In half-duplex mode, each station can both transmit and receive, but not at the
same time. When one device is sending, the other can only receive, and vice versa (see Figure
fre
b). The half-duplex mode is like a one-lane road with traffic allowed in both directions. When
cars are traveling in one direction, cars going the other way must wait.
The half-duplex mode is used in cases where there is no need for communication in both
te
directions at the same time; the entire capacity of the channel can be utilized for each
direction.
no
Full-Duplex- In full-duplex mode (also called duplex), both stations can transmit and receive
simultaneously (see Figure c). The full-duplex mode is like a two-way street with traffic flowing
in both directions at the same time. In full-duplex mode, signals going in one direction share the
capacity of the link with signals going in the other direction.
This sharing can occur in two ways: Either the link must contain two physically separate
transmission paths, one for sending and the other for receiving; or the capacity of the channel
is divided between signals traveling in both directions.
NETWORKS
A network is the interconnection of a set of devices capable of communication. a device can be
a host (or an end system as it is sometimes called) such as a large computer, desktop, laptop,
workstation, cellular phone, or security system.
RNSIT,ECE Page 5
Computer Communication Network
A device can also be a connecting device such as a router, which connects the network to other
networks, a switch, which connects devices together, a modem (modulator-demodulator),
which changes the form of data, and so on.
These devices in a network are connected using wired or wireless transmission media such as
cable or air. When we connect two computers at home using a plug-and-play router, we have
created a network, although very small.
Network Criteria
A network must be able to meet a certain number of criteria. The most important of these are
performance, reliability, and security.
Performance- Performance can be measured in many ways, including transit time and response
time. Transit time is the amount of time required for a message to travel from one device to
n
another. Response time is the elapsed time between an inquiry and a response.
e.i
The performance of a network depends on a number of factors, including the number of users,
the type of transmission medium, the capabilities of the connected hardware, and the
fre
efficiency of the software
Reliability- network reliability is measured by the frequency of failure, the time it takes a link
to recover from a failure, and the network’s robustness in a catastrophe.
te
Security- security issues include protecting data from unauthorized access, protecting data
no
from damage and development, and implementing policies and procedures for recovery from
breaches and data losses.
Physical Structures
Type of Connection
A network is two or more devices connected through links. A link is a communications pathway
that transfers data from one device to another.
RNSIT,ECE Page 6
Computer Communication Network
point-to-point connections use an actual length of wire or cable to connect the two ends, but
other options, such as microwave or satellite links, are also possible (see Figure a).
Multipoint A multipoint (also called multidrop) connection is one in which more than two
specific devices share a single link (see Figure b).
n
e.i
fre
fig: Type of connection
s4
a multipoint environment, the capacity of the channel is shared, either spatially or temporally.
If several devices can use the link simultaneously, it is a spatially shared connection. If users
te
Physical Topology
The term physical topology refers to the way in which a network is laid out physically. Two or
more devices connect to a link; two or more links form a topology. The topology of a network is
the geometric representation of the relationship of all the links and linking devices (usually
called nodes) to one another.
There are four basic topologies possible: mesh, star, bus, and ring.
RNSIT,ECE Page 7
Computer Communication Network
Mesh Topology- In a mesh topology, every device has a dedicated point-to-point link to every
other device. The term dedicated means that the link carries traffic only between the two
devices it connects.
We need n (n – 1) physical links in a fully connected mesh network with n nodes. if each
physical link allows communication in both directions (duplex mode),we need n (n – 1) / 2
duplex-mode links.
To accommodate that many links, every device on the network must have n – 1 input/output
(I/O) ports (see Figure ) to be connected to the other n – 1 stations.
Advantages-
1.Use of dedicated links guarantees that each connection can carry its own data load, thus
eliminating the traffic problems that can occur when links must be shared by multiple devices.
n
e.i
2. A mesh topology is robust. If one link becomes unusable, it does not incapacitate the entire
system.
fre
3. Privacy or security. When every message travels along a dedicated line, only the intended
recipient sees it. Physical boundaries prevent other users from gaining access to messages.
s4
4. Point-to-point links make fault identification and fault isolation easy. Traffic can be routed to
avoid links with suspected problems. This facility enables the network manager to discover the
precise location of the fault and aids in finding its cause and solution.
te
no
example- of a mesh topology is the connection of telephone regional offices in which each
regional office needs to be connected to every other regional office.
RNSIT,ECE Page 8
Computer Communication Network
Star Topology
In a star topology, each device has a dedicated point-to-point link only to a central controller,
usually called a hub.
The devices are not directly linked to one another.A star topology does not allow direct traffic
between devices. The controller acts as an exchange: If one device wants to send data to
another, it sends the data to the controller, which then relays the data to the other connected
device
n
e.i
fre
A star topology connecting four stations
s4
Advantages
te
2. Each device needs only one link and one I/O port to connect . This factor makes it easy to
install and reconfigure. Far less cabling needs to be housed, and additions, moves, and
deletions involve only one connection: between that device and the hub.
3. robust. If one link fails, only that link is affected. All other links remain active. This factor also
lends itself to easy fault identification and fault isolation. As long as the hub is working, it can be
used to monitor link problems and bypass defective links.
Disadvantage
1. The dependency of the whole topology on one single point, the hub. If the hub goes down,
the whole system is dead.
2. more cabling is required in a star than in some other topologies (such as ring or bus).
The star topology is used in local-area networks (LANs), High-speed LANs often use a star
topology with a central hub.
RNSIT,ECE Page 9
Computer Communication Network
Bus Topology
A bus topology, is multipoint. One long cable acts as a backbone to link all the devices in a network
Nodes are connected to the bus cable by drop lines and taps. A drop line is a connection
running between the device and the main cable.
A tap is a connector that either splices into the main cable or punctures the sheathing of a
n
cable to create a contact with the metallic core.
e.i
As a signal travels along the backbone, some of its energy is transformed into heat. Therefore, it
becomes weaker and weaker as it travels farther and farther. For this reason there is a limit on
fre
the number of taps a bus can support and on the distance between those taps.
Advantages
s4
1. Easy to install.
2. bus uses less cabling than mesh or star topologies. Only the backbone cable stretches
te
through the entire facility. Each drop line has to reach only as far as the nearest point on the
no
backbone.
Disadvantages
3. Signal reflection at the taps can cause degradation in quality. This degradation can be
controlled by limiting the number and spacing of devices connected to the given length of the
cable
5. a fault or break in the bus cable stops all transmission. The damaged area reflects signals
back in the direction of origin, creating noise in both directions.
RNSIT,ECE Page 10
Computer Communication Network
Bus topology was the one of the first topologies used in the design of early local area networks.
Traditional Ethernet LANs can use a bus topology, but they are less popular now .
Ring Topology
In a ring topology, each device has a dedicated point-to-point connection with only the two
devices on either side of it. A signal is passed along the ring in one direction, from device to
device, until it reaches its destination.
Each device in the ring incorporates a repeater. When a device receives a signal intended for
another device, its repeater regenerates the bits and passes them along
n
e.i
fre
fig: A ring topology connecting six stations
s4
Advantages
1. A ring is relatively easy to install and reconfigure. Each device is linked to only its immediate
te
neighbors (either physically or logically). To add or delete a device requires changing only two
connections.
no
Generally, in a ring a signal is circulating at all times. If one device does not receive a signal
within a specified period, it can issue an alarm. The alarm alerts the network operator to the
problem and its location.
Disadvantage
In a simple ring, a break in the ring (such as a disabled station) can disable the entire network.
This weakness can be solved by using a dual ring or a switch capable of closing off the break.
Ring topology was prevalent when IBM introduced its local-area network, Token Ring. Today,
the need for higher-speed LANs has made this topology less popular.
RNSIT,ECE Page 11
Computer Communication Network
NETWORK TYPES
Different types of networks
n
e.i
fre
s4
te
no
A local area network (LAN) is usually privately owned and connects some hosts in a single
office, building, or campus. Depending on the needs of an organization,
A LAN can be as simple as two PCs and a printer in someone’s home office, or it can extend
throughout a company and include audio and video devices.
Each host in a LAN has an identifier, an address, that uniquely defines the host in the LAN. A
packet sent by a host to another host carries both the source host’s and the destination host’s
addresses.
RNSIT,ECE Page 12
Computer Communication Network
In the past, all hosts in a network were connected through a common cable, which meant that a
packet sent from one host to another was received by all hosts. The intended recipient kept the
packet; the others dropped the packet.
Today, most LANs use a smart connecting switch, which is able to recognize the destination
address of the packet and guide the packet to its destination without sending it to all other
hosts. The switch alleviates the traffic in the LAN and allows more than one pair to
communicate with each other at the same time if there is no common source and destination
among them.
n
WANs.
Point-to-Point WAN
e.i
A point-to-point WAN is a network that connects two communicating devices through a
fre
transmission media (cable or air).
s4
te
no
Switched WAN
A switched WAN is a network with more than two ends. A switched WAN, is used in the
backbone of global communication today. We can say that a switched WAN is a combination of
several point-to-point WANs that are connected by switches..
RNSIT,ECE Page 13
Computer Communication Network
LAN VS WAN
n
1. A LAN is normally limited in size, spanning 1. A WAN has a wider geographical span,
e.i
an office, a building, or a campus. spanning a town, a state, a country, or even
the world
2. A LAN interconnects hosts
fre
2. WAN interconnects connecting devices such
3. A LAN is normally privately owned by the as switches, routers, or modems
organization that uses it
3. a WAN is normally created and run by
s4
Internetwork
Today, it is very rare to see a LAN or a WAN in isolation; they are connected to one another.
When two or more networks are connected, they make an internetwork, or internet.
example- Assume that an organization has two offices, one on the east coast and the other on
the west coast. Each office has a LAN that allows all employees in the office to communicate
with each other. To make the communication between employees at different offices possible,
the management leases a point-to-point dedicated WAN from a service provider, such as a
telephone company, and connects the two LANs. Now the company has an internetwork, or a
private internet (with lowercase i). Communication between offices is now possible.
RNSIT,ECE Page 14
Computer Communication Network
When a host in the west coast office sends a message to another host in the same office, the
router blocks the message, but the switch directs the message to the destination. On the other
hand, when a host on the west coast sends a message to a host on the east coast, router R1
routes the packet to router R2, and the packet reaches the destination. Figure shows another
n
internet with several LANs and WANs connected. One of the WANs is a switched WAN with four
switches.
e.i
fre
s4
te
no
RNSIT,ECE Page 15
Computer Communication Network
Switching
An internet is a switched network in which a switch connects at least two links together. A
switch needs to forward data from a network to another network when required. The two most
common types of switched networks are circuit-switched and packet-switched networks.
Circuit-Switched Network
n
e.i
fre
s4
te
The thick line connecting two switches is a high-capacity communication line that can handle
no
four voice communications at the same time; the capacity can be shared between all pairs of
telephone sets. The switches used in this example have forwarding tasks but no storing
capability.
In the first case, all telephone sets are busy; four people at one site are talking with four
people at the other site; the capacity of the thick line is fully used.
In the second case, only one telephone set at one side is connected to a telephone set at the
other side; only one-fourth of the capacity of the thick line is used. This means that a circuit-
switched network is efficient only when it is working at its full capacity; most of the time, it is
inefficient because it is working at partial capacity.
RNSIT,ECE Page 16
Computer Communication Network
The reason to make the capacity of the thick line four times the capacity of each voice line is
that we do not want communication to fail when all telephone sets at one side want to be
connected with all telephone sets at the other side
Packet-Switched Network
In a computer network, the communication between the two computers is done in blocks of
data called packets
This allows switches to function for both storing and forwarding because a packet is an
independent entity that can be stored and sent later. Fig shows a small packet-switched
network that connects four computers at one site to four computers at the other site.
n
e.i
fre
s4
A router in a packet-switched network has a queue that can store and forward the packet.
no
Example- Now assume that the capacity of the thick line is only twice the capacity of the data
line connecting the computers to the routers.
If only two computers (one at each site) need to communicate with each other, there is no
waiting for the packets. However, if packets arrive at one router when the thick line is already
working at its full capacity, the packets should be stored and forwarded in the order they
arrived. The two simple examples show that a packet-switched network is more efficient than a
circuit switched network, but the packets may encounter some delays.
The Internet
An internet (note the lowercase i) is two or more networks that can communicate with each
other. The most notable internet is called the Internet (uppercase I ), and is composed of
thousands of interconnected networks.
RNSIT,ECE Page 17
Computer Communication Network
Figure 1.15 shows a conceptual (not geographical) view of the Internet. The figure shows the
Internet as several backbones, provider networks, and customer networks. At the top level, the
backbones are large networks owned by some communication companies such as Sprint,
Verizon (MCI), AT&T, and NTT. The backbone networks are connected through some complex
switching systems, called peering points. At the second level, there are smaller networks, called
provider networks, that use the services of the backbones for a fee. The provider networks are
connected to backbones and sometimes to other provider networks.
n
e.i
fre
s4
te
no
The customer networks are networks at the edge of the Internet that actually use the services
provided by the Internet. They pay fees to provider networks for receiving services. Backbones
and provider networks are also called Internet Service Providers (ISPs). The backbones are often
referred to as international ISPs; the provider networks are often referred to as national or
regional ISP
RNSIT,ECE Page 18
Computer Communication Network
Network Models
Protocol Layering
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.
Let us develop two simple scenarios to better understand the need for protocol layering.
Scenarios
n
First Scenario
e.i
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
fre
Ann takes place in one layer, face to face, in the same language, as shown in Figure
s4
te
no
Second Scenario
In the second scenario, we assume that Ann is offered a higher-level position in her company,
but needs to move to another branch located in a city very far from Maria. The two friends still
want to continue their communication and exchange ideas because they have come up with an
innovative project to start a new business when they both retire. They decide to continue their
conversation using regular mail through the post office. However, they do not want their ideas
to be revealed by other people if the letters are intercepted. They agree on an
encryption/decryption technique. The sender of the letter encrypts it to make it unreadable by
an intruder; the receiver of the letter decrypts it to get the original letter.
RNSIT,ECE Page 19
Computer Communication Network
Now we can say that the communication between Maria and Ann takes place in three layers,
as shown in Figure . We assume that Ann and Maria each have three machines (or robots) that
can perform the task at each layer.
n
e.i
fre
s4
te
Assume that Maria sends the first letter to Ann. Maria talks to the machine at the third layer as
no
though the machine is Ann and is listening to her. The third layer machine listens to what Maria
says and creates the plaintext (a letter in English), which is passed to the second layer machine.
The second layer machine takes the plaintext, encrypts it, and creates the ciphertext, which is
passed to the first layer machine. The first layer machine, presumably a robot, takes the
ciphertext, puts it in an envelope, adds the sender and receiver addresses, and mails it
At Ann’s side, the first layer machine picks up the letter from Ann’s mail box, recognizing the
letter from Maria by the sender address. The machine takes out the ciphertext from the
envelope and delivers it to the second layer machine. The second layer machine decrypts the
message, creates the plaintext, and passes the plaintext to the third-layer machine. The third
layer machine takes the plaintext and reads it as though Maria is speaking.
1) Protocol layering enables us to divide a complex task into several smaller and simpler tasks.
RNSIT,ECE Page 20
Computer Communication Network
For example, from fig, we could have used only one machine to do the job of all three
machines. However, if the encryption/ decryption done by the machine is not enough to
protect their secrecy, they would have to change the whole machine. In the present situation,
they need to change only the second layer machine; the other two can remain the same. This is
referred to as modularity. Modularity in this case means independent layers.
2) A layer (module) can be defined as a black box with inputs and outputs, without concern
about how inputs are changed to outputs. If two machines provide the same outputs when
given the same inputs, they can replace each other.
For example, Ann and Maria can buy the second layer machine from two different
manufacturers. As long as the two machines create the same ciphertext from the same
plaintext and vice versa, they do the job.
n
advantages
e.i
1) Protocol layering allows to separate the services from the implementation. Lower layer give
the services to the upper layer; we don’t care about how the layer is implemented.
fre
For example, Maria may decide not to buy the machine (robot) for the first layer; she can do
the job herself. As long as Maria can do the tasks provided by the first layer, in both directions,
the communication system works.
s4
2) Protocol layering in the Internet, is that communication does not always use only two end
te
systems; there are intermediate systems that need only some layers, but not all layers. If we did
not use protocol layering, we would have to make each intermediate system as complex as the
no
First Principle The first principle dictates that if we want bidirectional communication, we need
to make each layer so that it is able to perform two opposite tasks, one in each direction.
For example, the third layer task is to listen (in one direction) and talk (in the other direction).
The second layer needs to be able to encrypt and decrypt. The first layer needs to send and
receive mail.
Second Principle The second principle that we need to follow in protocol layering is that the
two objects under each layer at both sites should be identical.
RNSIT,ECE Page 21
Computer Communication Network
For example, the object under layer 3 at both sites should be a plaintext letter. The object
under layer 2 at both sites should be a cipher text letter. The object under layer 1 at both sites
should be a piece of mail.
Logical Connections
After following the above two principles, we can think about logical connection between each
layer as shown in Figure . This means that we have layer-to-layer communication. Maria and
Ann can think that there is a logical (imaginary) connection at each layer through which they
can send the object created from that layer. We will see that the concept of logical connection
will help us better understand the task of layering we encounter in data communication and
networking.
n
e.i
fre
s4
te
no
Layered Architecture
To show how the layers in the TCP/IP protocol suite are involved in communication between
two hosts, we assume that we want to use the suite in a small internet made up of three LANs
RNSIT,ECE Page 22
Computer Communication Network
(links), each with a link-layer switch. We also assume that the links are connected by one
router, as shown in Figure
n
fig: layers in TCP/IP protocol suite
e.i
fre
s4
te
no
RNSIT,ECE Page 23
Computer Communication Network
Assume that computer A communicates with computer B. As the figure shows, five
communicating devices in this communication: source host (computer A), the link-layer switch
in link 1, the router, the link-layer switch in link 2, and the destination host (computer B).
The source host needs to create a message in the application layer and send it down the layers
so that it is physically sent to the destination host. The destination host needs to receive the
communication at the physical layer and then deliver it through the other layers to the
application layer
The router is involved in only three layers; there is no transport or application layer in a router.
Although a router is always involved in one network layer, it is involved in n combinations of
link and physical layers in which n is the number of links the router is connected to. The reason
is that each link may use its own data-link or physical protocol.
n
For example, in the above figure, the router is involved in three links, but the message sent
from source A to destination B is involved in two links. Each link may be using different link-
e.i
layer and physical-layer protocols; the router needs to receive a packet from link 1 based on
one pair of protocols and deliver it to link 2 based on another pair of protocols.
fre
A link-layer switch in a link, however, is involved only in two layers, data-link and physical.
Although each switch in the above figure has two different connections, the connections are in
s4
the same link, which uses only one set of protocols. This means that, unlike a router, a link-
layer switch is involved only in one data-link and one physical layer.
te
To better understand the duties of each layer, we need to think about the logical connections
between layers.
RNSIT,ECE Page 24
Computer Communication Network
Using logical connections makes it easier to think about the duty of each layer. As the figure
shows, the duty of the application, transport, and network layers is end-to-end. However, the
duty of the data-link and physical layers is hop-to-hop, in which a hop is a host or router.
In other words, the domain of duty of the top three layers is the internet, and the domain of
duty of the two lower layers is the link.
Another way of thinking of the logical connections is to think about the data unit created from
each layer. In the top three layers, the data unit (packets) should not be changed by any router
or link-layer switch. In the bottom two layers, the packet created by the host is changed only by
the routers, not by the link-layer switches.
Fig shows the second principle discussed previously for protocol layering. We show the identical
n
objects below each layer related to each device.
e.i
fre
s4
te
no
Note that, although the logical connection at the network layer is between the two hosts, we
can only say that identical objects exist between two hops in this case because a router may
fragment the packet at the network layer and send more packets than received .Note that the
link between two hops does not change the object.
RNSIT,ECE Page 25
Computer Communication Network
Physical layer is responsible for carrying individual bits in a frame across the link. Although the
physical layer is the lowest level in the TCP/IP protocol suite, the communication between two
devices at the physical layer is still a logical communication because there is another, hidden
layer, the transmission media, under the physical layer.
Two devices are connected by a transmission medium (cable or air). Transmission medium does
not carry bits, it carries electrical or optical signals. So the bits received in a frame from the
data-link layer are transformed and sent through the transmission media, but we can think that
the logical unit between two physical layers in two devices is a bit. There are several protocols
that transform a bit to a signal.
n
The physical layer of TCP/IP describes hardware standards such as IEEE 802.3, the specification
e.i
for Ethernet network media, and RS-232, the specification for standard pin connectors.
Data-link Layer
te
Internet is made up of several links (LANs and WANs) connected by routers. The data-link layer
is responsible for taking the datagram and moving it across the link.(node to node
no
communication)
The link can be a wired LAN with a link-layer switch, a wireless LAN, a wired WAN, or a wireless
WAN. We can also have different protocols used with any link type.
In each case, the data-link layer is responsible for moving the packet through the link. TCP/IP
does not define any specific protocol for the data-link layer. It supports all the standard and
proprietary protocols. The data-link layer takes a datagram and encapsulates it in a packet
called a frame.
Each link-layer protocol provide a different service like framing, Flow control, Error control
and congestion control.
RNSIT,ECE Page 26
Computer Communication Network
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. However,
since 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.
The network layer is responsible packetizing and routing and forwarding the packet through
possible routes. others services are error and flow control, congestion control.
The network layer in the Internet includes the main protocol, Internet Protocol (IP), that
defines the format of the packet, called a datagram at the network layer. IP also defines the
format and the structure of addresses used in this layer.
IP is also responsible for routing a packet from its source to its destination, which is achieved by
n
each router forwarding the datagram to the next router in its path.
e.i
IP is a connectionless protocol that provides no flow control, no error control, and no
congestion control services. This means that if any of these services is required for an
fre
application, the application should rely only on the transport-layer protocol.
The network layer also includes unicast (one-to-one) and multicast (one-to-many) routing
s4
protocols. A routing protocol does not take part in routing (it is the responsibility of IP), but it
creates forwarding tables for routers to help them in the routing process. The network layer
te
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
no
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 in different protocols) and sends it, through the
logical (imaginary) connection, to the transport layer at the destination host.
The transport layer is responsible for giving services to the application layer: to get a message
from an application program running on the source host and deliver it to the corresponding
application program on the destination host.(process to process coommunication)
RNSIT,ECE Page 27
Computer Communication Network
There are more than one protocol in the transport layer, which means that each application
program can use the protocol that best matches its requirement. There are a few transport-
layer protocols in the Internet, each designed for some specific task.
The main protocol, Transmission Control Protocol (TCP), is a connection-oriented protocol that
first establishes a logical connection between transport layers at two hosts before transferring
data. It creates a logical pipe between two TCPs for transferring a stream of bytes. TCP provides
flow control (matching the sending data rate of the source host with the receiving data rate of
the destination host to prevent overwhelming the destination), error control (to guarantee that
the segments arrive at the destination without error and resending the corrupted ones), and
congestion control to reduce the loss of segments due to congestion in the network.
User Datagram Protocol (UDP), is a connectionless protocol that transmits user datagrams
without first creating a logical connection. In UDP, each user datagram is an independent entity
n
without being related to the previous or the next one (the meaning of the term connectionless).
e.i
UDP is a simple protocol that does not provide flow, error, or congestion control.
Its simplicity, which means small overhead, is attractive to an application program that needs
fre
to send short messages and cannot afford the retransmission of the packets involved in TCP,
when a packet is corrupted or lost.
s4
A new protocol, Stream Control Transmission Protocol (SCTP) is designed to respond to new
applications that are emerging in the multimedia.
te
Application Layer
no
As Figure shows, 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. However, communication is done through all the layers.
Communication at the application layer is between two processes (two programs running at
this layer). To communicate, a process sends a request to the other process and receives a
response. Process-to-process communication is the duty of the application layer.
1) The Hypertext Transfer Protocol (HTTP) is a vehicle for accessing the World Wide Web
(WWW).
2) The Simple Mail Transfer Protocol (SMTP) is the main protocol used in electronic mail (e-
mail) service.
RNSIT,ECE Page 28
Computer Communication Network
3) The File Transfer Protocol (FTP) is used for transferring files from one host to another.
4)The Terminal Network (TELNET) and Secure Shell (SSH) are used for accessing a site remotely.
6) The Domain Name System (DNS) is used by other protocols to find the network-layer address
of a computer.
7) The Internet Group Management Protocol (IGMP) is used to collect membership in a group.
n
decapsulation. Figure shows this concept for the small internet
e.i
fre
s4
te
no
We have not shown the layers for the link-layer switches because no encapsulation/
decapsulation occurs in this device. Figure show the encapsulation in the source host,
decapsulation in the destination host, and encapsulation and decapsulation in the router.
RNSIT,ECE Page 29
Computer Communication Network
2. The transport layer takes the message as the payload, the load that the transport layer
should take care of. It adds the transport layer header to the payload, which contains the
identifiers of the source and destination application programs that want to communicate plus
some more information that is needed for the end-to end delivery of the message, such as
information needed for flow, error control, or congestion control. The result is the transport-
layer packet, which is called the segment (in TCP) and the user datagram (in UDP). The
transport layer then passes the packet to the network layer.
3. The network layer takes the transport-layer packet as data or payload and adds its own
header to the payload. The header contains the addresses of the source and destination hosts
n
and some more information used for error checking of the header, fragmentation information,
e.i
and so on. The result is the network-layer packet, called a datagram. The network layer then
passes the packet to the data-link layer.
fre
4. The data-link layer takes the network-layer packet as data or payload and adds its own
header, which contains the link-layer addresses of the host or the next hop (the router). The
result is the link-layer packet, which is called a frame. The frame is passed to the physical layer
s4
for transmission.
te
1. After the set of bits are delivered to the data-link layer, this layer decapsulates the datagram
from the frame and passes it to the network layer.
2. The network layer only inspects the source and destination addresses in the datagram
header and consults its forwarding table to find the next hop to which the datagram is to be
delivered. The contents of the datagram should not be changed by the network layer in the
router unless there is a need to fragment the datagram if it is too big to be passed through the
next link. The datagram is then passed to the data-link layer of the next link.
3. The data-link layer of the next link encapsulates the datagram in a frame and passes it to the
physical layer for transmission.
RNSIT,ECE Page 30
Computer Communication Network
At the destination host, each layer only decapsulates the packet received, removes the payload,
and delivers the payload to the next-higher layer protocol until the message reaches the
application layer. It is necessary to say that decapsulation in the host involves error checking
Addressing
we have logical communication between pairs of layers in this model. Any communication that
involves two parties needs two addresses: source address and destination address. Although it
looks as if we need five pairs of addresses, one pair per layer, we normally have only four
because the physical layer does not need addresses; the unit of data exchange at the physical
layer is a bit, which definitely cannot have an address.
Figure 2.9 shows the addressing at each layer. At the application layer, we normally use names
n
to define the site that provides services, such as someorg.com, or the e-mail address, such as
[email protected].
e.i
fre
s4
te
no
At the transport layer, addresses are called port numbers, and these define the application-
layer programs at the source and destination. Port numbers are local addresses that distinguish
between several programs running at the same time.
At the network-layer, the addresses are global, with the whole Internet as the scope. A
network-layer address uniquely defines the connection of a device to the Internet.
RNSIT,ECE Page 31
Computer Communication Network
The link-layer addresses, sometimes called MAC addresses, are locally defined addresses, each
of which defines a specific host or router in a network (LAN or WAN).
Multiplexing means that a protocol at a layer can encapsulate a packet from several next-
higher layer protocols (one at a time); demultiplexing means that a protocol can decapsulate
and deliver a packet to several next-higher layer protocols (one at a time). Figure shows the
concept of multiplexing and demultiplexing at the three upper layers.
n
e.i
fre
s4
te
To be able to multiplex and demultiplex, a protocol needs to have a field in its header to
identify to which protocol the encapsulated packets belong.
At the transport layer, either UDP or TCP can accept a message from several application-layer
protocols.
At the network layer, IP can accept a segment from TCP or a user datagram from UDP. IP can
also accept a packet from other protocols such as ICMP, IGMP, and so on.
At the data-link layer, a frame may carry the payload coming from IP or other protocols such as
ARP .
RNSIT,ECE Page 32
Computer Communication Network
protocols that allows any two different systems to communicate regardless of their underlying
architecture.
The purpose of the OSI model is to show how to facilitate communication between different
systems without requiring changes to the logic of the underlying hardware and software. The
OSI model is not a protocol; it is a model for understanding and designing a network
architecture that is flexible, robust, and interoperable. The OSI model was intended to be the
basis for the creation of the protocols in the OSI stack. The OSI model is a layered framework
for the design of network systems that allows communication between all types of computer
systems.
It consists of seven separate but related layers, each of which defines a part of the process of
moving information across a network
n
e.i
fre
s4
te
no
When we compare the two models, we find that two layers, session and presentation, are
missing from the TCP/IP protocol suite. These two layers were not added to the TCP/IP protocol
suite after the publication of the OSI model. The application layer in the suite is usually
considered to be the combination of three layers in the OSI model, as shown in Figure .
Two reasons were mentioned for this decision. First, TCP/IP has more than one transport-layer
protocol. Some of the functionalities of the session layer are available in some of the transport-
layer protocols.
RNSIT,ECE Page 33
Computer Communication Network
Second, the application layer is not only one piece of software. Many applications can be
developed at this layer. If some of the functionalities mentioned in the session and
presentation layers are needed for a particular application, they can be included in the
development of that piece of software.
n
e.i
fre
s4
te
no
RNSIT,ECE Page 34
Computer Communication Network
DATA-LINK LAYER
INTRODUCTION
The Internet is a combination of networks glued together by connecting devices (routers or
switches). If a packet is to travel from a host to another host, it needs to pass through these
networks.. Communication at the data-link layer is made up of five separate logical connections
between the data-link layers in the path.
n
Figure 9.1 e.i
fre
s4
te
no
fig
The data-link layer at Alice’s computer communicates with the data-link layer at router R2. The
data-link layer at router R2 communicates with the data-link layer at router R4,
and so on. Finally, the data-link layer at router R7 communicates with the data-link layer at
Bob’s computer. Only one data-link layer is involved at the source or the destination, but two
data-link layers are involved at each router. The reason is that Alice’s and Bob’s computers are
RNSIT,ECE Page 35
Computer Communication Network
each connected to a single network, but each router takes input from one network and sends
output to another network. Note that although switches are also involved in the data-link-layer
communication, for simplicity we have not shown them in the figure.
Communication at the data-link layer is node-to-node. A data unit from one point in the
Internet needs to pass through many networks (LANs and WANs) to reach another point.
Theses LANs and WANs are connected by routers. It is customary to refer to the two end hosts
and the routers as nodes and the networks in between as links. Figure shows a simple
representation of links and nodes when the path of the data unit is only six nodes.
n
e.i
fre
s4
te
The first node is the source host; the last node is the destination host. The other four nodes are
four routers. The first, the third, and the fifth links represent the three LANs; the second and
the fourth links represent the two WANs.
Services
The data-link layer is located between the physical and the network layers. The data link layer
provides services to the network layer; it receives services from the physical layer.
The duty scope of the data-link layer is node-to-node. When a packet is travelling in the
Internet, the data-link layer of a node (host or router) is responsible for delivering a datagram
to the next node in the path. For this purpose, the data-link layer of the sending node needs to
encapsulate the datagram received from the network in a frame, and the data-link layer of the
receiving node needs to decapsulate the datagram from the frame. In other words, the data-
RNSIT,ECE Page 36
Computer Communication Network
link layer of the source host needs only to encapsulate, the data-link layer of the destination
host needs to decapsulate, but each intermediate node needs to both encapsulate and
decapsulate.
One may ask why we need encapsulation and decapsulation at each intermediate node. The
reason is that each link may be using a different protocol with a different frame format. Even if
one link and the next are using the same protocol, encapsulation and decapsulation are needed
because the link-layer addresses are normally different.
Analogy :-may help in this case. Assume a person needs to travel from her home to her friend’s
home in another city. The traveller can use three transportation tools. She can take a taxi to go
to the train station in her own city, then travel on the train from her own city to the city where
her friend lives, and finally reach her friend’s home using another taxi. Here we have a source
node, a destination node, and two intermediate nodes. The traveller needs to get into the taxi
n
at the source node, get out of the taxi and get into the train at the first intermediate node (train
e.i
station in the city where she lives), get out of the train and get into another taxi at the second
intermediate node (train station in the city where her friend lives), and finally get out of the taxi
when she arrives at her destination. A kind of encapsulation occurs at the source node,
fre
encapsulation and decapsulation occur at the intermediate nodes, and decapsulation occurs at
the destination node. Our traveller is the same, but she uses three transporting tools to reach
s4
the destination. Figure shows the encapsulation and decapsulation at the data-link layer.
For simplicity, we have assumed that we have only one router between the source and
te
destination. The datagram received by the data-link layer of the source host is encapsulated in
a frame. The frame is logically transported from the source host to the router. The frame is
no
decapsulated at the data-link layer of the router and encapsulated at another frame. The new
frame is logically transported from the router to the destination host. Note that, although we
have shown only two data-link layers at the router, the router actually has three data-link layers
because it is connected to three physical links.
RNSIT,ECE Page 37
Computer Communication Network
n
e.i
Framing
The first service provided by the data-link layer is framing. The data-link layer at each node
fre
needs to encapsulate the datagram (packet received from the network layer) in a frame before
sending it to the next node. The node also needs to decapsulate the datagram from the frame
received on the logical channel. Although we have shown only a header for a frame, frame may
s4
have both a header and a trailer. Different data-link layers have different formats for framing.
Flow Control
te
If the rate of produced frames is higher than the rate of consumed frames, frames at the
no
The first choice is to let the receiving data-link layer drop the frames if its buffer is full. The
second choice is to let the receiving data-link layer send a feedback to the sending data-link
layer to ask it to stop or slow down.
Different data-link-layer protocols use different strategies for flow control. Since flow control
also occurs at the transport layer, with a higher degree of importance.
Error Control
At the sending node, a frame in a data-link layer needs to be changed to bits, transformed to
electromagnetic signals, and transmitted through the transmission media. At the receiving
node, electromagnetic signals are received, transformed to bits, and put together to create a
frame. Since electromagnetic signals are susceptible to error, a frame is susceptible to error.
RNSIT,ECE Page 38
Computer Communication Network
The error needs first to be detected. After detection, it needs to be either corrected at the
receiver node or discarded and retransmitted by the sending node. Since error detection and
correction is an issue in every layer (node-to node or host-to-host).
Congestion Control
Although a link may be congested with frames, which may result in frame loss, most data-link-
layer protocols do not directly use a congestion control to alleviate congestion, although some
wide-area networks do. In general, congestion control is considered an issue in the network
layer or the transport layer because of its end-to-end nature.
In a point-to-point link, the link is dedicated to the two devices; in a broadcast link, the link is
shared between several pairs of devices. For example, when two friends use the traditional
n
home phones to chat, they are using a point-to-point link; when the same two friends use their
e.i
cellular phones, they are using a broadcast link (the air is shared among many cell phone users).
Two Sublayers
fre
The data-link layer is divided into two sublayers: data link control (DLC) and media access
control (MAC). LAN protocols actually use the same strategy. The data link control sublayer
s4
deals with all issues common to both point-to-point and broadcast links; the media access
control sublayer deals only with issues specific to broadcast links. In other words, we separate
te
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
RNSIT,ECE Page 39
Computer Communication Network
destination IP addresses define the two ends but cannot define which links the datagram
should pass through. We need to remember that the IP addresses in a datagram should not be
changed. If the destination IP address in a datagram changes, the packet never reaches its
destination; if the source IP address in a datagram changes, the destination host or a router can
never communicate with the source if a response needs to be sent back or an error needs to be
reported back to the source (ICMP ).
The above discussion shows that we need another addressing mechanism in a connectionless
internetwork: the link-layer addresses of the two nodes. A link-layer address is sometimes
called a link address, sometimes a physical address, and sometimes a MAC address. Since a
link is controlled at the data-link layer, the addresses need to belong to the data-link layer.
When a datagram passes from the network layer to the data-link layer, the datagram will be
encapsulated in a frame and two data-link addresses are added to the frame header. These two
addresses are changed every time the frame moves from one link to another. Figure
n
demonstrates the concept in a small internet.
e.i
fre
s4
te
no
above Figure shows three links and two routers and also have only two hosts: Alice (source)
and Bob (destination). For each host, two addresses, the IP addresses (N) and the link-layer
addresses (L) are shown. Note that a router has as many pairs of addresses as the number of
links the router is connected to. We have shown three frames, one in each link. Each frame
RNSIT,ECE Page 40
Computer Communication Network
carries the same datagram with the same source and destination addresses (N1 and N8), but
the link-layer addresses of the frame change from link to link.
In link 1, the link-layer addresses are L1 and L2. In link 2, they are L4 and L5. In link 3, they are
L7 and L8. Note that the IP addresses and the link-layer addresses are not in the same order.
For IP addresses, the source address comes before the destination address; for link-layer
addresses, the destination address comes before the source. The datagrams and frames are
designed in this way, and we follow the design. We may raise several questions:
❑ The IP address of a router does not appear in any datagram sent from a source to a
destination, why do we need to assign IP addresses to routers? The answer is that in some
protocols a router may act as a sender or receiver of a datagram. For example, in routing
protocols a router is a sender or a receiver of a message. The communications in these
protocols are between routers.
n
e.i
❑ Why do we need more than one IP address in a router, one for each interface? The answer
is that an interface is a connection of a router to a link. We will see that an IP address defines a
point in the Internet at which a device is connected. A router with n interfaces is connected to
fre
the Internet at n points. This is the situation of a house at the corner of a street with two gates;
each gate has the address related to the corresponding street.
s4
❑ How are the source and destination IP addresses in a packet determined? The answer is that
the host should know its own IP address, which becomes the source IP address in the packet.
te
the application layer uses the services of DNS to find the destination address of the packet and
passes it to the network layer to be inserted in the packet.
no
❑ How are the source and destination link-layer addresses determined for each link? Again,
each hop (router or host) should know its own link-layer address, The destination link-layer
address is determined by using the Address Resolution Protocol.
❑ What is the size of link-layer addresses? The answer is that it depends on the protocol used
by the link. Although we have only one IP protocol for the whole Internet, we may be using
different data-link protocols in different links.
Some link-layer protocols define three types of addresses: unicast, multicast, and broadcast.
RNSIT,ECE Page 41
Computer Communication Network
Unicast Address: Each host or each interface of a router is assigned a unicast address.
Unicasting means one-to-one communication. A frame with a unicast address destination is
destined only for one entity in the link.
Example: The unicast link-layer addresses in the most common LAN, Ethernet, are 48 bits (six
bytes) that are presented as 12 hexadecimal digits separated by colons; for example, the
following is a link-layer address of a computer.
A2:34:45:11:92:F1
Multicast Address: Some link-layer protocols define multicast addresses. Multicasting means
one-to-many communication. However, the jurisdiction is local (inside the link).
Example: the multicast link-layer addresses in the most common LAN, Ethernet, are 48 bits (six
bytes) that are presented as 12 hexadecimal digits separated by colons. The second digit,
n
however, needs to be an even number in hexadecimal. The following shows a multicast
address: A3:34:45:11:92:F1
e.i
Broadcast Address: Some link-layer protocols define a broadcast address. Broadcasting means
fre
one-to-all communication. A frame with a destination broadcast address is sent to all entities in
the link.
s4
Example : the broadcast link-layer addresses in the most common LAN, Ethernet, are 48 bits, all
1s, that are presented as 12 hexadecimal digits separated by colons. The following shows a
te
Anytime a node has an IP datagram to send to another node in a link, it has the IP address of
the receiving node. The source host knows the IP address of the default router. Each router
except the last one in the path gets the IP address of the next router by using its forwarding
table. The last router knows the IP address of the destination host. However, the IP address of
the next node is not helpful in moving a frame through a link; we need the link-layer address of
the next node. This is the time when the Address Resolution Protocol (ARP) becomes helpful.
The ARP protocol is one of the auxiliary protocols defined in the network layer, as shown in
Figure . 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.
RNSIT,ECE Page 42
Computer Communication Network
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
n
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.
e.i
fre
s4
te
no
RNSIT,ECE Page 43
Computer Communication Network
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. In Figure (a) the system
on the left (A) has a packet that needs to be delivered to another system (B) with IP address N2.
System A needs to pass the packet to its data-link layer for the actual delivery, but it does not
know the physical address of the recipient. It uses the services of ARP by asking the ARP
protocol to send a broadcast ARP request packet to ask for the physical address of a system
with an IP address of N2. This packet is received by every system on the physical network, but
only system B will answer it, as shown in Figure (b). System B sends an ARP reply packet that
includes its physical address. Now system A can send all the packets it has for this destination
using the physical address it received.
n
Caching
e.i
Let us assume that there are 20 systems connected to the network (link): system A, system B,
and 18 other systems. We also assume that system A has 10 datagrams to send to system B in
fre
one second.
a. Without using ARP, system A needs to send 10 broadcast frames. Each of the 18 other
s4
systems need to receive the frames, decapsulate the frames, remove the datagram and pass it
to their network-layer to find out the datagrams do not belong to them.This means processing
te
b. Using ARP, system A needs to send only one broadcast frame. Each of the 18 other systems
no
need to receive the frames, decapsulate the frames, remove the ARP message and pass the
message to their ARP protocol to find that the frame must be discarded. This means processing
and discarding only 18 (instead of 180) broadcast frames. After system B responds with its own
data-link address, system A can store the link-layer address in its cache memory. The rest of the
nine frames are only unicast. Since processing broadcast frames is expensive (time consuming),
the first method is preferable.
Packet Format
The hardware type field - defines the type of the link-layer protocol; Ethernet given the type 1.
The protocol type field - defines the network-layer protocol: IPv4 protocol is (0x0800).
The source hardware and source protocol addresses are variable-length fields defining the link-
layer and network-layer addresses of the sender.
RNSIT,ECE Page 44
Computer Communication Network
The destination hardware address and destination protocol address fields define the receiver
link-layer and network-layer addresses.
An ARP packet is encapsulated directly into a data-link frame. The frame needs to have a field
to show that the payload belongs to the ARP and not to the network-layer datagram
n
fig: ARP packet
e.i
Example : A host with IP address N1 and MAC address L1 has a packet to send to another host
fre
with IP address N2 and physical address L2 (which is unknown to the first host). The two hosts
are on the same network. Figure shows the ARP request and response messages
s4
te
no
RNSIT,ECE Page 45
Computer Communication Network
DLC SERVICES
The data link control (DLC) deals with procedures for communication between two adjacent
nodes—node-to-node communication—no matter whether the link is dedicated or broadcast.
Data link control functions include framing and flow and error control.
Framing Data
Transmission in the physical layer means moving bits in the form of a signal from the source to
the destination. The physical layer provides bit synchronization to ensure that the sender and
receiver use the same bit durations and timing.
n
The data-link layer, on the other hand, needs to pack bits into frames, so that each frame is
distinguishable from another.
e.i
Framing in the data-link layer separates a message from one source to a destination by adding a
sender address and a destination address. The destination address defines where the packet is
fre
to go; the sender address helps the recipient acknowledge the receipt.
Although the whole message could be packed in one frame, that is not normally done. One
s4
reason is that a frame can be very large, making flow and error control very inefficient. When a
message is carried in one very large frame, even a single-bit error would require the
te
retransmission of the whole frame. When a message is divided into smaller frames, a single-bit
error affects only that small frame.
no
Frame Size
Fixed-size framing: there is no need for defining the boundaries of the frames; the size itself
can be used as a delimiter. An example of this type of framing is the (Asynchronous transfer
mode)ATM WAN, which uses frames of fixed size called cells.
Two approaches were used for this purpose: a character-oriented approach and a bit-oriented
approach.
RNSIT,ECE Page 46
Computer Communication Network
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, are also multiples of 8 bits.
To separate one frame from the next, an 8-bit (1-byte) flag is added at the beginning and the
end of a frame. The flag, composed of protocol-dependent special characters, signals the start
or end of a frame. Figure shows the format of a frame in a character-oriented protocol.
n
e.i
fig: A frame in a character-oriented protocol
fre
Character-oriented framing was popular when only text was exchanged by the data-link layers.
The flag could be selected to be any character not used for text communication. Now, however,
we send other types of information such as graphs, audio, and video;
s4
Any character used for the flag could also be part of the information. If this happens, the
receiver, when it encounters this pattern in the middle of the data, thinks it has reached the
te
To fix this problem, a byte-stuffing strategy was added to character-oriented framing. In byte
stuffing (or character stuffing), a special byte is added to the data section of the frame when
there is a character with the same pattern as the flag. The data section is stuffed with an extra
byte. This byte is usually called the escape character (ESC) and has a predefined bit pattern.
Whenever the receiver encounters the ESC character, it removes it from the data section and
RNSIT,ECE Page 47
Computer Communication Network
treats the next character as data, not as a delimiting flag. Figure shows the situation.
Byte stuffing by the escape character allows the presence of the flag in the data section of the
n
frame, but it creates another problem. What happens if the text contains one or more escape
e.i
characters followed by a byte with the same pattern as the flag?
The receiver removes the escape character, but keeps the next byte, which is incorrectly
fre
interpreted as the end of the frame. To solve this problem, the escape characters that are part
of the text must also be marked by another escape character. In other words, if the escape
s4
character is part of the text, an extra one is added to show that the second one is part of the
text.
te
with 8-bit characters. We can say that, in general, the tendency is moving toward the bit-
oriented protocols that we discuss next.
Bit-Oriented Framing
RNSIT,ECE Page 48
Computer Communication Network
If the flag pattern appears in the data, need to somehow inform the receiver that this is not the
end of the frame. We do this by stuffing 1 single bit (instead of 1 byte) to prevent the pattern
from looking like a flag. The strategy is called bit stuffing. In bit stuffing, if a 0 and five
consecutive 1 bits are encountered, an extra 0 is added. This extra stuffed bit is eventually
removed from the data by the receiver. Note that the extra bit is added after one 0 followed by
five 1s regardless of the value of the next bit. This guarantees that the flag field sequence does
not inadvertently appear in the frame.
Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the
data, so that the receiver does not mistake the pattern 0111110 for a flag.
Figure shows bit stuffing at the sender and bit removal at the receiver. Note that even if we
n
have a 0 after five 1s, we still stuff a 0. The 0 will be removed by the receiver. This means that if
the flag like pattern 01111110 appears in the data, it will change to 011111010 (stuffed) and is
e.i
not mistaken for a flag by the receiver. The real flag 01111110 is not stuffed by the sender and
is recognized by the receiver.
fre
s4
te
no
RNSIT,ECE Page 49
Computer Communication Network
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. If the items are produced more slowly than they can be consumed, the consumer
must wait, and the system becomes less efficient. Flow control is related to the first issue. We
need to prevent losing the data items at the consumer site.
n
e.i
The figure shows that the data-link layer at the sending node tries to push frames toward the
data-link layer at the receiving node. If the receiving node cannot process and deliver the
packet to its network at the same rate that the frames arrive, it becomes overwhelmed with
fre
frames. Flow control in this case can be feedback from the receiving node to the sending node
to stop or slow down pushing frames.
s4
Buffers
Although flow control can be implemented in several ways, one of the solutions is normally to
te
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.
no
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
Since the underlying technology at the physical layer is not fully reliable, 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.
RNSIT,ECE Page 50
Computer Communication Network
❑ 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.
Flow and error control can be combined. In a simple situation, the acknowledgment that is sent
for flow control can also be used for error control to tell the sender the packet has arrived
uncorrupted. The lack of acknowledgment means that there is a problem in the sent frame. We
show this situation when we discuss some simple protocols in the next section. A frame that
carries an acknowledgment is normally called an ACK to distinguish it from the data frame.
n
Connectionless Protocol
e.i
In a connectionless protocol, frames are sent from one node to the next without any
relationship between the frames; each frame is independent. Note that the term
fre
connectionless here does not mean that there is no physical connection (transmission medium)
between the nodes; it means that there is no connection between frames. The frames are not
numbered and there is no sense of ordering. Most of the data-link protocols for LANs are
s4
connectionless protocols.
te
Connection-Oriented Protocol
two nodes (setup phase). After all frames that are somehow related to each other are
transmitted (transfer phase), the logical connection is terminated (teardown phase). In this type
of communication, the frames are numbered and sent in order. If they are not received in
order, the receiver needs to wait until all frames belonging to the same set are received and
then deliver them in order to the network layer. Connection oriented protocols are rare in
wired LANs, but we can see them in some point-to-point protocols, some wireless LANs, and
some WANs.
The behavior of a data-link-layer protocol can be better shown as a finite state machine (FSM).
An FSM is thought of as a machine with a finite number of states. The figure shows a machine
RNSIT,ECE Page 51
Computer Communication Network
with three states. There are only three possible events and three possible actions. The machine
starts in state I. If event 1 occurs, the machine performs actions 1 and 2 and moves to state II.
When the machine is in state II, two events may occur. If event 1 occurs, the machine performs
action 3 and remains in the same state, state II. If event 3 occurs, the machine performs no
action, but move to state I.
n
e.i
fig: Connectionless and connection oriented service represented as FSMs
fre
Simple Protocol
First protocol is a simple protocol with neither flow nor error control. We assume that the
s4
receiver can immediately handle any frame it receives. In other words, the receiver can never
be overwhelmed with incoming frames. Figure shows the layout for this protocol.
te
no
The data-link layer at the sender gets a packet from its network layer, makes a frame out of it,
and sends the frame. The data-link layer at the receiver receives a frame from the link, extracts
the packet from the frame, and delivers the packet to its network layer. The data-link layers of
the sender and receiver provide transmission services for their network layers.
FSMs The sender site should not send a frame until its network layer has a message to send.
The receiver site cannot deliver a message to its network layer until a frame arrives. We can
show these requirements using two FSMs. Each FSM has only one state, the ready state.
RNSIT,ECE Page 52
Computer Communication Network
sending machine remains in the ready state until a request comes from the process in the
network layer. When this event occurs, the sending machine encapsulates the message in a
frame and sends it to the receiving machine.
The receiving machine remains in the ready state until a Frame arrives from the sending
machine. When this event occurs, the receiving machine decapsulates the message out of the
frame and delivers it to the process at the network layer. Figure shows the FSMs for the simple
protocol.
n
e.i
fre
fig: FSMs for the simple protocol
Example
s4
Flow diagram shows an example of communication using this protocol. It is very simple. The
sender sends frames one after another without even thinking about the receiver.
te
no
RNSIT,ECE Page 53
Computer Communication Network
Stop-and-Wait Protocol
Our second protocol is called the Stop-and-Wait protocol, which uses both flow and error
control.
In this protocol, the sender sends one frame at a time and waits for an acknowledgment before
sending the next one. To detect corrupted frames, we need to add a CRC to each data frame.
When a frame arrives at the receiver site, it is checked. If its CRC is incorrect, the frame is
corrupted and silently discarded. The silence of the receiver is a signal for the sender that a
frame was either corrupted or lost.
Every time the sender sends a frame, it starts a timer. If an acknowledgment arrives before the
timer expires, the timer is stopped and the sender sends the next frame (if it has one to send).
If the timer expires, the sender resends the previous frame, assuming that the frame was either
n
lost or corrupted. This means that the sender needs to keep a copy of the frame until its
e.i
acknowledgment arrives.
When the corresponding acknowledgment arrives, the sender discards the copy and sends the
fre
next frame if it is ready. Figure shows the outline for the Stop-and-Wait protocol. Note that only
one frame and one acknowledgment can be in the channels at any time.
s4
te
no
RNSIT,ECE Page 54
Computer Communication Network
n
e.i
fre
fig: FSMs for Stop-and-Wait protocol.
s4
Sender States. The sender is initially in the ready state, but it can move between the ready and
no
blocking state.
Ready State. When the sender is in this state, it is only waiting for a packet from the network
layer. If a packet comes from the network layer, the sender creates a frame, saves a copy of the
frame, starts the only timer and sends the frame. The sender then moves to the blocking state.
❑ Blocking State. When the sender is in this state, three events can occur:
a. If a time-out occurs, the sender resends the saved copy of the frame and restarts the timer.
c. If an error-free ACK arrives, the sender stops the timer and discards the saved copy of the
frame. It then moves to the ready state.
RNSIT,ECE Page 55
Computer Communication Network
Receiver
The receiver is always in the ready state. Two events may occur:
a. If an error-free frame arrives, the message in the frame is delivered to the network layer and
an ACK is sent.
Example
The first frame is sent and acknowledged. The second frame is sent, but lost. After time-out, it
is resent. The third frame is sent and acknowledged, but the acknowledgment is lost. The frame
is resent. However, there is a problem with this scheme. The network layer at the receiver site
n
receives two copies of the third packet, which is not right. In the next section, we will see how
e.i
we can correct this problem using sequence numbers and acknowledgment numbers.
and acknowledgment numbers to the ACK frames. However, numbering in this case is very
simple. Sequence numbers are 0, 1, 0, 1, 0, 1, . . . ; the acknowledgment numbers can also be 1,
te
RNSIT,ECE Page 56
Computer Communication Network
n
e.i
fre
s4
te
example
Figure below shows how adding sequence numbers and acknowledgment numbers can prevent
duplicates. The first frame is sent and acknowledged. The second frame is sent, but lost. After
time-out, it is resent. The third frame is sent and acknowledged, but the acknowledgment is
lost. The frame is resent
We can change the FSM in Figure(FSM for stop and wait protocol) to include the sequence and
acknowledgment numbers.
RNSIT,ECE Page 57
Computer Communication Network
n
e.i
fre
s4
te
Piggybacking
no
The two protocols discussed in this section are designed for unidirectional communication, in which
data is flowing only in one direction although the acknowledgment may travel in the other direction.
Protocols have been designed in the past to allow data to flow in both directions. However, to make the
communication more efficient, the data in one direction is piggybacked with the acknowledgment in the
other direction. In other words, when node A is sending data to node B, Node A also acknowledges the
data received from node B. Because piggybacking makes communication at the datalink layer more
complicated, it is not a common practice.
RNSIT,ECE Page 58
Computer Communication Networks
MODULE 2
Media Access Control (MAC)
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.
Many protocols have been devised to handle access to a shared link. All of these
protocols belong to a sub layer in the data-link layer called media access control (MAC).
n
e.i
fre
s4
RANDOM ACCESS
te
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 have evolved from a very interesting protocol known as
ALOHA, which used a very simple procedure called multiple access (MA).
The method was improved with the addition of a procedure that forces the station to sense
the medium before transmitting. This was called carrier sense multiple access (CSMA).
CSMA method later evolved into two parallel methods: carrier sense multiple access
with collision detection (CSMA/CD), which tells the station what to do when a collision
is detected, and carrier sense multiple access with collision avoidance (CSMA/CA),
which tries to avoid the collision.
n
ALOHA e.i
ALOHA, the earliest random access method, was developed at the University of Hawaii
fre
in early 1970. It was designed for a radio (wireless) LAN, but it can be used on any
shared medium.
The medium is shared between the stations. When a station sends data, another station
s4
may attempt to do so at the same time. The data from the two stations collide and become
te
garbled.
no
Pure ALOHA
The original ALOHA protocol is called pure ALOHA. This is a simple but elegant
protocol.
The idea is that each station sends a frame whenever it has a frame to send (multiple
access) there is only one channel to share, there is the possibility of collision between
frames from different stations.
n
There are four stations (unrealistic assumption) that contend with one another for access
e.i
to the shared channel. The above figure shows that each station sends two frames, there
are a total of eight frames on the shared medium.
fre
Some of these frames collide because multiple frames are in contention for the shared
channel. Figure 1 shows that only two frames survive: one frame from station 1 and one
frame from station 3.
s4
If one bit of a frame coexists on the channel with one bit from another frame, there is a
te
collision and both will be destroyed. It is obvious that the frames have to be resend that
have been destroyed during transmission.
no
The pure ALOHA protocol relies on acknowledgments from the receiver. When a station
sends a frame, it expects the receiver to send an acknowledgment. If the acknowledgment
does not arrive after a time-out period, the station assumes that the frame (or the
acknowledgment) has been destroyed and resends the frame.
A collision involves two or more stations. If all these stations try to resend their frames
after the time-out, the frames will collide again.
Pure ALOHA dictates that when the time-out period passes, each station waits a random
amount of time before resending its frame. The randomness will help avoid more
collisions. This time is called as the back off time TB.
Pure ALOHA has a second method to prevent congesting the channel with retransmitted
frames. After a maximum number of retransmission attempts Kmax, a station must give
up and try later. Figure 1 shows the procedure for pure ALOHA based on the above
strategy.
The time-out period is equal to the maximum possible round-trip propagation delay,
which is twice the amount of time required to send a frame between the two most widely
separated stations (2 × Tp).
The backoff time TB is a random value that normally depends on K (the number of
attempted unsuccessful transmissions).
In this method, for each retransmission, a multiplier R = 0 to 2K is randomly chosen and
multiplied by Tp (maximum propagation time) or Tfr (the average time required to send
out a frame) to find TB.
Note: The range of the random numbers increases after each collision. The value of Kmax
is usually chosen as 15.
n
e.i
fre
s4
te
no
PROBLEM 1
The stations on a wireless ALOHA network are a maximum of 600 km apart. If we assume
that signals propagate at 3 × 108 m/s, find Tp . Assume K = 2, Find the range of R.
Solution: Tp = (600 × 103) / (3 × 108) = 2 ms.
The range of R is, R=( 0 to 2k ) = {0, 1, 2, 3}.
This means that TB can be 0, 2, 4, or 6 ms, based on the outcome of the random variable R.
Vulnerable time
The length of time in which there is a possibility of collision. The stations send fixed-length
frames with each frame taking Tfr seconds to send. Figure 4 shows the vulnerable time for
station B.
n
e.i
Figure 4: Vulnerable time for pure ALOHA protocol
fre
Station B starts to send a frame at time t. Imagine station A has started to send its frame after
t − Tfr . This leads to a collision between the frames from station B and station A. On the
s4
other hand, suppose that station C starts to send a frame before time t + Tfr. There is also a
collision between frames from station B and station C.
te
From the Figure 4, it can be seen that the vulnerable time during which a collision may occur
in pure ALOHA is 2 times the frame transmission time.
no
PROBLEM 2
A pure ALOHA network transmits 200-bit frames on a shared channel of 200 kbps. What is
the requirement to make this frame collision-free?
Solution: Average frame transmission time Tfr is 200 bits/200 kbps or 1 ms.
The vulnerable time is 2 × 1 ms = 2 ms.
This means no station should send later than 1 ms before this station starts
transmission and no station should start sending during the period (1 ms) that this station is
sending.
Throughput
G = the average number of frames generated by the system during one frame transmission
time (Tfr)
S= the average number of successfully transmitted frames for pure ALOHA.
And is given by, S = G × e−2G. ------------------------(1)
Differentiate equation (1) with respect to G and equate it to 0, we get G = 1/2.
Substitute G=1/2 in equation (1) to get Smax.
The maximum throughput Smax = 0.184.
If one-half a frame is generated during one frame transmission time (one frame during
two frame transmission times), then 18.4 percent of these frames reach their destination
successfully.
G is set to G = 1/2 to produce the maximum throughput because the vulnerable time is 2
n
times the frame transmission time. Therefore, if a station generates only one frame in this
e.i
vulnerable time (and no other stations generate a frame during this time), the frame will
reach its destination successfully.
fre
NOTE: The throughput for pure ALOHA is S = G × e-2G.
s4
PROBLEM 3
no
A pure ALOHA network transmits 200-bit frames on a shared channel of 200 kbps. What is
the throughput if the system (all stations together) produces
a. 1000 frames per second?
b. 500 frames per second?
c. 250 frames per second?
Solution: The frame transmission time Tfr is 200/200 kbps or 1 ms.
(a) If the system creates 1000 frames per second, or 1 frame per millisecond ( 1s = 1000ms)
then G = 1 (because G= number of frames generated for one Tfr).
S = G × e−2G = 0.135 (13.5 percent). This means that the throughput is
1000 ×0.135 = 135 frames. Only 135 frames out of 1000 will probably survive.
(b) If the system creates 500 frames per second, or 1/2 frame per millisecond ( 1s = 1000ms)
then G = 1/2 (because G= number of frames generated for one Tfr).
S = G × e−2G = 0.184 (18.4 percent). This means that the throughput is
500 ×0.184 = 92 frames. Only 92 frames out of 500 will probably survive.
(c) If the system creates 250 frames per second, or 1/4 frame per millisecond ( 1s = 1000ms)
then G = 1/4 (because G= number of frames generated for one Tfr).
S = G × e−2G = 0.152 (15.2 percent). This means that the throughput is
250 ×0.152 = 135 frames. Only 38 frames out of 250 will probably survive.
Slotted ALOHA
Pure ALOHA has a vulnerable time of 2 × Tfr. This is so because there is no rule that
defines when the station can send.
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
n
to send only at the beginning of the time slot. Figure 5 shows an example of frame collisions
in slotted ALOHA.
e.i
fre
s4
te
no
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.
There is still the possibility of collision if two stations try to send at the beginning of the
same time slot. However, the vulnerable time is now reduced to one-half, equal to Tfr.
Figure 6 shows the situation.
Throughput
n
G = the average number of frames generated by the system during one frame transmission
e.i
time (Tfr)
fre
S= the average number of successfully transmitted frames for Slotted ALOHA.
And is given by, S = G × e−G. ------------------------(1)
Differentiate equation (1) with respect to G and equate it to 0, we get G = 1.
s4
If one frame is generated during one frame transmission time then 36.8 percent of these
no
PROBLEM 3
A Slotted ALOHA network transmits 200-bit frames on a shared channel of 200 kbps. What
is the throughput if the system (all stations together) produces
a. 1000 frames per second?
n
then G = 1/4 (because G= number of frames generated for one Tfr).
e.i
S = G × e−G = 0.195 (19.5 percent). This means that the throughput is
250 ×0.195 = 49 frames. Only 49 frames out of 250 will probably survive.
fre
CSMA
s4
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
te
Carrier sense multiple access (CSMA) requires that each station first listen to the
medium (or check the state of the medium) before sending.
CSMA is based on the principle “sense before transmit” or “listen before talk.”
CSMA can reduce the possibility of collision, but it cannot eliminate it. The reason
for this is shown in Figure 7, a space and time model of a CSMA network. Stations
are connected to a shared channel.
The possibility of collision still exists because of propagation delay; when a station sends
a frame, it still takes time (although very short) for the first bit to reach every station and
for every station to sense it.
A station may sense the medium and find it idle, only because the first bit sent by another
station has not yet been received.
n
At time t1, station B senses the medium and finds it idle, so it sends a frame. At time t2
e.i
(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
fre
collide and both frames are destroyed.
Vulnerable Time
s4
The vulnerable time for CSMA is the propagation time Tp. This is the time needed for a
signal to propagate from one end of the medium to the other.
te
When a station sends a frame and any other station tries to send a frame during this time,
a collision will result.
no
But if the first bit of the frame reaches the end of the medium, every station will already
have heard the bit and will refrain from sending.
Figure 8 below shows the worst case. The leftmost station, A, sends a frame at time t1,
which reaches the rightmost station, D, at time t1 + Tp. The gray area shows the
vulnerable area in time and space.
Persistence Methods
Persistence method is developed to determine what the station has to do whenever it
encounters the channel is idle or busy. There are 3 persistent methods
1. 1-persistent method
2. Non persistent method, and
3. p-Persistent method.
Figure 9 shows the behaviour of three persistence methods when a station finds a channel
busy.
n
e.i
fre
s4
1-Persistent
no
Non persistent
In the non persistent 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 non persistent 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.
This method reduces the efficiency of the network because the medium remains idle
when there may be stations with frames to send.
n
e.i
fre
s4
te
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.
The p-persistent approach combines the advantages of the other two strategies. 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.
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.
Station monitors the medium after it sends a frame to see if the transmission was
successful.
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
In Figure 11, stations A and C are involved in the collision.
n
e.i
fre
s4
te
no
At time t1, station A has executed its persistence procedure and starts sending the bits
of its frame. At time t2, station C has not yet sensed the first bit sent by A.
Station C executes its persistence procedure and starts sending the bits in its frame,
which propagate both to the left and to the right.
The collision occurs sometime after time t2. Station C detects a collision at time t3
when it receives the first bit of A’s frame. Station C immediately aborts transmission.
Station A detects collision at time t4 when it receives the first bit of C’s frame, it also
immediately aborts transmission.
From the Figure 11, A transmits for the duration t4 -t1, C transmits for the duration t3 -t2.
n
Before sending the last bit of the frame, the sending station must detect a collision, if any,
and abort the transmission. e.i
Once the entire frame is sent, station does not keep a copy of the frame and does not
fre
monitor the line for collision detection. Therefore, the frame transmission time Tfr must
be at least two times the maximum propagation time Tp.
s4
If the two stations involved in a collision are the maximum distance apart, the signal from
the first takes time Tp to reach the second, and the effect of the collision takes another
te
time Tp to reach the first. So the requirement is that the first station must still be
transmitting after 2Tp.
no
PROBLEM:
A network using CSMA/CD has a bandwidth of 10 Mbps. If the maximum propagation time
(including the delays in the devices and ignoring the time needed to send a jamming signal) is
25.6 µs, what is the minimum size of the frame?
Solution:
The minimum frame transmission time is Tfr = 2 × Tp = 51.2 µs. This means, in the worst
case, a station needs to transmit for a period of 51.2 µs to detect the collision.
The minimum size of the frame is, Band width × Tfr = 10 Mbps × 51.2 µs = 512 bits or 64
bytes. This is actually the minimum size of the frame for Standard Ethernet.
n
e.i
Figure 13: Flow diagram for the CSMA/CD
The flow diagram for CSMA/CD is as shown in Figure 13. It is similar to the one for the
fre
ALOHA protocol, but there are differences.
1. The first difference is the addition of the persistence process. It is required to sense the
s4
channel before sending the frame by using one of the persistence processes (non
persistent, 1 persistent, or p-persistent).
te
2. The second difference is the frame transmission. In ALOHA, there is transmission of the
no
entire frame and then wait for an acknowledgment. In CSMA/CD, transmission and
collision detection are continuous processes.
It is not like the entire frame is sent and then look for a collision. The station transmits
and receives continuously and simultaneously (using two different ports or a
bidirectional port).
Loop is used to show that transmission is a continuous process. It is constantly
monitored in order to detect one of two conditions: either transmission is finished or a
collision is detected.
Either event stops transmission. When it comes out of the loop, if a collision has not
been detected, it means that transmission is complete; the entire frame is transmitted.
Otherwise, a collision has occurred.
3. The third difference is the sending of a short jamming signal to make sure that all other
stations become aware of the collision.
Energy Level
The level of energy in a channel can have three values:
1) Zero level : The channel is idle
2) Normal level: A station has successfully captured the channel and is sending its frame.
3) Abnormal level: There is a collision and the level of the energy is twice the normal level.
n
e.i
Figure 14: Energy level during transmission, idleness, or collision
fre
NOTE: A station that has a frame to send or is sending a frame needs to monitor the energy
level to determine if the channel is idle, busy, or in collision mode.
s4
Throughput
te
The maximum throughput occurs at a different value of G and is based on the persistence
method and the value of p in the p-persistent approach.
For the 1-persistent method, the maximum throughput is around 50 percent when G = 1.
For the non persistent method, the maximum throughput can go up to 90 percent when G
is between 3 and 8.
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.
n
of the transmitted signal by the distant station to reach this station.
e.i
After waiting an IFS time, if the channel is still idle, the station can send, but it still needs
to wait a time equal to the contention window.
fre
The IFS variable can also be used to prioritize stations or frame types. For example, a
station that is assigned a shorter IFS has a higher priority.
s4
Contention Window
te
The contention window is an amount of time divided into slots. A station that is ready to
no
Acknowledgement
Even with all the precautions considered, there still may be a collision resulting in destroyed
data. In addition, the data may be corrupted during the transmission. The positive
n
acknowledgment and the time-out timer can help guarantee that the receiver has received the
frame. e.i
fre
Frame Exchange Time Line
Figure 17 shows the exchange of data and control frames in time.
s4
te
no
1. Before sending a frame, the source station senses the medium by checking the energy level
at the carrier frequency.
a. The channel uses a persistence strategy with back off until the channel is idle.
b. After the station is found to be idle, the station waits for a period of time called the
DCF inter frame space (DIFS),then the station sends a control frame called the request
to send (RTS).
2. After receiving the RTS and waiting a period of time called the short inter frame space
(SIFS), the destination station sends a control frame, called the clear to send (CTS), to the
source station. This control frame indicates that the destination station is ready to receive
data.
3. The source station sends data after waiting an amount of time equal to SIFS.
4. The destination station, after waiting an amount of time equal to SIFS, sends an
n
acknowledgment to show that the frame has been received. Acknowledgment is needed in
e.i
this protocol because the station does not have any means to check for the successful arrival
of its data at the destination. On the other hand, the lack of collision in CSMA/CD is a kind
fre
of indication to the source that data have arrived.
s4
NOTE: DIFS=DCF Inter frame space or Distributed Coordination Function Inter frame Space
time.
te
When a station sends an RTS frame, it includes the duration of time that it needs to
occupy the channel.
The stations that are affected by this transmission create a timer called a Network
Allocation Vector (NAV) that shows how much time must pass before these stations are
allowed to check the channel for idleness.
Each time a station accesses the system and sends an RTS frame, other stations start their
NAV. In other words, each station, before sensing the physical medium to see if it is idle,
first checks its NAV to see if it has expired. Figure 17 shows the idea of NAV.
Two or more stations may try to send RTS frames at the same time. These control
frames may collide. However, because there is no mechanism for collision detection,
the sender assumes there has been a collision if it has not received a CTS frame from
the receiver. The back off strategy is employed, and the sender tries again.
Hidden-Station Problem
The solution to the hidden station problem is the use of the handshake frames (RTS and
CTS). Figure 17 shows that the RTS message from A reaches B, but not C.
Both A and C are within the range of B, the CTS message, which contains the duration of
data transmission from B to A, reaches C.
Station C knows that some hidden station is using the channel and refrains from
transmitting until that duration is over.
n
CONTROLLED ACCESS
e.i
In controlled access, the stations consult one another to find which station has the right to
fre
send. A station cannot send unless it has been authorized by other stations.
There are three controlled access methods,
s4
1. Reservation.
2. Polling.
te
3. Token passing.
no
1. Reservation
If there are N stations in the system, there are exactly N reservation minislots in the
reservation frame. Each mini slot 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 18 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.
2. 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
n
destination is a secondary device. The primary device controls the link; the secondary
devices follow its instructions.
e.i
The primary device determines which device is allowed to use the channel at a given
fre
time. The primary device, therefore, is always the initiator of a session
This method uses poll and select functions to prevent collisions. However, the drawback
s4
Select
The select function is used whenever the primary device has something to send. Since the
primary controls the link. If it is neither sending nor receiving data, it knows the link is
available.
If it has something to send, the primary device sends it. The primary station has to
confirm whether the target device is prepared to receive.
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 field of which includes the address of the
intended secondary.
Poll
The poll function is used by the primary device to solicit transmissions from the
n
secondary devices.
e.i
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
fre
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
s4
3. 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.
In this method, a special packet called a token circulates through the ring. The possession
of the token gives the station the right to access the channel and send its data. When a
station has some data to send, it waits until it receives the token from its predecessor. It
then holds the token and sends its data.
When the station has no more data to send, it releases the token, passing it to the next
logical station in the ring. The station cannot send data until it receives the token again in
the next round. In this process, when a station receives the token and has no data to send,
it just passes the data to the next station.
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. For example, if a station that is holding the token fails, the token
will disappear from the network.
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.
n
Logical Ring
e.i
In a token-passing network, stations do not have to be physically connected in a ring; the ring
can be a logical one. Figure 20 shows four different physical topologies that can create a
fre
logical ring.
s4
te
no
Figure 20: Logical ring and physical topology in token-passing access method
n
becomes idle again.
e.i
Each station needs to have two transmitter ports and two receiver ports. The high-
speed Token Ring networks called FDDI (Fiber Distributed Data Interface) and CDDI
fre
(Copper Distributed Data Interface) use this topology.
(c) Bus Ring:
s4
In the bus ring topology, also called a token bus, the stations are connected to a single cable called a
bus. They, make a logical ring, because each station knows the address of its successor (and also
te
successor in the token. Only the station with the address matching the destination address of the token
gets the token to access the shared media. The Token Bus LAN, standardized by IEEE, uses this
topology.
(d) Star Ring:
In a star ring topology, the physical topology is a star. There is a hub, however, that
acts as the connector.
The wiring inside the hub makes the ring; the stations are connected to this ring
through the two wire connections.
This topology makes the network less prone to failure because if a link goes down, it
will be bypassed by the hub and the rest of the stations can operate.
Adding and removing stations from the ring is easier. This topology is still used in the
Token Ring LAN designed by IBM.
MODULE 2 (continued..)
A local area network (LAN) is a computer network that is designed for a limited geographic
area such as a building or a campus. Although a LAN can be used as an isolated network to
connect computers in an organization for the sole purpose of sharing resources, most LANs
today are also linked to a wide area network (WAN) or the Internet. Almost every LAN
except Ethernet has disappeared from the marketplace because Ethernet was able to update
itself to meet the needs of the time
n
In 1985, the Computer Society of the IEEE started a project, called Project 802, to set
e.i
standards to enable intercommunication among equipment from a variety of
manufacturers.
fre
Project 802 does not seek to replace any part of the OSI model or TCP/IP protocol suite.
Instead, it is a way of specifying functions of the physical layer and the data-link layer of
s4
The IEEE has subdivided the data-link layer into two sub layers:
no
n
specific access method for each LAN. For example, it defines CSMA/CD as the media
e.i
access method for Ethernet LANs and defines the token-passing method for Token Ring
and Token Bus LANs.
fre
Part of the framing function is also handled by the MAC layer.
s4
Ethernet Evolution
The Ethernet LAN was developed in the 1970s by Robert Metcalfe and David Boggs.
te
STANDARD ETHERNET
Characteristics
1. Connectionless and Unreliable Service
Ethernet provides a connectionless service, which means each frame sent is
independent of the previous or next frame. Ethernet has no connection establishment
or connection termination phases.
The sender sends a frame whenever it has, the receiver may or may not be ready for it.
The sender may overwhelm the receiver with frames, which may result in dropping
frames. If a frame drops, the sender will not know about it. Since IP, which is using
the service of Ethernet, is also connectionless, it will not know about it either. If the
n
transport layer is also a connectionless protocol, such as UDP, the frame is lost and
salvation may only come from the application layer. However, if the transport layer is
e.i
TCP, the sender TCP does not receive acknowledgment for its segment and sends it
again.
fre
Ethernet is also unreliable like IP and UDP. If a frame is corrupted during
transmission and the receiver finds out about the corruption, which has a high level of
s4
probability of happening because of the CRC-32, the receiver drops the frame silently.
It is the duty of high-level protocols to find out about it.
te
2. Frame Format
no
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 of
synchronization. The pattern provides only an alert and a timing pulse. The 56-bit pattern
allows the stations to miss some bits at the beginning of the frame. The preamble is
actually added at the physical layer and is not part of the frame.
Start frame delimiter (SFD). This field (1 byte: 10101011) signals the beginning of the
frame. The SFD warns the station or stations that this is the last chance for
synchronization. The last 2 bits are (11)2 and alert the receiver that the next field is the
destination address. This field is actually a flag that defines the beginning of the frame, an
Ethernet frame is a variable-length frame. It needs a flag to define the beginning of the
frame. The SFD field is also added at the physical layer.
n
e.i
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. When the receiver sees
fre
its own link-layer address, or a multicast address for a group that the receiver is a member
of, or a broadcast address, it decapsulates the data from the frame and passes the data to
s4
the upper layer protocol defined by the value of the type field.
te
Source address (SA). This field is also six bytes and contains the link-layer address of
no
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. In other words, it serves the same
purpose as the protocol field in a datagram and the port number in a segment or user
datagram. It is used for multiplexing and demultiplexing.
Data. This field carries data encapsulated from the upper-layer protocols. It is a minimum
of 46 and a maximum of 1500 bytes. If the data coming from the upper layer is more than
1500 bytes, it should be fragmented and encapsulated in more than one frame. If it is less
than 46 bytes, it needs to be padded with extra 0s. A padded data frame is delivered to the
upper-layer protocol as it is (without removing the padding), which means that it is the
responsibility of the upper layer to remove or, in the case of the sender, to add the
padding. The upper-layer protocol needs to know the length of its data. For example, a
datagram has a field that defines the length of the data.
CRC. The last field contains error detection information, in this case a CRC-32. The
CRC is calculated over the addresses, types, and data field. If the receiver calculates
the CRC and finds that it is not zero (corruption in transmission), it discards the
frame.
3. Frame Length
Ethernet has imposed restrictions on both the minimum and maximum lengths of a
frame. The minimum length restriction is required for the correct operation of
CSMA/CD.
An Ethernet frame needs to have a minimum length of 512 bits or 64 bytes. Part of
n
this length is the header and the trailer. If we count 18 bytes of header and trailer (6
e.i
bytes of source address, 6 bytes of destination address, 2 bytes of length or type, and 4
bytes of CRC), then the minimum length of data from the upper layer is 64 − 18 = 46
fre
bytes. If the upper-layer packet is less than 46 bytes, padding is added to make up the
difference.
s4
The standard defines the maximum length of a frame (without preamble and SFD
field) as 1518 bytes. If we subtract the 18 bytes of header and trailer, the maximum
te
NOTE:
Minimum frame length: 64 bytes Minimum data length: 46 bytes
Maximum frame length: 1518 bytes Maximum data length: 1500 bytes
Addressing
Each station on an Ethernet network (such as a PC, workstation, or printer) has its own
network interface card (NIC). The NIC fits inside the station and provides the station with a
link-layer address. The Ethernet address is 6 bytes (48 bits), normally written in hexadecimal
notation, with a colon between the bytes. For example, the following shows an Ethernet
MAC address:
4A:30:10:21:10:1A
n
bit that defines an address as unicast or multicast arrives first at the receiver. This helps the
e.i
receiver to immediately know if the packet is unicast or multicast.
fre
Example
Show how the address 47:20:1B:2E:08:EE is sent out online.
s4
Solution: The address is sent left to right, byte by byte; for each byte, it is sent right to left, bit
by bit, as shown below
te
no
A source address is always a unicast address, the frame comes from only one station. The
destination address, however, can be unicast, multicast, or broadcast. Figure 4 shows how to
distinguish a unicast address from a multicast address. If the least significant bit of the first
byte in a destination address is 0, the address is unicast; otherwise, it is multicast. With the
way the bits are transmitted, the unicast/multicast bit is the first bit which is transmitted or
received. The broadcast address is a special case of the multicast address: the recipients are
all the stations on the LAN. A broadcast destination address is forty-eight 1s.
Example
Define the type of the following destination addresses
a. 4A:30:10:21:10:1A
b. 47:20:1B:2E:08:EE
c. FF:FF:FF:FF:FF:FF
Solution: To find the type of the address, we need to look at the second hexadecimal digit
n
from the left. If it is even, the address is unicast. If it is odd, the address is multicast. If all
e.i
digits are Fs, the address is broadcast. Therefore, we have the following:
a. This is a unicast address because A in binary is 1010 (even).
fre
b. This is a multicast address because 7 in binary is 0111 (odd).
c. This is a broadcast address because all digits are Fs in hexadecimal.
s4
Access Method
te
Since the network that uses the standard Ethernet protocol is a broadcast network, The
no
standard Ethernet chose CSMA/CD with 1-persistent method, Let us use a scenario to see
how this method works for the Ethernet protocol.
Assume station A in Figure.5 has a frame to send to station D. Station A first should
check whether any other station is sending (carrier sense). Station A measures the level of
energy on the medium (for a short period of time, normally less than 100µs). If there is no
signal energy on the medium, it means that no station is sending (or the signal has not
reached station A). Station A interprets this situation as idle medium. It starts sending its
frame. On the other hand, if the signal energy level is not zero, it means that the medium
is being used by another station. Station A continuously monitors the medium until it
becomes idle for 100µs. It then starts sending the frame. However, station A needs to
keep a copy of the frame in its buffer until it is sure that there is no collision.
The medium sensing does not stop after station A has started sending the frame. Station A
needs to send and receive continuously. Two cases may occur:
n
(a) Station A has sent 512 bits and no collision is sensed (the energy level did not go
e.i
above the regular energy level), the station then is sure that the frame will go through
and stops sensing the medium. Where does the number 512 bits come from? If we
fre
consider the transmission rate of the Ethernet as 10 Mbps, this means that it takes the
station 512/(10 Mbps) = 51.2 μs to send out 512 bits. With the speed of propagation in
s4
a cable (2 × 108 meters), the first bit could have gone 10,240 meters (one way) or
only 5120 meters (round trip), have collided with a bit from the last station on the
te
cable, and have gone back. In other words, if a collision were to occur, it should occur
no
by the time the sender has sent out 512 bits (worst case) and the first bit has made a
round trip of 5120 meters, if the collision happens in the middle of the cable, not at
the end, station A hears the collision earlier and aborts the transmission. The above
assumption is that the length of the cable is 5120 meters. The designer of the standard
Ethernet actually put a restriction of 2500 meters because we need to consider the
delays encountered throughout the journey. It means that they considered the worst
case. The whole idea is that if station A does not sense the collision before sending
512 bits, there must have been no collision, because during this time, the first bit has
reached the end of the line and all other stations know that a station is sending and
refrain from sending. In other words, the problem occurs when another station (for
example, the last station) starts sending before the first bit of station A has reached it.
The other station mistakenly thinks that the line is free because the first bit has not yet
reached it. The restriction of 512 bits actually helps the sending station: The sending
station is certain that no collision will occur if it is not heard during the first 512 bits,
so it can discard the copy of the frame in its buffer.
(b) Station A has sensed a collision before sending 512 bits. This means that one of the
previous bits has collided with a bit sent by another station. In this case both stations
should refrain from sending and keep the frame in their buffer for resending when the
line becomes available. However, to inform other stations that there is a collision in
the network, the station sends a 48-bit jam signal. The jam signal is to create enough
signal (even if the collision happens after a few bits) to alert other stations about the
collision. After sending the jam signal, the stations need to increment the value of K
(number of attempts). If after increment K = 15, the experience has shown that the
network is too busy, the station needs to abort its effort and try again. If K < 15, the
station can wait a backoff time (TB) and restart the process. The station creates a
n
random number between 0 and 2K − 1, which means each time the collision occurs,
e.i
the range of the random number increases exponentially. After the first collision (K =
1) the random number is in the range (0, 1). After the second collision (K = 2) it is in
fre
the range (0, 1, 2, 3). After the third collision (K = 3) it is in the range (0, 1, 2, 3, 4, 5,
6, 7). So after each collision, the probability increases that the backoff time becomes
s4
longer. This is due to the fact that if the collision happens even after the third or fourth
attempt, it means that the network is really busy; a longer backoff time is needed.
te
no
Efficiency =
The transmission delay is the time it takes a frame of average size to be sent out and the
propagation delay is the time it takes to reach the end of the medium. As the value of
parameter decreases, the efficiency increases. This means that if the length of the media is
shorter or the frame size longer, the efficiency increases. In the ideal case, = 0 and the
efficiency is 1.
Example 13.3
In the Standard Ethernet with the transmission rate of 10 Mbps, we assume that the length of
the medium is 2500 m and the size of the frame is 512 bits. The propagation speed of a signal
in a cable is normally 2 × 108 m/s.
The example shows that a = 0.24, which means only 0.24 of a frame occupies the whole
medium in this case. The efficiency is 39 percent, which is considered moderate; it means
n
that only 61 percent of the time the medium is occupied but not used by a station.
Implementation
e.i
fre
The Standard Ethernet defined several implementations, but only four of them became
popular during the 1980s. Table below shows a summary of Standard Ethernet
s4
implementations.
te
no
In the nomenclature 10BaseX, the number defines the data rate (10 Mbps), the term Base
means baseband (digital) signal, and X approximately defines either the maximum size of the
cable in 100 meters (for example 5 for 500 or 2 for 185 meters) or the type of cable, T for
unshielded twisted pair cable (UTP) and F for fiber-optic. The standard Ethernet uses a
baseband signal, which means that the bits are changed to a digital signal and directly sent on
the line.
self-synchronous, providing a transition at each bit interval. Figure 6 shows the encoding
scheme for Standard Ethernet.
n
derives from the size of the cable, which is roughly the size of a garden hose and too stiff to
bend with your hands. 10Base5 was the first Ethernet specification to use a bus topology with
e.i
an external transceiver (transmitter/receiver) connected via a tap to a thick coaxial cable.
Figure 7 shows a schematic diagram of a 10Base5 implementation.
fre
s4
te
no
interface card (NIC), which is installed inside the station. Figure 8 shows the schematic
diagram of a 10Base2 implementation.
n
The collision here occurs in the thin coaxial cable. This implementation is more cost effective
e.i
than 10Base5 because thin coaxial cable is less expensive than thick coaxial and the tee
connections are much cheaper than taps. Installation is simpler because the thin coaxial cable
fre
is very flexible. However, the length of each segment cannot exceed 185 m (close to 200 m)
due to the high level of attenuation in thin coaxial cable.
s4
physical star topology. The stations are connected to a hub via two pairs of twisted cable, as
shown in Figure 9.
10Base2, we can see that the hub actually replaces the coaxial cable as far as a collision is
concerned. The maximum length of the twisted cable here is defined as 100 m, to minimize
the effect of attenuation in the twisted cable.
n
e.i
fre
Figure 10: 10Base-F implementation
s4
FDDI and Fiber Channel, appeared on the market. If the Standard Ethernet wanted to survive,
no
it had to compete with these technologies. Ethernet made a big jump by increasing the
transmission rate to 100 Mbps, and the new generation was called the Fast Ethernet. The
designers of the Fast Ethernet needed to make it compatible with the Standard Ethernet. The
MAC sublayer was left unchanged, which meant the frame format and the maximum and
minimum size could also remain unchanged. By increasing the transmission rate, features of
the Standard Ethernet that depend on the transmission rate, access method, and
implementation had to be reconsidered.
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.
Access Method
The proper operation of the CSMA/CD depends on the transmission rate, the minimum size
of the frame, and the maximum network length. If we want to keep the minimum size of the
frame, the maximum length of the network should be changed. In other words, if the
minimum frame size is still 512 bits, and it is transmitted 10 times faster, the collision needs
to be detected 10 times sooner, which means the maximum length of the network should be
10 times shorter (the propagation speed does not change). So the Fast Ethernet came with two
solutions (it can work with either choice):
1. The first solution was to totally drop the bus topology and use a passive hub and star
topology but make the maximum size of the network 250 meters instead of 2500
meters as in the Standard Ethernet. This approach is kept for compatibility with the
Standard Ethernet.
n
2. The second solution is to use a link-layer switch with a buffer to store frames and a
e.i
full-duplex connection to each host to make the transmission medium private for each
host. In this case, there is no need for CSMA/CD because the hosts are not competing
fre
with each other. The link-layer switch receives a frame from a source host and stores
it in the buffer (queue) waiting for processing. It then checks the destination address
s4
and sends the frame out of the corresponding interface. Since the connection to the
switch is full-duplex, the destination address can even send a frame to another station
te
at the same time that it is receiving a frame. In other words, the shared medium is
no
changed to many point-to- point media, and there is no need for contention.
Autonegotiation
A new feature added to Fast Ethernet is called autonegotiation. It allows a station or a hub
a range of capabilities. Autonegotiation allows two devices to negotiate the mode or data
rate of operation. It was designed particularly to allow incompatible devices to connect to
one another.
It was designed particularly for these purposes:
To allow incompatible devices to connect to one another. For example, a device with
a maximum capacity of 10 Mbps can communicate with a device with a 100 Mbps
capacity (but which can work at a lower rate).
To allow one device to have multiple capabilities.
To allow a station to check a hub’s capabilities.
Physical Layer
Topology
Fast Ethernet is designed to connect two or more stations. If there are only two stations, they
can be connected point-to-point. Three or more stations need to be connected in a star
topology with a hub or a switch at the center.
Encoding
Manchester encoding needs a 200-Mbaud bandwidth for a data rate of 100 Mbps, which
makes it unsuitable for a medium such as twisted-pair cable. For this reason, the Fast
Ethernet designers sought some alternative encoding/decoding scheme. However, it was
found that one scheme would not perform equally well for all three implementations.
Therefore, three different encoding schemes were chosen.
n
e.i
fre
s4
te
no
occurrence of a long sequence of 0s and 1s. This creates a data rate of 125 Mbps,
which is fed into MLT-3 for encoding.
2. 100Base-FX uses two pairs of fiber-optic cables. Optical fiber can easily handle high
bandwidth requirements by using simple encoding schemes. The designers of
100Base-FX selected the NRZ-I encoding scheme for this implementation. However,
NRZ-I has a bit synchronization problem for long sequences of 0s (or 1s, based on the
encoding). To overcome this problem, the designers used 4B/5B block encoding, as
we described for 100Base-TX. The block encoding increases the bit rate from 100 to
125 Mbps, which can easily be handled by fiber-optic cable.
A 100Base-TX network can provide a data rate of 100 Mbps, but it requires the use of
category 5 UTP or STP cable. This is not cost-efficient for buildings that have already
been wired for voice-grade twisted-pair (category 3).
n
3. 100Base-T4, was designed to use category 3 or higher UTP. The implementation uses
e.i
four pairs of UTP for transmitting 100 Mbps. Encoding/decoding in 100Base-T4 is
more complicated. As this implementation uses category 3 UTP, each twisted-pair
fre
cannot easily handle more than 25 Mbaud. In this design, one pair switches between
sending and receiving. Three pairs of UTP category 3, however, can handle only 75
s4
Mbaud (25 Mbaud) each. We need to use an encoding scheme that converts 100 Mbps
to a 75 Mbaud signal. 8B/6T satisfies this requirement. In 8B/6T, eight data elements
te
are encoded as six signal elements. This means that 100 Mbps uses only (6/8) × 100
no
Mbps, or 75 Mbaud.
GIGABIT ETHERNET
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, but keep the address length, the frame
format, and the maximum and minimum frame length the same. The goals of the Gigabit
Ethernet design can be summarized as follows:
MAC Sublayer
A main consideration in the evolution of Ethernet was to keep the MAC sublayer untouched.
However, to achieve a data rate of 1 Gbps, this was no longer possible. Gigabit Ethernet has
two distinctive approaches for medium access: half-duplex and fullduplex. Almost all
implementations of Gigabit Ethernet follow the full-duplex approach, so we mostly ignore
n
the half-duplex mode.
Full-Duplex Mode
e.i
In full-duplex mode, there is a central switch connected to all computers or other switches. In
fre
this mode, for each input port, each switch has buffers in which data are stored until they are
transmitted. Since the switch uses the destination address of the frame and sends a frame out
s4
of the port connected to that particular destination, there is no collision. This means that
CSMA/CD is not used. Lack of collision implies that the maximum length of the cable is
te
determined by the signal attenuation in the cable, not by the collision detection process.
no
NOTE: In the full-duplex mode of Gigabit Ethernet, there is no collision; the maximum
length of the cable is determined by the signal attenuation in the cable.
Half-Duplex Mode
The half-duplex approach uses CSMA/CD. the maximum length of the network in this
approach is totally dependent on the minimum frame size.
Three methods have been defined:
Traditional
Carrier extension, and
Frame bursting.
Traditional
In the traditional approach, we keep the minimum length of the frame as in traditional
Ethernet (512 bits). However, because the length of a bit is 1/100 shorter in Gigabit Ethernet
than in 10-Mbps Ethernet, the slot time for Gigabit Ethernet is 512 bits × 1/1000 μs, which is
equal to 0.512 μs. The reduced slot time means that collision is detected 100 times earlier.
This means that the maximum length of the network is 25 m. This length may be suitable if
all the stations are in one room, but it may not even be long enough to connect the computers
in one single office.
Carrier Extension
To allow for a longer network, we increase the minimum frame length. The carrier extension
approach defines the minimum length of a frame as 512 bytes (4096 bits). This means that
the minimum length is 8 times longer. This method forces a station to add extension bits
n
(padding) to any frame that is less than 4096 bits. In this way, the maximum length of the
e.i
network can be increased 8 times to a length of 200 m. This allows a length of 100m from the
hub to the station.
fre
Frame Bursting
Carrier extension is very inefficient if we have a series of short frames to send; each frame
s4
carries redundant data. To improve efficiency, frame bursting was proposed. Instead of
adding an extension to each frame, multiple frames are sent. However, to make these multiple
te
frames look like one frame, padding is added between the frames (the same as that used for
no
the carrier extension method) so that the channel is not idle. In other words, the method
deceives other stations into thinking that a very large frame has been transmitted.
Physical Layer
The physical layer in Gigabit Ethernet is more complicated than that in Standard or Fast
Ethernet.
Topology
Gigabit Ethernet is designed to connect two or more stations. If there are only two stations,
they can be connected point-to-point. Three or more stations need to be connected in a star
topology with a hub or a switch at the center.
Implementation
Gigabit Ethernet can be categorized as either a two-wire or a four-wire implementation. The
two-wire implementations use fiber-optic cable (1000Base-SX, short-wave, or 1000Base-
LX, long-wave), or STP (1000Base-CX). The four-wire version uses category 5 twisted-pair
cable (1000Base-T).
Encoding
n
e.i
fre
s4
Gigabit Ethernet cannot use the Manchester encoding scheme because it involves a very
no
10 GIGABIT ETHERNET
The IEEE committee created 10 Gigabit Ethernet and called it Standard 802.3ae.
The goals of the 10 Gigabit Ethernet design can be summarized as upgrading the data rate
to 10 Gbps, keeping the same frame size and format, and allowing the interconnection of
LANs, MANs, and WAN possible.
This data rate is possible only with fiber-optic technology at this time. The standard
defines two types of physical layers: LAN PHY and WAN PHY. The first is designed to
support existing LANs; the second actually defines a WAN with links connected through
SONET OC-192.
Implementation
10 Gigabit Ethernet operates only in full-duplex mode, which means there is no need for
contention; CSMA/CD is not used in 10 Gigabit Ethernet.
n
Four implementations are the most common:
1. 10GBase-SR
e.i
2. 10GBase-LR
fre
3. 10GBase-EW and
4. 10GBase-X4.
s4
te
no
Wi
rel
essLANs
I
NTRODUCTI
ON
Wirel
esscommunicat
ioni
soneofthefast
est-growingtechnologies.Thedemandf or
connect
ingdev
iceswit
houtt
heuseofcablesisincreasi
ngev erywhere.Wirel
essLANscan
befoundoncoll
egecampuses,
inoff
icebuil
dings,andinmanypubl i
careas.,
Ar
chi
tect
ural
Compar
ison
1. Medi
um
InawirelessLAN,themedium isair
,thesignali
sgeneral
lybroadcast.Whenhost sina
wirel
essLANcommuni catewit
heachot her,t
heyareshari
ngt hesamemedi um (mult
ipl
e
access).Inaveryraresi
tuat
ion,wemaybeabl etocreat
eapoi nt
-to-pointcommuni cati
on
n
betweent wowir
elesshostsbyusingav eryli
mitedbandwidt
handt wo-dir
ectionalant
ennas.
I
2.Host
nawi r
s
3.I
sol
atedLANs
no
AwiredisolatedLANisasetofhostsconnect
edv i
aali
nk-
layerswi
tch.Awir
elessi
sol
ated
LAN,caledanadhocnet
l workinwir
elessLANt er
minol
ogy
, i
sasetofhoststhat
communi catefreel
ywi
theachother
.Theconceptofali
nk-
layerswi
tchdoesnotexi
sti
n
wir
elessLANs.
4.Connect
iont
oOt
herNet
wor
ks
AwiredLANcanbeconnect edt
oanot
hernetworkoranint
ernetworksuchastheInt
ernet
usi
ngar outer
.Awirel
essLANmaybeconnectedtoawiredinf
rastr
uctur
enetwork,t
oa
wir
elessinf
rastr
uct
urenet
work,
ort
oanotherwir
elessLAN.
n
e.i
5.Mov
ingbet
weenEnv
ironment
s
fre
I
nordertomov efrom t
hewiredenv i
ronmenttoawi relessenvi
ronmentweneedt ochange
t
henetworkinter
facecardsdesignedforwir
edenv i
ronment stotheonesdesignedf or
s4
wi
rel
essenvironments.Wereplacetheli
nk-l
ayerswitchwi t
hanaccesspoint.Inthischange,
t
heli
nk-l
ayeraddresseswil
lchangebutt henetwork-layeraddr
esses(I
Paddr esses)wil
l
r
emainthesame; wear emovingfrom wir
edlinkst
owi rel
essli
nks.
te
AccessCont
rol
no
Themosti
mportanti
ssueweneedtodi
scussinawir
elessLANisaccesscont
rol
.The
CSMA/CDalgor
it
hm doesnotwor
kinwi
relessLANsf
ort hr
eer
easons:
1.Todetectacoll
i
sion, ahostneedstosendandrecei
veatthesamet i
me(sendi
ngt
he
fr
ameandr ecei
vingt hecol
li
sionsi
gnal)
,whi
chmeanst hehostneedstoworki
na
dupl
exmode.Wi relesshostsdonothaveenoughpowertodoso( thepoweri
s
suppl
i
edbybat t
eries).Theycanonlysendorr
eceiveatoneti
me.
2. Hi
ddenst
ati
onpr
obl
em,
Inthisastat
ionmaynotbeawar eofanot
herstat
ion’
str
ansmissionduet osome
obstacl
esorrangeproblems,
coll
i
sionmayoccurbutnotbedetected.Hiddenst
ati
ons
canreducethecapacit
yofthenetwor
kbecauseofthepossi
bil
i
tyofcol l
i
sion.
3.Sincet
hedist
ancebet
weenstat
ionscanbegreat
.Signal
fadi
ngcoul
dpr
eventa
st
ati
onatoneendfr
om hear
ingacoll
i
sionatt
heotherend.
Toov
ercomet
heabov
ethr
eepr
obl
ems,
Car
ri
erSenseMul
ti
pleAccesswi
thCol
l
isi
on
Av
oidance(
CSMA/
CA)wasi
nvent
edf
orwi
rel
essLANs
I
EEE802.
11PROJECT
n
IEEEhasdef i
nedt hespecif
icati
onsforawirel
essLAN,calledI
EEE802. 11,I
tcoversthe
physicalanddata-li
nkl
ay er
s.Iti
ssomet i
mescalledwir
elessEthernet
.I
nsomecount r
ies,
i
ncl
sy
udi
nony
ngt
mf
heUni
orwir
tedSt
el
ates,t
essLAN.Howev
e.i
hepubl
i
er
cusest
,Wi
Fii
het
sawi
er
r
m Wi
el
Fi(shor
essLANt
tf
hati
orwi
scer
r
el
t
if
essf
i
i
del
edbyt
i
ty
heWi
)asa
Fi
fre
Alli
ance,aglobal,
non-profi
tindust
ryassoci
ati
on
Ar
chi
tect
ure
s4
Thest
andar
ddef
inest
woki
ndsofser
vices:
• Thebasi
cser
viceset(
BSS)and
te
• Theext
endedser
viceset(
ESS)
.
no
Basi
cSer
viceSet
IEEE802.11def i
nesthebasi
cserviceset( BSS)asthebuil
dingblocksofawi r
elessLAN.A
basicservicesetismadeofstat
ionaryormobi l
ewir
elessstat
ionsandanopt ionalcent
ral
basestation,knownastheaccesspoi nt(AP).TheBSSwithoutanAPi sastand-alone
networkandcannotsenddat atootherBSSs. Iti
scaledanadhocar
l chi
tect
ure.Inthi
s
archi
tecture,st
ati
onscanfor
m anet wor kwithoutt
heneedofanAP; ABSSwi thanAPi s
somet i
mesr eferr
edtoasaninfr
astructureBSS.
Ext
endedSer
viceSet
Anextendedservi
ceset( ESS)i
smadeupoft woormoreBSSswi t
hAPs.Inthiscase,t
he
n
BSSsareconnectedthroughadist
ributi
onsystem,whi
chisawiredorawirel
essnetwork.
Thedi
ty
st
ri
but
pesofstat
i
onsy
i
ons:
st
em connect
mobi l
eandst
st
ati
e.i
heAPsi
onary
nt
heBSSs.Theext
.Themobil
estati
endedser
onsarenor
v
mal
i
cesetusest
stat
ionsi
nsi
wo
dea
BSS.Thestat
ionarystat
ionsareAPst at
ionst
hatarepartofawir
edLAN.
fre
s4
te
no
Herethestat
ionswit
hinreachofoneanot
hercancommunicat
ewithoutt
heuseofanAP.
Howev er
,communicati
onbetweenastati
oni
naBSSandt heoutsi
deBSSoccursvi
atheAP.
Theideaissi
mi l
art
ocommuni cati
oninacel
lul
arnet
wor
k.
St
ati
onTy
pes
I
EEE802.
11def
inest
hreet
ypesofst
ati
onsbasedont
hei
rmobi
l
ityi
nawi
rel
essLAN:
1.No-
tr
ansi
ti
on-i
sei
therst
ati
onar
y(notmov
ing)ormov
ingonl
yinsi
deaBSS.
2.BSS-
tr
ansi
ti
on-canmov
efr
om oneBSSt
oanot
her
,butt
hemov
ementi
sconf
inedi
nsi
de
oneESS.
3.ESS-
tr
ansi
ti
onmobi
l
ity
-canmov
efr
om oneESSt
oanot
her
.
MACSubl
ayer
I
EEE802.
11def
inest
woMACsubl
ayer
s:
• Di
str
ibut
edCo-
ordi
nat
ionFunct
ion(
DCF)
• Poi
ntCo-
ordi
nat
ionFunct
ion(
PCF)
.
Figur
e15.6showsther
elat
ionshi
pbet
weent
het
woMACsubl
ayer
s,t
heLLCsubl
ayer
,and
thephysi
call
ayer
.
n
e.i
fre
s4
te
Di
str
ibut
edCoor
dinat
ionFunct
ion
no
DCFusesCSMA/
CAast
heaccessmet
hod.
Howdoot
herstat
ionsdefersendi
ngtheirdat
aifonestati
onacquiresaccess?I
not
her
wor
ds,
howisthecoll
isi
onav oi
danceaspectofthi
sprotocolaccompli
shed?
Thekeyi
saf
eat
urecal
l
edNAV.
Thest
ati
onscr
eateati edanet
mercal
l workal
locat
ionvect
or(NAV)thatshowshowmuch
ti
memustpassbefor
ethesestat
ionsareal
lowedtocheckthechannelfori
dleness.
Net
wor
kAl
l
ocat
ionVect
or
Howi
sthecol
l
isi
onav
oidanceaspectoft
hispr
otocolaccompl
i
shed?
Thekeyi
saf
eat
urecal
l
edNAV.
Thest
ati
onscreat
eat i
mercalledanetworkall
ocat
ionvect
or(NAV)thatshowshowmuch
ti
memustpassbeforethesestati
onsareall
owedtocheckthechannelfori
dleness.Each
ti
meastati
onaccessesthesystem andsendsanCTSframe,otherst
ati
onsst ar
ttheirNAV.
n
Col
l
isi
onDur
ingHandshaki
ng
e.i
fre
Whathappensift
herei
sacol
li
sionduri
ngt
hetimewhenRTSorCTScont
rol
framesar
ein
tr
ansi
ti
on,oft
encall hehandshaki
edt ngper
iod?i.
ETwoormorest
ati
onsmaytryt
osend
RTSfr
amesatt hesameti
me.
s4
Thesecont
rol
framesmaycol
l
ide.
te
Howev er
,becausethereisnomechanism forcol
lisi
ondet
ecti
on,t
hesenderassumesther
e
hasbeenacol l
isi
onifithasnotrecei
vedaCTSf ramefrom t
herecei
ver
.Thebackoff
no
str
ategyisemployed,andthesendertri
esagain.
Hi
dden-
Stat
ionPr
obl
em
Thesol
uti
ont
othehi
ddenst
ati
onpr
obl
em i
stheuseoft
hehandshakef
rames(
RTSand
CTS)
Fi
gure15.7alsoshowsthattheRTSmessagef rom AreachesB,butnotC.Howev er,
becausebothBandCar ewithi
ntherangeofA, theCTSmessage, whichcont
ainsthe
durati
onofdatatr
ansmissi
onfrom AtoB,reachesC.St at
ionCknowst hatsomehi dden
stat
ionisusi
ngthechannelandref
rai
nsfrom tr
ansmitt
ingunti
lthatdurat
ionisover.
Poi
ntCoor
dinat
ionFunct
ion(
PCF)
Thepoi
ntcoordi
nati
onfuncti
on(PCF)isanoptionalaccessmethodthatcanbe
i
mplementedinaninf
rast
ruct
urenetwork(noti
nanadhocnet work)
.Iti
simplementedon
topoft
heDCFandi susedmostlyfort
ime-sensit
ivetr
ansmissi
on.PCFhasacent r
ali
zed,
cont
enti
on-f
reepol
l
ingaccessmethod.
TheAPperfor
mspoll
ingforst
ati
onsthatar
ecapabl
eofbei
ngpol
l
ed.
Thest
ati
onsar
epol
l
ed
oneaf
teranot
her
,sendi
nganydatatheyhavet
otheAP.
Togiveprior
itytoPCFov erDCF,anot
heri
nterfr
amespace, PI
FS,hasbeendef i
ned.PIFS
(PCFIFS)isshor tert
hanDI FS.Thi
smeanst hatif
,atthesamet ime,astat
ionwant stouse
onlyDCFandanAPwant stousePCF,theAPhaspr iori
ty.Duetothepri
ori
tyofPCFov er
DCF,stat
ionst hatonlyuseDCFmaynotgai naccesst othemedi um.Topr eventthi
s,a
repet
it
ionint
er valhasbeendesignedtocoverbothcontention-
fr
eePCFandcont enti
on-
basedDCFt raffic.
n
e.i
fre
s4
te
Ther epeti
ti
oninterval,
whichisr epeat edcontinuously,st
art
swi t
haspecialcontr
ol f
r ame,
no
caledabeaconf
l rame.Whent hest ationsheart hebeaconframe, t
heystar
tthei
rNAVf orthe
durationofthecont ent
ion-f
reeper iodoft herepetit
ionint
erval
.Duri
ngtherepeti
ti
oni nterval
,
thePC( pointcontroll
er)cansendapol lf
rame, recei
vedata,sendanACK, recei
veanACK, or
doanycombi nat
ionoft hese(802. 11usespi ggy backi
ng).Attheendofthecontention-free
peri
od, thePCsendsaCFend( cont enti
on-f
reeend)f rametoallowthecontenti
on-based
stat
ionst ousethemedi um.
Fr
agment
ati
on
Thewi
rel
essenvi
ronmentisverynoisy,
soframesar eoftencorr
upted.Acorr
uptfr
amehas
tober
etr
ansmit
ted.
Theprotocol,
theref
ore,recommendsf ragment
ation—t
hedivi
sionofa
l
argef
rameint
osmallerones.I
tismor eeff
icientt
oresendasmal l
f r
amethanalargeone.
Fr
ameFor
mat
n
e.i
fre
Framecontr
ol(
FC).TheFCf
iel
dis2by
tesl
onganddef
inest
het
ypeoff
rameandsome
contr
oli
nfor
mati
on.
s4
te
no
• D.Thi
sfi
elddef
inest
hedur
ati
onoft
het
ransmi
ssi
ont
hati
susedt
osett
hev
alueof
NAV.
• Addr
esses.Ther
earefouraddr
essf
iel
ds,
each6by
teslong.Themeaningofeach
addr
essfi
elddependsontheval heToDSandFr
ueoft om DSsubfi
eldsandwillbe
di
scussedl
ater
.
• Sequencecontr
ol.Thisfi
eld,
oftencal
ledt
heSCfi
eld,
def
inesa16-bitval
ue.Thef
ir
st
fourbi
tsdef
inethefragmentnumber ;
thel
ast12bi
tsdef
inethesequencenumber,
whichist
hesamei nal l
fragments.
• Framebody.Thisf
iel
d,whi
chcanbebetween0and2312byt
es,
cont
ainsi
nfor
mat
ion
basedonthetypeandthesubt
ypedef
inedi
ntheFCfi
eld.
• FCS.TheFCSf
iel
dis4by
tesl
ongandcont
ainsaCRC-
32er
ror
-det
ect
ionsequence.
Fr
ameTy
pes
Awi
rel
essLANdef
inedbyI
EEE802.
11hast
hreecat
egor
iesoff
rames:
1.ManagementFr
ames
n
Managementf
ramesar
eusedf
ort
hei
nit
ial
communi
cat
ionbet
weenst
ati
onsandaccess
poi
nts.
2.Cont
rolFr
ames
e.i
fre
Cont
rol
framesar
eusedf
oraccessi
ngt
hechannel
andacknowl
edgi
ngf
rames.
3.Dat
aFr
ames
s4
Dat
afr
amesar
eusedf
orcar
ryi
ngdat
aandcont
rol
inf
ormat
ion.
te
no
n
e.i
fre
Addr
essi
ngMechani
sm
s4
TheIEEE802.11addressingmechani
sm speci
fi
esf
ourcases,
def
inedbyt
heval
ueoft
he
twoflagsi
ntheFCf i
eld,ToDSandFrom DS.Eachfl
agcanbeeit
her0or1,r
esul
ti
ngi
nfour
dif
fer
entsi
tuati
ons.
te
Theint
erpret
ati
onofthefouraddr
esses(
addr
ess1t
oaddr
ess4)i
ntheMACf
ramedepends
no
onthevalueofthesef
lags,
.
• Addr
ess1i
sal
way
stheaddr
essoft
henextdev
icet
hatt
hef
ramewi
l
lvi
sit
.
• Addr
ess2i
sal
way
stheaddr
essoft
hepr
evi
ousdev
icet
hatt
hef
ramehasl
eft
.
• Addr
ess3i
stheaddr
essoft
hef
inal
dest
inat
ionst
ati
on
• Addr
ess4i
stheor
igi
nal
sour
cewhent
hedi
str
ibut
ionsy
stem i
sal
sowi
rel
ess.
Case1:
00
• Inthi
scase,ToDS=0andFr
om DS=0.Thismeanst
hattheframeisnotgoi
ngtoa
di
stri
but
ionsyst ToDS=0)andi
em ( snotcomingf
rom adi
str
ibuti
onsyst
em (Fr
om
DS=0) .
• Thef r
ameisgoingf
rom onest
ati
oni
naBSSt
oanot
herwi
thoutpassi
ngt
hrought
he
n
di
str
ibuti
onsy
stem.
e.i
fre
s4
te
no
Case2:
01
Inthi
scase,ToDS=0andFr om DS=1.Thismeanst
hatt
heframei
scomingf
rom a
dist
ribut
ionsy
st Fr
em ( om DS=1) .Thef
ramei
scomingfr
om anAPandgoi
ngtoa
stati
on.
Case3:
10
I
nthi ToDS=1andFr
scase, om DS=0.Thi
smeanst
hatthefr
ameisgoi
ngtoa
di
str
ibut
ionsyst
em (ToDS=1) .Thef
ramei
sgoi
ngfr
om astat
iont
oanAP.TheACK
i
ssenttotheori
ginalst
ati
on.
Case4:
11
Inthi
scase,ToDS=1andFr om DS=1.Thi
sist
hecasei
nwhichthedi
str
ibut
ion
syst
em i
salsowirel
ess.Thef
ramei
sgoingf
rom oneAPt
oanotherAPi
nawi r
eless
di
stri
but
ionsyst
em.
n
e.i
fre
s4
te
ExposedSt
ati
onPr
obl
em
I
nthi
spr
obl
em ast
ati
onr
efr
ainsf
rom usi
ngachannel
wheni
tis,
inf
act
,av
ail
abl
e.
no
Phy
sical
Lay
er
Alli
mpl
ementat
ions,exceptt
heinf
rar
ed,oper
ateintheindustr
ial
,sci
enti
fi
c,andmedi
cal
(I
SM)band,
whichdef i
nesthr
eeunli
censedbandsinthethreeranges902–928MHz,
2.
400–4.
835GHz, and5.725–5.
850GHz.
n
I
EEE802.
11FHSS
e.i
fre
I
EEE802. 11FHSSusest
hef r
equency-
hoppingspreadspect
rum (
FHSS)met
hod.FHSSuses
the2.400–4.
835GHzISM band.Thebandisdivi
dedint
o79subbandsof1MHz( andsome
guardbands).
s4
Apseudorandom numbergenerat
orselect
st hehoppi
ngsequence.Themodul
ati
on
t
echni
quei nthisspeci
fi
cati
oni
seithert
wo-levelFSKorf
our-
level
FSKwith1or2bit
s/baud,
te
whi
chresultsinadatarateof1or2Mbps.
no
I
EEE802.
11DSSS
I
EEE802.11DSSSusesthedir
ect
-sequencespreadspectrum (
DSSS)method.DSSSuses
the2.
400–4.
835GHzISM band.Themodul at
iont
echniqueinthi
sspecif
icati
onisPSKat1
Mbaud/s.Thesy
stem al
lows1or2bits/baud(BPSKorQPSK) ,whichr
esultsinadatar
ate
of1or2Mbps.
I
EEE802.
11I
nfr
ared
IEEE802.11i
nfrar
edusesi nfr
aredl
ightint herangeof800to950nm.Themodul ati
on
techni
queiscaledpul
l sepositi
onmodul at
ion(PPM).Fora1-Mbpsdatarat
e,a4-bi
t
sequenceisfi
rstmappedi nt
oa16- bitsequence.Fora2-Mbpsdatarat
e,a2-bi
tsequenceis
n
fir
stmappedintoa4-bitsequence.Themappedsequencesar et
henconvert
edtoopt i
cal
signal
s;t
hepresenceoflightspeci
fies1, t
heabsenceofli
ghtspeci
fi
es0.
e.i
fre
s4
te
no
I
EEE802.
11aOFDM
IEEE802.11aOFDM describestheort
hogonalfr
equency-
divi
sionmul
ti
plexi
ng(OFDM)
methodf orsi
gnalgener
ationina5.725–5.850GHzISM band.OFDM issimil
art
oFDM,wi
th
onemaj ordif
fer
ence:Al
lthesubbandsareusedbyonesour ceatagi
vent i
me.Sour
ces
contendwithoneanotheratthedata-
li
nklayerf
oraccess.
Thebandi sdi
videdinto52subbands,wit
h48subbandsf orsending48groupsofbit
sata
ti
meand4subbandsf orcontr
oli
nfor
mation.Di
vi
dingthebandintosubbandsdimini
shes
theeff
ectsofinter
ference.Ift
hesubbandsareusedrandomly,secur
it
ycanal sobe
i
ncreased.OFDM usesPSKandQAM f ormodulati
on.Thecommondat aratesare18Mbps
(PSK)and54Mbps( QAM) .
I
EEE802.
11bDSSS
IEEE802.
11bDSSSdescr i
besthehi
gh-rat
edi
r ect
-sequencespreadspect
rum (
HRDSSS)
methodforsi
gnalgener
ati
oni nt
he2.400–4.
835GHzI SM band.HR-DSSSissimi
lart
oDSSS
exceptf
ortheencodi
ngmet hod,
whichiscal
ledcompl ementarycodekeyi
ng(CCK).
CCKencodes4or8bi tst ooneCCKsy mbol.Tobebackwardcompat
ibl
ewithDSSS,HR-
DSSSdefinesfourdatar ates:
1,2,
5.5,and11Mbps.Thef ir
stt
wousethesame
modulat
iontechniquesasDSSS.The5. 5-
Mbpsversi
onusesBPSKandtransmi
tsat
1.
375Mbaud/ swi th4-bitCCKencoding.The11-Mbpsversi
onusesQPSKandtransmi
ts
at1.
375Mbpswi t
h8- bitCCKencoding.
n
e.i
fre
I
EEE802.
11g
s4
Thi
snewspecif
icat
iondef
inesf
orwarderr
orcor
rect
ionandOFDM usi
ngthe2.
400–
4.
835GHzISM band.Themodulati
ontechni
queachiev
esa22-or54-
Mbpsdatarat
e.I
t
te
i
sbackwar
d-compatibl
ewit
h802.11b,
butthemodulati
ont
echni
queisOFDM.
I
EEE802.
11n
no
Anupgradetot he802.11proj
ecti
scalled802.11n(thenextgener
ati
onofwir
elessLAN).
Thegoal i
stoincreasethethr
oughputof802.11wirelessLANs.Thenewstandard
emphasizesnotonlythehigherbi
trat
ebutalsoeliminati
ngsomeunnecessar
yov er
head.
Thest andarduseswhatiscal
ledMIMO( mul
tiple-
inputmulti
ple-
outputant
enna)to
overcomet henoiseprobl
em i
nwi r
elessLANs.Thei deaisthatifwecansendmul ti
ple
outputsignalsandrecei
vemulti
plei
nputsignals,wear einabetterposi
ti
ontoeli
minate
noise.Somei mpl
ementati
onsofthisproj
ecthav ereachedupt o600Mbpsdat arat
e.
BLUETOOTH
Bluetoot
hisawir
elessLANtechnologydesi
gnedtoconnectdevi
cesofdif
ferent
functi
onssuchastel
ephones,not
ebooks,computer
s(deskt
opandlaptop),
camer as,
print
ers,
andevencoffeemakerswhentheyareatashortdi
stancef
rom eachother.
ABluet
oothLANisanadhocnet
work,
whichmeansthatt
henetworki
sfor
med
spont
aneousl
y.ABl
uet
oothLANcanevenbeconnect
edtotheI
nter
net
Hi
stor
y
Bl
uetoot
hwasor i
ginal
l
yst art
edasaprojectbytheEr
icssonCompany.I
tisnamedfor
Har
aldBlaat
and,theki
ngofDenmar k(940-981)whounitedDenmar
kandNorway.
Bl
aatandtr
ansl
atestoBluetoothi
nEngli
sh.
Today,
Bluetoot
ht echnologyi
stheimplementat
ionofaprotocoldef
inedbytheI
EEE
802.
15standard.Thest andarddef
inesawirel
esspersonal
-areanet
work(PAN)oper
abl
e
i
nanar eathesizeofar oom orahall
.
n
Appl
• Per
i
i
cat
ions.
pheral
devicessuchasawi
e.i
rel
essmouseorkey
boar
dcancommuni
cat
ewi
tht
he
fre
computerthr
oughthistechnol
ogy.
• Monit
ori
ngdev
icescancommuni
cat
ewi
thsensordev
icesi
nasmal
lheal
thcar
e
cent
er.
s4
• Homesecur
itydev
icescanuset
hist
echnol
ogyt
oconnectdi
ff
erentsensor
stot
he
mai
nsecuri
tycont
roll
er.
te
• Conf
erenceat
tendeescansy
nchr
oni
zet
hei
rlapt
opcomput
ersataconf
erence.
no
Ar
chi
tect
ure
Pi
conet
s
ABluet
oothnetwor
kiscal
ledapi
conet,
orasmallnet
.Api
conetcanhav
euptoei
ght
st
ati
ons,oneofwhi
chiscall hepr
edt imary
;ther
estar
ecal
l
edsecondari
es.
Allthesecondaryst
ati
onssy nchr
oni zet
heircl
ocksandhoppingsequencewiththe
primary.Thecommuni cati
onbetweent hepr i
maryandsecondar
ystati
onscanbeone- t
o
-oneorone-to-
many.Althoughapi conetcanhaveamaximum ofsev ensecondari
es,
additi
onalsecondar
iescanbei ntheparkedstate.
Asecondaryi
naparkedstat
eissynchr
oni
zedwit
ht hepri
mary,butcannottakepar
tin
communicati
onunt
ili
tismovedfr
om thepar
kedstatetotheacti
vestate.
Scat
ter
net
Piconetscanbecombi nedtofor
m whatiscaledascat
l ternet
.Asecondaryst
ati
oni n
onepiconetcanbet hepri
maryinanotherpi
conet
.Thisstati
oncanrecei
vemessages
n
from t
hepr i
maryi
nt hefir
stpi
conet(
asasecondar y
)and,actingasapri
mary,deli
ver
them tosecondar
iesinthesecondpi
e.i conet
.Astat
ioncanbeamemberoft wopi conet
s.
fre
s4
te
no
Bl
uet
oot
hDev
ices
ABluet
oothdevi
cehasabui
l
t-i
nshort-
ranger
adiot
ransmit
ter
.Thecurr
entdat
aratei
s1
Mbpswitha2.4-
GHzbandwi
dth.Thismeansthatt
hereisapossi
bil
i
tyofi
nter
fer
ence
bet
weentheIEEE802.
11bwi
relessLANsandBluet
oothLANs.
Bl
uet
oot
hLay
ers
n
e.i
fre
L2CAP
TheLogical
LinkContr
olandAdaptati
onPr
otocol
,orL2CAP(L2her
emeansLL),i
s
s4
roughl
yequiv
alentt
otheLLCsublayeri
nLANs.Iti
susedfordat
aexchangeonan
ACLl i
nk;
SCOchannelsdonotuseL2CAP.
te
no
The16-bi
tlengt
hfiel
ddefinesthesizeofthedat
a,i
nby t
es,comi
ngfr
om theupperl
ayer
s.
Datacanbeupt o65,535bytes.ThechannelI
D(CID)defi
nesauni
queident
if
ierf
ort
he
vi
rt
ualchannelcr
eatedatthislevel
TheL2CAPhasspeci
fi
cdut
ies:mul
ti
plexi
ng,
segment
ati
onandr
eassembl
y,Qual
i
tyof
ser
vice(
QoS)
,andgroupmanagement.
BasebandLay
er
Thebasebandlay
eri
sroughl
yequi
val
enttotheMACsublay
eri
nLANs.
Theaccess
methodisTDMA.Thepri
maryandsecondar
ystat
ionscommuni
cat
ewit
heachother
usi
ngti
mesl ot
s.
Note:
communi
cati
onisonl
ybet
weenthepr
imar
yandasecondar
y;Secondar
iescannot
communi
cat
edi
rect
lywit
honeanot
her
.
TDMA
Bluet
oothusesafor
m ofTDMAt hati edTDD-
scal
l TDMA( t
ime-di
vi
siondupl
exTDMA) .
TDD-TDMAi saki
ndofhalf-
duplexcommunicati
oninwhichthesenderandr
ecei
versend
andrecei
vedata,
butnotatthesamet i
me(half
-dupl
ex)
;
n
Si
ngl
e-Secondar
yCommuni
cat
ion
Ift
di
hepi
v
i
conethasonl
dedintosl
ot
e.i
yonesecondar
sof625μs.Thepri
y
,t
mar
heTDMAoper
yuseseven-
at
ioni
number
sver
ysi
edsl
ot
mpl
s(
0,
e.Thet
2,4,...
)
i
mei
;t
he
s
fre
secondaryusesodd-
numberedslots(1,3,
5,...
).
TDD-TDMAall
owstheprimar
yandthesecondarytocommunicat
einhalf-
dupl
exmode.
Insl
ot0,t
hepri
marysendsandthesecondaryr
eceiv
es;i
nsl
ot1,thesecondar
ysends
s4
andthepr
imar
yrecei
ves.Thecy
cleisrepeat
ed.
te
no
Mul
ti
ple-
Secondar
yCommuni
cat
ion
Thepr
ocessi
sal
i
ttl
emor
einv
olv
edi
fther
eismor
ethanonesecondar
yint
hepi
conet
.
Agai
n,t
hepri
mar yusestheeven-numberedsl
ots,
butasecondarysendsinthenextodd-
number
edslotift
hepacketintheprevi
ousslotwasaddressedt
oit.Al
lsecondari
es
l
ist
enoneven-numberedsl
ots,butonl
yonesecondarysendsinanyodd-numberedslot
.
n
e.i
fre
s4
te
Li
nks
no
Twot
ypesofl
i
nkscanbecr
eat
edbet
weenapr
imar
yandasecondar
y:
SCO(
synchr
onousconnect
ion-
ori
ent
ed)Li
nks
A SCOl inkisusedwhenav oi
dinglat
ency(delayindatadeliv
ery)ismor eimportant
thanintegri
ty(er
ror
-f
reedeli
ver
y )
.InanSCOl i
nk,aphy si
call
inkiscr eatedbetween
theprimaryandasecondar ybyreser
vingspecifi
cslotsatregul
ari nterv
als.The
basicunitofconnecti
onistwoslots,
onef oreachdirecti
on.Ifapacketi sdamaged,
i
tisnev erretr
ansmit
ted.SCOisusedf orr
eal-
timeaudi owhereav oidingdelayisall
-
i
mpor tant.Asecondarycancreateupt ot
hreeSCOl inkswiththepr imar y,
sending
digi
ti
zedaudi o(PCM)at64kbpsi neachli
nk.
ACL(
asy
nchr
onousconnect
ionl
essl
i
nk)l
i
nks.
AnACLl i
nkisusedwhendat ai
ntegri
tyi
smoreimpor
tantt
hanavoidi
ngl
atency
.An
asy
nchronousconnecti
onl
essli
nk( ACL)i
susedwhendatai
ntegr
it
yismore
i
mportantthanavoi
dingl
atency
.
I
nthi
sty
peofl
i
nk,
ifapay
loadencapsul
atedi
nthef
ramei
scor
rupt
ed,
iti
sret
ransmi
tt
ed.
Asecondaryr
eturnsanACLf r
ameint
heavai
labl
eodd-
numberedsl
otift
heprev
ioussl
ot
hasbeenaddressedtoit
.ACLcanuseone,t
hree,
ormoresl
otsandcanachi
evea
maximum dat
ar ateof721kbps.
Fr
ameFor
mat
Aframeinthebasebandlay
ercanbeoneofthreetypes:one-sl
ot,
thr
ee-
slot
,orfi
vesl
ot.
Aslotis625μsinlengt
h.However,i
naone-
slotf
rameexchange, 259μsisneededfor
hoppingandcont
rolmechanisms.Thi
smeansthataone- sl
otfr
amecanlastonly625−
259,or366μs.Witha1-MHzbandwi dt
hand1bit/Hz,thesi
zeofaoneslotframeis366
bi
ts.
At hr
ee-sl
otfr
ameoccupi esthr
eeslots.However
,si
nce259μsi susedf orhoppi
ng,the
l
engthoft hefr
amei s3×625−259=1616μsor1616bi t
s.Adev i
cet hatusesat hr
ee-
slotf
ramer emainsatthesamehop( atthesamecarri
erf
requency)forthreesl
ots.Afiv
e
n
-sl
otframealsouses259bi t
sforhopping,whi
chmeansthatthelengthoft hefr
amei s5
×625−259=2866bi t
s.
Fr
amef
ormatt
ypes
e.i
fre
s4
te
no
• Accesscode.Thi
s72-
bitfi
eldnormall
ycont
ainssy
nchr
onizat
ionbi
tsandthe
i
denti
fi
erofthepri
mar
yt odist
ingui
shthefr
ameofonpiconetfr
om t
hatofanot
her
.
Header
.This54-
bitf
iel
disar
epeat
ed18-
bitpat
ter
n.Eachpat
ter
nhast
hef
oll
owi
ng
subf
iel
ds:
Addr
ess.The3-
bitaddr
esssubf
iel
dcandef
ineupt
osev
ensecondar
ies(
1to7)
.
I
ftheaddr
essi
szer
o,i
tisusedf
orbr
oadcastcommuni
cat
ionf
rom t
hepr
imar
ytoal
l
secondar
ies.
Ty
pe.The4-
bitt
ypesubf
iel
ddef
inest
het
ypeofdat
acomi
ngf
rom t
heupperl
ayer
s.
F.This1-
bitsubfi
eldi
sforf
lowcontr
ol.Whenset(
1),
iti
ndi
cat
est
hatt
hatdev
icei
s
unabl
etoreceiv
emor efr
ames(buff
erisful
l
).
A.This1-
bitsubfi
eldisforacknowl
edgment
.Bl
uet
oot
husesSt
op-
and-
Wai
tARQ;
1
bi
tissuf
fi
cientforacknowledgment
.
S.Thi
s1-bi
tsubfi
eldhol
dsasequencenumber
.Bl
uet
oot
husesSt
op-
and-
Wai
tARQ;
1bi
tissuf
fi
cientf
orsequencenumber
ing.
HEC.The8- bi
tHeaderErrorCor
rect
ionsubf
iel
disachecksum t
odet
ecter
ror
sin
each18-
bitheadersect
ion.
• Payl
oad.Thi
ssubfi
eldcanbe0to2740bitsl
ong.I
tcont
ainsdat
aorcont
rol
i
nfor
mationcomingfrom t
heupperl
ayer
s.
n
Radi
oLay
er
Ther
adi
olay
erisroughl
yequiv
e.i
alentt
othephysi
call
ayeroft
heI
nter
netmodel
.
Bl
uet
oot
hdevicesarel
ow-powerandhavearangeof10m.
fre
Modul
ati
on
Totr
ansfor
m bit
stoasignal
,Bl
uetoot
husesasophist
icat
edv
ersi
onofFSK,cal
l
ed
s4
GFSK(FSKwithGaussi
anbandwidthf
il
ter
ing;
)GFSKhasacar
ri
erfr
equency
.
te
• Bi
t1i
srepr
esent
edbyaf
requencydev
iat
ionabov
ethecar
ri
er;
• bi
t0i
srepr
esent
edbyaf
requencydev
iat
ionbel
owt
hecar
ri
er.
no
Thef
requenci
es,
aredef
inedaccor
dingt
othef
oll
owi
ngf
ormul
aforeachchannel
.
Fc=2402+nMHz n=0,
1,2,
3,...
,78
Fr
equency
-Hoppi
ngSpr
eadSpect
rum (
FHSS)met
hod
Bluet
oothusest hefr
equency-hoppingspreadspectrum (FHSS)methodinthe
physi
callayertoavoi
dinterf
erencefrom otherdevi
cesorot hernet
works.Bluet
ooth
hops1600t imespersecond, whichmeanst hateachdev i
cechangesitsmodulati
on
fr
equency1600t imespersecond.Adev i
ceusesaf requencyforonl
y625μs( 1/1600
s)befor
ei thopstoanotherfr
equency ;
thedwel lt
imeis625μs.
no
te
s4
fre
e.i
n
CONNECTING DEVICES
We use connecting devices to connect hosts together to make a network or to connect networks
together to make an internet. Connecting devices can operate in different layers of the Internet
model.
There are 3 kinds of connecting devices: 1. Hubs, 2. Link-layer switches, and 3.Routers.
n
Hubs
e.i
fre
A hub is a device that operates only in the physical layer. Signals that carry information within a
network can travel a fixed distance before attenuation. A repeater receives a signal and, before it
becomes too weak or corrupted, regenerates and retimes the original bit pattern and then sends the
s4
refreshed signal.
In the past, Ethernet LANs were using bus topology, a repeater was used to connect two segments of
te
a LAN to overcome the length restriction of the coaxial cable. Today, Ethernet LANs use star
topology. In a star topology, a repeater is a multiport device, often called a hub.
no
Hub can be used to serve as the connecting point and at the same time function as a repeater. When
a packet from station A to station B arrives at the hub, the hub forwards the packet to all outgoing
ports except the one from which the signal was received.
The figure definitely shows that a hub does not have a filtering capability;
It does not have the intelligence to find from which port the frame should be sent out. A hub or a
repeater is a physical-layer device. They do not have a link-layer address and they do not check the
link-layer address of the received frame. They just regenerate the corrupted bits and send them out
from every port.
Link-Layer Switches
A link-layer switch (or switch) operates in both the physical and the data-link layers. As a physical-
layer device, it regenerates the signal it receives. As a link-layer device, the link-layer switch can
n
check the MAC addresses (source and destination) contained in the frame.
e.i
What is the difference in functionality is between a link-layer switch and a hub.?
Filtering
te
no
• The link-layer switch consults its table to find the departing port.
• According to its table, frames for 71:2B:13:45:61:42 should be sent out only through port 2;
• Therefore, there is no need for forwarding the frame through other ports.
Transparent Switches
A transparent switch is a switch in which the stations are completely unaware of the switch’s
existence. If a switch is added or deleted from the system, reconfiguration of the stations is
unnecessary.
According to the IEEE 802.1d specification, a system equipped with transparent switches must meet
three criteria:
❑ The forwarding table is automatically made by learning frame movements in the network.
Learning
The earliest switches had switching tables that were static. The system administrator would
n
manually enter each table entry during switch setup. Although the process was simple, it was not
practical. If a station was added or deleted, the table had to be modified manually. The same was
e.i
true if a station’s MAC address changed, which is not a rare event. For example, putting in a new
network card means a new MAC address.
fre
A better solution to the static table is a dynamic table that maps addresses to ports (interfaces)
automatically. To make a table dynamic, we need a switch that gradually learns from the frames
movements. To do this, the switch inspects both the destination and the source addresses in each
s4
frame that passes through the switch. The destination address is used for the forwarding decision
(table lookup); the source address is used for adding entries to the table and for updating purposes.
te
no
• When station A sends a frame to station D, the frame goes out from all three ports; the
frame floods the network.
• However, by looking at the source address, the switch learns that station A must be
connected to port 1.
• This means that frames destined for A, in the future, must be sent out through port 1.
• When station D sends a frame to station B, the switch has no entry for B, it adds one more
entry to the table related to station D.
The learning process continues until the table has information about every port. However, the
learning process may take a long time. For example, if a station does not send out a frame (a
rare situation), the station will never have an entry in the table
Loop Problem
n
Transparent switches work fine as long as there are no redundant switches in the system. Systems
e.i
administrators, however, like to have redundant switches (more than one switch between a pair of
LANs) to make the system more reliable. Redundancy can create loops in the system, which is very
fre
undesirable. Loops can be created only when two or more broadcasting LANs (those using hubs, for
example) are connected by more than one switch.
s4
te
no
1. Station A sends a frame to station D. The tables of both switches are empty. Both forward the
frame and update their tables based on the source address A.
2. Now there are two copies of the frame on LAN 2. The copy sent out by the left switch is received
by the right switch, which does not have any information about the destination address D; it
forwards the frame.
The copy sent out by the right switch is received by the left switch and is sent out for lack of
information about D.
Note:- Each frame is handled separately because switches, as two nodes on a broadcast network
sharing the medium, use an access method such as CSMA/CD.
3. Now there are two copies of the frame on LAN 1. Step 2 is repeated, and both copies are sent to
LAN2.
n
Spanning Tree Algorithm
e.i
To solve the looping problem, the IEEE specification requires that switches use the spanning tree
algorithm to create a loopless topology. In graph theory, a spanning tree is a graph in which there is
fre
no loop.
In a switched LAN, this means creating a topology in which each LAN can be reached from any other
LAN through one path only (no loop).
s4
To find the spanning tree, we need to assign a cost (metric) to each arc. The interpretation of the
te
cost is left up to the systems administrator. We have chosen the minimum hops. However, the hop
count is normally 1 from a switch to the LAN and 0 in the reverse direction.
no
1. Every switch has a built-in ID (normally the serial number, which is unique). Each switch
broadcasts this ID so that all switches know which one has the smallest ID. The switch with
the smallest ID is selected as the root switch (root of the tree). We assume that switch S1
has the smallest ID. It is, therefore, selected as the root switch.
2. The algorithm tries to find the shortest path (a path with the shortest cost) from the root
switch to every other switch or LAN. The shortest path can be found by examining the total
cost from the root switch to the destination.
3. The combination of the shortest paths creates the shortest tree, which is also shown in Figure
17.7.
4. Based on the spanning tree, we mark the ports that are part of it, the forwarding ports,
which forward a frame that the switch receives. We also mark those ports that are not part
of the spanning tree, the blocking ports, which block the frames received by the switch
no
te
s4
fre
e.i
n
n
e.i
fre
Note that there is only one path from any LAN to any other LAN in the spanning tree system. This
s4
means there is only one path from one LAN to any other LAN. No loops are created. We have
described the spanning tree algorithm as though it required manual entries. This is not true. Each
te
switch is equipped with a software package that carries out this process dynamically.
Advantages of Switches
no
1. Collision Elimination
A link-layer switch eliminates the collision. This means increasing the average bandwidth
available to a host in the network. In a switched LAN, there is no need for carrier sensing and
collision detection; each host can transmit at any time.
A link-layer switch can connect devices that use different protocols at the physical layer (data
rates) and different transmission media.
As long as the format of the frame at the data-link layer does not change, a switch can receive a
frame from a device that uses twisted-pair cable and sends data at 10 Mbps and deliver the
frame to another device that uses fiber-optic cable and can receive data at 100 Mbps.
Routers
A router is a three-layer device; it operates in the physical, data-link, and network layers.As a
physical-layer device, it regenerates the signal it receives. As a link-layer device, the router checks
the physical addresses (source and destination) contained in the packet. As a network-layer device,
a router checks the network-layer addresses. A router can connect networks. In other words, a
router is an internetworking device; It connects independent networks to form an internetwork.
1. A router has a physical and logical (IP) address for each of its interfaces.
2. A router acts only on those packets in which the link-layer destination address matches the address
of the interface at which the packet arrives.
3. A router changes the link-layer address of the packet (both source and destination) when it
forwards the packet.
n
e.i
fre
s4
te
no
A router, will change the MAC addresses it receives because the MAC addresses have only local
jurisdictions.
VIRTUAL LANs
A station is considered part of a LAN if it physically belongs to that LAN. The criterion of membership
is geographic.
What happens if we need a virtual connection between two stations belonging to two different
physical LANs? We can roughly define a virtual local area network (VLAN) as a local area network
configured by software, not by physical wiring.
n
e.i
fre
s4
te
no
The whole idea of VLAN technology is to divide a LAN into logical, instead of physical, segments. A
LAN can be divided into several logical LANs, called VLANs. Each VLAN is a work group in the
organization. If a person moves from one group to another, there is no need to change the physical
configuration. Any station can be logically moved to another VLAN. All members belonging to a
VLAN can receive broadcast messages sent to that particular VLAN.
This means that if a station moves from VLAN 1 to VLAN 2, it receives broadcast messages sent to
VLAN 2, but no longer receives broadcast messages sent to VLAN 1.
n
VLAN technology even allows the grouping of stations connected to different switches in a VLAN.
e.i
Stations from switches A and B belong to each VLAN. This is a good configuration for a company with
two separate buildings. Each building can have its own switched LAN connected by a backbone.
People in the first building and people in the second building can be in the same work group even
fre
though they are connected to different physical LANs.
Membership
s4
Vendors use different characteristics such as interface numbers, port numbers, MAC addresses, IP
te
Interface Numbers
Some VLAN vendors use switch interface numbers as a membership characteristic. For
example, the administrator can define that stations connecting to ports 1, 2, 3, and 7 belongto VLAN
1, stations connecting to ports 4, 10, and 12 belong to VLAN 2, and so on.
MAC Addresses
Some VLAN vendors use the 48-bit MAC address as a membership characteristic. For
example, the administrator can stipulate that stations having MAC addresses E2:13:42:A1:23:34 and
F2:A1:23:BC:D3:41 belong to VLAN 1.
IP Addresses
Some VLAN vendors use the 32-bit IP address as a membership characteristic. For example,
the administrator can stipulate that stations having IP addresses 181.34.23.67, 181.34.23.72,
181.34.23.98, and 181.34.23.112 belong to VLAN 1.
Multicast IP Addresses
Combination
Recently, the software available from some vendors allows all these characteristics to be
combined. The administrator can choose one or more characteristics when installing the software.
Configuration
How are the stations grouped into different VLANs? Stations are configured in one of three ways:
1. Manual Configuration: In a manual configuration, the network administrator uses the VLAN
software to manually assign the stations into different VLANs at setup. Later migration from
one VLAN to another is also done manually. Note that this is not a physical configuration; it
is a logical configuration. The term manually here means that the administrator types the
port numbers, the IP addresses, or other characteristics, using the VLAN software.
n
2. Automatic Configuration: In an automatic configuration, the stations are automatically
e.i
connected or disconnected from a VLAN using criteria defined by the administrator.
For example, the administrator can define the project number as the criterion for being a
member of a group.
fre
When a user changes projects, he or she automatically migrates to a new VLAN.
3. Semiautomatic Configuration: A semiautomatic configuration is somewhere between a
manual configuration and an automatic configuration. Usually, the initializing is done
s4
In a multi-switched backbone, each switch must know not only which station belongs to which VLAN,
no
For example, in Figure 17.12, switch A must know the membership status of stations connected to
switch B, and switch B must know the same about switch A.
Three methods have been devised for this purpose: they are
1. Table Maintenance
In this method, when a station sends a broadcast frame to its group members, the switch
creates an a table and records station membership. The switches send their tables to one
another periodically for updating.
2. Frame Tagging
In this method, when a frame is traveling between switches, an extra header is added to the
MAC frame to define the destination VLAN. The frame tag is used by the receiving switches
to determine the VLANs to be receiving the broadcast message.
IEEE Standard
In 1996, the IEEE 802.1 subcommittee passed a standard called 802.1Q that defines the
format for frame tagging. The standard also defines the format to be used in multiswitched
backbones and enables the use of multivendor equipment in VLANs
In this method, the connection (trunk) between switches is divided into time-shared
channels. For example, if the total number of VLANs in a backbone is five, each trunk is
divided into five channels. The traffic destined for VLAN 1 travels in channel 1, the traffic
destined for VLAN 2 travels in channel 2, and so on. The receiving switch determines the
destination VLAN by checking the channel from which the frame arrived.
Advantages
n
VLANs can reduce the migration cost of stations going from one group to another. Physical
e.i
reconfiguration takes time and is costly. Instead of physically moving one station to another
segment or even to another switch, it is much easier and quicker to move it by using
software.
fre
2. Creating Virtual Work Groups
VLANs can be used to create virtual work groups. For example, in a campus environment,
s4
professors working on the same project can send broadcast messages to one another
without the necessity of belonging to the same department. This can reduce traffic if the
te
3. Security
VLANs provide an extra measure of security. People belonging to the same group can send
broadcast messages with the guaranteed assurance that users in other groups will not
receive these messages.
no
te
s4
fre
e.i
n
Network Layer
Introduction
The network layer in the TCP/IP protocol suite is responsible for the host-to-host delivery of
datagrams. It provides services to the transport layer and receives services from the data-link layer.
In this chapter, we introduce the general concepts and issues in the network layer.
NETWORK-LAYER SERVICES
• Packetizing
• Other Services
i) Error Control
n
iii) Congestion Control
As the figure shows, the network layer is involved at the source host, destination host, and all
routers in the path (R2, R4, R5, and R7). At the source host (Alice), the network layer accepts a
te
packet from a transport layer, encapsulates the packet in a datagram, and delivers the packet to the
data-link layer. At the destination host (Bob), the datagram is decapsulated, and the packet is
no
extracted and delivered to the corresponding transport layer. Although the source and destination
hosts are involved in all five layers of the TCP/IP suite, the routers use three layers if they are routing
packets only;
n
e.i
fre
s4
te
no
Packetizing
The first duty of the network layer is definitely packetizing: encapsulating the payload in a packet
at the source and decapsulating the payload from the packet at the destination. In other words
network layer is to carry a payload from the source to the destination without changing it or using it.
The source is not allowed to change the content of the payload unless it is too large for delivery
and needs to be fragmented. If the packet is fragmented at the source or at routers along the path,
the network layer is responsible for waiting until all fragments arrive, reassembling them, and
delivering them to the upper-layer protocol. The routers are not allowed to change source and
destination addresses either.
The network layer is responsible for routing the packet from its source to the destination. Generally
there is more than one route from the source to the destination. The network layer is responsible
for finding the best one among these possible routes. The network layer needs to have some specific
strategies for defining the best route. The routing protocols, should be run before any
communication occurs.
Forwarding
Forwarding can be defined as the action applied by each router when a packet arrives at one of its
interfaces. A router normally uses forwarding table for applying this action is sometimes called the
the routing table. To make decision, the router uses a piece of information in the packet header,
which can be the destination address or a label, to find the corresponding output interface number
in the forwarding table .
n
e.i
fre
s4
te
no
Other Services
Error Control
Although error control also can be implemented in the network layer, the designers of the network
layer ignore this issue. One reason is the fact that the packet in the network layer may be
fragmented at each router, which makes error checking at this layer inefficient. Although the
network layer in the Internet does not directly provide error control, the Internet uses an auxiliary
protocol, ICMP, that provides some kind of error control .
Flow Control
Flow control regulates the amount of data a source can send without overwhelming the receiver. To
control the flow of data, the receiver needs to send some feedback to the sender to inform the latter
that it is overwhelmed with data. The network layer, however, does not directly provide any flow
control. The datagrams are sent by the sender when they are ready, without any attention to the
readiness of the receiver.
Congestion Control
Congestion in the network layer is a situation in which too many datagrams are present in an area of
the Internet. Congestion may occur if the number of datagrams sent by source computers is beyond
the capacity of the network or routers. In this situation, some routers may drop some of the
datagrams.
However, as more datagrams are dropped, the situation may become worse because, due to the
error control mechanism at the upper layers, the sender may send duplicates of the lost packets. If
the congestion continues, sometimes a situation may reach a point where the system collapses and
no datagrams are delivered.
n
Quality of Service
e.i
As the Internet has allowed new applications such as multimedia communication the quality of
service (QoS) of the communication has become more and more important. However, to keep the
fre
network layer untouched, these provisions are mostly implemented in the upper layer.
Security
s4
Security was not a concern when the Internet was originally designed because it was used by a small
number of users at universities for research activities; other people had no access to the Internet.
te
The network layer was designed with no security provision. Today, however, security is a big
concern. To provide security for a connectionless network layer, we need to have another virtual
no
PACKET SWITCHING
A router, in fact, is a switch that creates a connection between an input port and an output port (or
a set of output ports), Just as an electrical switch connects the input to the output to let electricity
flow. Switching techniques are divided into two broad categories, circuit switching and packet
switching,
Only packet switching is used at the network layer because the unit of data at this layer is a packet.
Circuit switching is mostly used at the physical layer;
A packet-switched network can use two different approaches to route the packets:
The switches in this type of network are called routers. A packet belonging to a message may be
followed by a packet belonging to the same message or to a different message. Each packet is
routed based on the information contained in its header: source and destination addresses. The
destination address defines where it should go; the source address defines where it comes from.
n
e.i
fre
s4
te
no
n
e.i
fre
s4
te
no
IPV4 ADDRESSES
The identifier used in the IP layer of the TCP/IP protocol suite to identify the connection of each
device to the Internet is called the Internet address or IP address. An IPv4 address is a 32-bit address
that uniquely and universally defines the connection of a host or a router to the Internet.
The IP address is the address of the connection, not the host or the router, because if the device
is moved to another network, the IP address may be changed. IPv4 addresses are unique in the
sense that each address defines one, and only one, connection to the Internet.
Address Space
An address space is the total number of addresses used by the protocol. If a protocol uses b bits to
define an address, the address space is 2b because each bit can have two different values (0 or 1).
IPv4 uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more than
four billion). If there were no restrictions, more than 4 billion devices could be connected to the
Internet.
n
Notation
e.i
There are three common notations to show an IPv4 address:
fre
• binary notation (base 2),
Hierarchy in Addressing
In any communication network that involves delivery, such as a telephone network or a postal
network, the addressing system is hierarchical. In a postal network, the postal address (mailing
address) includes the country, state, city, street, house number, and the name of the mail recipient.
Similarly, a telephone number is divided into the country code, area code, local exchange, and the
connection.
A 32-bit IPv4 address is also hierarchical, but divided only into two parts. The first part of the
address, called the prefix, defines the network; the second part of the address, called the suffix,
defines the node (connection of a device to the Internet).
The prefix length is n bits and the suffix length is (32 − n) bits.
A prefix can be fixed length or variable length. The network identifier in the IPv4 was first designed
as a fixed-length prefix. This scheme, which is now obsolete, is referred to as classful addressing.
The new scheme, which is referred to as classless addressing, uses a variable-length network prefix .
n
e.i
fre
s4
te
no
Classful Addressing
When the Internet started, an IPv4 address was designed with a fixed-length prefix, but to
accommodate both small and large networks, three fixed-length prefixes were designed instead of
one (n = 8, n = 16, and n = 24). The whole address space was divided into five classes (class A, B, C, D,
and E), as shown in Figure 18.18. This scheme is referred to as classful addressing.
n
e.i
fre
s4
Address Depletion
The reason that classful addressing has become obsolete is address depletion. Since the addresses
te
were not distributed properly, the Internet was faced with the problem of the addresses being
rapidly used up. This resulted in no more addresses available for organizations and individuals that
no
To understand the problem, let us think about class A. This class can be assigned to only 128
organizations in the world, but each organization needs to have a single network (seen by the rest of
the world) with 16,777,216 nodes (computers in this single network). Since there may be only a few
organizations that are this large, most of the addresses in this class were wasted (unused).
Class B addresses were designed for midsize organizations, but many of the addresses in this
class also remained unused.
Class C addresses have a completely different flaw in design. The number of addresses that can
be used in each network (256) was so small that most companies were not comfortable using a block
in this address class. Class E addresses were almost never used, wasting the whole class.
In class A, the network length is 8 bits, but since the first bit, which is 0, defines the class, we can
have only seven bits as the network identifier. This means there are only 27 = 128 networks in the
world that can have a class A address.
Subnetting and Supernetting
To alleviate address depletion, two strategies were proposed and, to some extent,
implemented: subnetting and supernetting.
In subnetting, a class A or class B block is divided into several subnets. Each subnet has a
larger prefix length than the original network. For example, if a network in class A is divided
into four subnets, each subnet has a prefix of nsub = 10.
At the same time, if all of the addresses in a network are not used, subnetting allows the
addresses to be divided among several organizations. This idea did not work because most
large organizations were not happy about dividing the block and giving some of the unused
addresses to smaller organizations.
While subnetting was devised to divide a large block into smaller ones, supernetting was
devised to combine several class C blocks into a larger block to be attractive to organizations
n
that need more than the 256 addresses available in a class C block. This idea did not work
either because it makes the routing of packets more difficult.
addressing is inherent in the address; no extra information is needed to extract the prefix and the
suffix.
te
no
MODULE 4
Network Layer Protocols and Unicast Routing
Network Layer Protocols
In this chapter, we show how the network layer is implemented in the TCP/IP protocol suite.
The protocols in the network layer have gone through a few versions; in this chapter, we
concentrate on the current version v4.
Communication at the network layer is host-to-host (computer-to-computer); a computer somewhere
in the world needs to communicate with another computer somewhere else in the world through the
Internet.
The packet transmitted by the sending computer may pass through several LANs or WANs before
reaching the destination computer. A global addressing scheme called logical addressing in required
for this communication. The term IP address refers to the logical address in the network layer of the
TCP/IP protocol suite.
Communication at the network layer in the Internet is connectionless. If reliability is important,
IPv4 must be paired with a reliable transport-layer protocol such as TCP.
4.1 Position of IPv4 and other network protocols in TCP/IP protocol suite
n
shown in Figure 4.1.
e.i
The network layer in version 4 can be thought of as one main protocol and three auxiliary ones as
• The main protocol, Internet Protocol version 4 (IPv4), is responsible for packetizing,
forwarding, and delivery of a packet at the network layer.
fre
• The Internet Control Message Protocol version 4 (ICMPv4) helps IPv4 to handle some errors
that may occur in the network-layer delivery.
• The Internet Group Management Protocol (IGMP) is used to help IPv4 in multicasting.
• The Address Resolution Protocol (ARP) is used to glue the network and data-link layers in
s4
Figure 4.1: Position of IP and other network-layer protocols in TCP/IP protocol suite
Datagram Format
The Internet Protocol version 4 (IPv4) is the delivery mechanism used by the TCP/IP protocols. Packets
used by the IP are called datagrams. A datagram is a variable-length packet consisting of two parts:
header and payload (data). The header is 20 to 60 bytes in length and contains information essential to
routing and delivery. It is customary in TCP/IP to show the header in 4-byte sections.
Figure 4.2: IPv4 Datagram
n
A brief description of each field is in order: e.i
1. Version Number: The 4-bit version number (VER) field defines the version of the IPv4
protocol, which, obviously, has the value of 4.
fre
2. Header Length: The 4-bit header length (HLEN) field defines the total length of the datagram
header in 4-byte words. The IPv4 datagram has a variable-length header. When a device
receives a datagram, it needs to know when the header stops and the data, which is encapsulated
s4
in the packet, starts. The total length is divided by 4 and the value is inserted in the field. The
receiver needs to multiply the value of this field by 4 to find the total length.
te
3. Service Type: In the original design of the IP header shown in Fig 4.3, this field was referred
to as type of service (TOS), which defined how the datagram should be handled. In the late
no
n
datagram arrives at the destination, the value of this field helps to define to which protocol the
e.i
payload should be delivered. In other words, this field provides multiplexing at the source and
demultiplexing at the destination
Figure 4.4: Multiplexing and demultiplexing using the value of the protocol field
no
8. Header checksum: IP is not a reliable protocol; it does not check whether the payload carried
by a datagram is corrupted during the transmission. IP puts the burden of error checking of the
payload on the protocol that owns the payload, such as UDP or TCP.
The datagram header, however, is added by IP, and its error-checking is the responsibility of
IP. Errors in the IP header can be a disaster. For example, if the destination IP address is
corrupted, the packet can be delivered to the wrong host. If the protocol field is corrupted, the
payload may be delivered to the wrong protocol. If the fields related to the fragmentation are
corrupted, the datagram cannot be reassembled correctly at the destination, and so on. For these
reasons, IP adds a header checksum field to check the header, but not the payload. We need to
remember that, since the value of some fields, such as TTL, which are related to fragmentation
and options, may change from router to router, the checksum needs to be recalculated at each
router. Checksum in the Internet normally uses a 16-bit field, which is the complement of the
sum of other fields calculated using 1s complement arithmetic.
9. Source and Destination Addresses: These 32-bit source and destination address fields define
the IP address of the source and destination respectively. The source host should know its IP
address. The destination IP address is either known by the protocol that uses the service of IP
or is provided by the DNS. Note that the value of these fields must remain unchanged during
the time the IP datagram travels from the source host to the destination host.
10. Options: A datagram header can have up to 40 bytes of options. Options can be used for
network testing and debugging. Although options are not a required part of the IP header, option
processing is required of the IP software. This means that all implementations must be able to
handle options if they are present in the header. The existence of options in a header creates
some burden on the datagram handling; some options can be changed by routers, which forces
each router to recalculate the header checksum. There are one-byte and multi-byte options
11. Payload: Payload, or data, is the main reason for creating a datagram. Payload is the packet
coming from other protocols that use the service of IP. Comparing a datagram to a postal
package, payload is the content of the package; the header is only the information written on
the package
Example 1:
An IPv4 packet has arrived with the first 8 bits as shown : 01000010
The receiver discards the packet. Why?
Solution
There is an error in this packet. The 4 leftmost bits (0100) show the version, which is correct. The
next 4 bits (0010) show an invalid header length (2 × 4 = 8). The minimum number of bytes in the
header must be 20. The packet has been corrupted in transmission.
n
Example 2
e.i
In an IPv4 packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried
by this packet?
fre
Solution
The HLEN value is 8, which means the total number of bytes in the header is 8 × 4, or 32 bytes. The
first 20 bytes are the base header, the next 12 bytes are the options.
Example 3
s4
Solution
The HLEN value is 5, which means the total number of bytes in the header is 5 × 4, or 20 bytes (no
te
options). The total length is 40 bytes, which means the packet is carrying 20 bytes of data (40 − 20).
Example 4
no
An IPv4 packet has arrived with the first few hexadecimal digits as shown.
0x45000028000100000102 . . .
How many hops can this packet travel before being dropped? The data belong to what upper-layer
protocol?
Solution
To find the time-to-live field, we skip 8 bytes. The time-to-live field is the ninth byte, which is 01. This
means the packet can travel only one hop. The protocol field is the next byte (02), which means that
the upper-layer protocol is IGMP.
Example 6
An IPv4 packet has arrived with the header decimal digits as shown below. Calculate the checksum
for this header
Fragmentation
A datagram can travel through different networks. Each router decapsulates the IP datagram from the
frame it receives, processes it, and then encapsulates it in another frame.The format and size of the
received( or sent) frames depend on the protocol used by the physical network through which the frame
has just travelled( or going to travel). For example, if a router connects a LAN to a WAN, it receives a
frame in the LAN format and sends a frame in the WAN format.
n
frame, the total size of the datagram must be less than this maximum size, which is defined by the
restrictions imposed by the hardware and software used in the network
e.i
fre
s4
te
In order to make the IP protocol independent of the physical network, the designers decided to make
the maximum length of the IP datagram equal to 65,535 bytes. This makes transmission more efficient
if one day we use a link-layer protocol with an MTU of this size. However, for other physical networks,
we must divide the datagram to make it possible for it to pass through these networks. This is called
fragmentation. When a datagram is fragmented, each fragment has its own header with most of the
fields repeated, but some have been changed.
A fragmented datagram may itself be fragmented if it encounters a network with an even smaller MTU.
In other words, a datagram may be fragmented several times before it reaches the final destination. A
datagram can be fragmented by the source host or any router in the path. The reassembly of the
datagram, however, is done only by the destination host, because each fragment becomes an
independent datagram
Table 4.1 MTUs for some networks
Fields Related to Fragmentation
Three fields in an IP datagram are related to fragmentation: identification, flags, and
fragmentation offset
When a datagram is fragmented, the value in the identification field is copied into all fragments. In
other words, all fragments have the same identification number, which is also the same as the original
datagram. The identification number helps the destination in reassembling the datagram. It knows that
all fragments having the same identification value should be assembled into one datagram
Flags used in fragmentation
When the payload of the IP datagram is fragmented, most parts of the header, with the exception of
some options, must be copied by all fragments. The host or router that fragments a datagram must
change the values of three fields: flags, fragmentation offset, and total length.The value of the checksum
must be recalculated regardless of fragmentation.
n
Figure 4.7 Flags in fragmentation e.i
The leftmost bit is reserved (not used). The second bit (D bit) is called the do not fragment bit. If its
fre
value is 1, the machine must not fragment the datagram. If it cannot pass the datagram through any
available physical network, it discards the datagram and sends an ICMP error message to the source
host (discussed later). If its value is 0, the datagram can be fragmented if necessary. The third bit (M
bit) is called the more fragment bit. If its value is 1, it means the datagram is not the last fragment; there
s4
are more fragments after this one. If its value is 0, it means this is the last or only fragment.
Fragmentation offset
te
The 13-bit fragmentation offset field shows the relative position of this fragment with respect to the
no
whole datagram. It is the offset of the data in the original datagram measured in units of 8 bytes.
Fragmentation example
Figure 4.8 shows a datagram with a data size of 4000 bytes fragmented into three fragments. The bytes
in the original datagram are numbered 0 to 3999. The first fragment carries bytes 0 to 1399. The offset
for this datagram is 0/8 = 0. The second fragment carries bytes 1400 to 2799; the offset value for this
fragment is 1400/8 = 175. Finally, the third fragment carries bytes 2800 to 3999. The offset value for
this fragment is 2800/8 = 350.
n
e.i
fre
s4
te
no
n
Example - A packet has arrived in which the offset value is 100, the value of HLEN is 5, and the value
of the total length field is 100. What are the numbers of the first byte and the last byte?
e.i
Solution The first byte number is 100 × 8 = 800. The total length is 100 bytes, and the header length is
20 bytes (5 × 4), which means that there are 80 bytes in this datagram. If the first byte number is 800,
fre
the last byte number must be 879.
Options
The header of the IPv4 datagram is made of two parts: a fixed part and a variable part. The fixed part is
s4
20 bytes long and was discussed in the previous section. The variable part comprises the options that
can be a maximum of 40 bytes (in multiples of 4-bytes) to preserve the boundary of the header. Options,
te
as the name implies, are not required for a datagram. They can be used for network testing and
debugging.
no
n
The IPv4 protocol, as well as the whole Internet, was started when the Internet users trusted each other.
e.i
No security was provided for the IPv4 protocol. Today, however, the situation is different; the Internet
is not secure anymore. There are three security issues that are particularly applicable to the IP protocol:
packet sniffing, packet modification, and IP spoofing.
fre
Packet Sniffing: An intruder may intercept an IP packet and make a copy of it. Packet sniffing is a
passive attack, in which the attacker does not change the contents of the packet. This type of attack is
very difficult to detect because the sender and the receiver may never know that the packet has been
s4
copied. Although packet sniffing cannot be stopped, encryption of the packet can make the attacker’s
effort useless. The attacker may still sniff the packet, but the content is not detectable.
te
Packet Modification:The second type of attack is to modify the packet. The attacker intercepts the
packet, changes its contents, and sends the new packet to the receiver. The receiver believes that the
no
packet is coming from the original sender. This type of attack can be detected using a data integrity
mechanism. The receiver, before opening and using the contents of the message, can use this mechanism
to make sure that the packet has not been changed during the transmission
IP Spoofing : An attacker can masquerade as somebody else and create an IP packet that carries the
source address of another computer. An attacker can send an IP packet to a bank pretending that it is
coming from one of the customers
IPSec The IP packets today can be protected from the previously mentioned attacks using a protocol
called IPSec (IP Security).
ICMPv4
The IPv4 has no error-reporting or error-correcting mechanism. The IP protocol also lacks a mechanism
for host and management queries. A host sometimes needs to determine if a router or another host is
alive. And sometimes a network manager needs information from another host or router.
The Internet Control Message Protocol version 4 (ICMPv4) has been designed to compensate for the
above two deficiencies. It is a companion to the IP protocol. ICMP itself is a network-layer protocol.
However, its messages are not passed directly to the data-link layer as would be expected. Instead, the
messages are first encapsulated inside IP datagrams before going to the lower layer. When an IP
datagram encapsulates an ICMP message, the value of the protocol field in the IP datagram is set to 1
to indicate that the IP payroll is an ICMP message.
MESSAGES
ICMP messages are divided into two broad categories: error-reporting messages and query messages.
The error-reporting messages report problems that a router or a host (destination) may encounter when
it processes an IP packet. The query messages, which occur in pairs, help a host or a network manager
get specific information from a router or another host. For example, nodes can discover their neighbors
An ICMP message has an 8-byte header and a variable-size data section. Although the general format
of the header is different for each message type, the first 4 bytes are common to all. As Figure 4. shows,
the first field, ICMP type, defines the type of the message. The code field specifies the reason for the
particular message type. The last common field is the checksum field (to be discussed later in the
chapter). The rest of the header is specific for each message type.
The data section in error messages carries information for finding the original packet that had the error.
In query messages, the data section carries extra information based on the type of query.
n
e.i
fre
s4
te
no
❑ No ICMP error message will be generated in response to a datagram carrying an ICMP error message.
❑ No ICMP error message will be generated for a fragmented datagram that is not the first fragment.
❑ No ICMP error message will be generated for a datagram having a multicast address.
❑ No ICMP error message will be generated for a datagram having a special address such as 127.0.0.0
or 0.0.0.0.
n
e.i
fre
s4
te
no
Destination Unreachable - The most widely used error message is the destination unreachable
(type 3). This message uses different codes (0 to 15) to define the type of error message and the
reason why a datagram has not reached its final destination
Source Quench - Another error message is called the source quench (type 4) message, which
informs the sender that the network has encountered congestion and the datagram has been
dropped; the source needs to slow down sending more datagrams. In other words, ICMP adds
a kind of congestion control mechanism to the IP protocol by using this type of message.
Redirection Message - The redirection message (type 5) is used when the source uses a wrong
router to send out its message. The router redirects the message to the appropriate router, but
informs the source that it needs to change its default router in the future. The IP address of the
default router is sent in the message.
Parameter Problem - A parameter problem message (type 12) can be sent when either there
is a problem in the header of a datagram (code 0) or some options are missing or cannot be
interpreted (code 1).
Query Messages - Query messages are used to probe or test the liveliness of hosts or routers
in the Internet, find the one-way or the round-trip time for an IP datagram between two devices,
or even find out whether the clocks in two devices are synchronized. Query messages in ICMP
can be used independently without relation to an IP datagram. But a query message needs to be
encapsulated in a datagram, as a carrier. Naturally, query messages come in pairs: request and
reply. The echo request (type 8) and the echo reply (type 0) pair of messages are used by a host
or a router to test the liveliness of another host or router
Deprecated Messages
Three pairs of messages are declared obsolete by IETF:
1. Information request and replay messages are not used today because their duties are done by the
Address Resolution Protocol (ARP).
2. Address mask request and reply messages are not used today because their duties are done by the
Dynamic Host Configuration Protocol (DHCP)
3. Router solicitation and advertisement messages are not used today because their duties are done by
the Dynamic Host Configuration Protocol (DHCP)
Debugging Tools
n
There are several tools that can be used in the Internet for debugging. We can determine the viability of
e.i
a host or router. We can trace the route of a packet. We introduce two tools that use ICMP for debugging:
ping and traceroute.
Ping - We can use the ping program to find if a host is alive and responding. We use ping here to see
fre
how it uses ICMP packets. The source host sends ICMP echo-request messages; the destination, if alive,
responds with ICMP echo-reply messages. The ping program sets the identifier field in the echo-request
and echo-reply message and starts the sequence number from 0; this number is incremented by 1 each
s4
time a new message is sent. Note that ping can calculate the round-trip time. It inserts the sending time
in the data section of the message. When the packet arrives, it subtracts the arrival time from the
departure time to get the round-trip time (RTT).
te
Example: The following shows how we send a ping message to the auniversity.edu site. We set the
identifier field in the echo request and reply message and start the sequence number from 0; this number
no
is incremented by one each time a new message is sent. Note that ping can calculate the round-trip
time. It inserts the sending time in the data section of the message. When the packet arrives, it subtracts
the arrival time from the departure time to get the round-trip time (rtt).
$ ping auniversity.edu PING auniversity.edu (152.181.8.3) 56 (84) bytes of data.
64 bytes from auniversity.edu (152.181.8.3): icmp_seq=0 ttl=62 time=1.91 ms
64 bytes from auniversity.edu (152.181.8.3): icmp_seq=1 ttl=62 time=2.04 ms
64 bytes from auniversity.edu (152.181.8.3): icmp_seq=2 ttl=62 time=1.90 ms
64 bytes from auniversity.edu (152.181.8.3): icmp_seq=3 ttl=62 time=1.97 ms
64 bytes from auniversity.edu (152.181.8.3): icmp_seq=4 ttl=62 time=1.93 ms
64 bytes from auniversity.edu (152.181.8.3): icmp_seq=5 ttl=62 time=2.00 ms
--- auniversity.edu statistics -- 6 packets transmitted, 6 received, 0% packet loss rtt min/avg/max =
1.90/1.95/2.04 ms
Traceroute or Tracert - The traceroute program in UNIX or tracert in Windows can be used to trace
the path of a packet from a source to the destination. It can find the IP addresses of all the routers that
are visited along the path. The program is usually set to check for the maximum of 30 hops (routers) to
be visited. The number of hops in the Internet is normally less than this.
Traceroute - The traceroute program is different from the ping program. The ping program gets help
from two query messages; the traceroute program gets help from two error-reporting messages: time-
exceeded and destination-unreachable. The traceroute is an application layer program, but only the
client program is needed, because, as we can see, the client program never reaches the application layer
in the destination host. In other words, there is no traceroute server program. The traceroute application
program is encapsulated in a UDP user datagram, but traceroute intentionally uses a port number that
is not available at the destination. If there are n routers in the path, the traceroute program sends (n + 1)
messages. The first n messages are discarded by the n routers, one by each router; the last message is
discarded by the destination host. The traceroute client program uses the (n + 1) ICMP error-reporting
messages received to find the path between the routers.
The first traceroute message is sent with time-to-live (TTL) value set to 1; the message is discarded at
the first router and a time-exceeded ICMP error message is sent, from which the traceroute program
can find the IP address of the first router (the source IP address of the error message) and the router
name (in the data section of the message). The second traceroute message is sent with TTL set to 2,
which can find the IP address and the name of the second router. Similarly, the third message can find
the information about router 3. The fourth message, however, reaches the destination host.
n
e.i
fre
s4
te
no
n
Figure 4.13 – Calculation of ICMP checksum
e.i
fre
MOBILE IP
As mobile and personal computers such as notebooks become increasingly popular, we need to think
about mobile IP, the extension of IP protocol that allows mobile computers to be connected to the
s4
The main problem that must be solved in providing mobile communication using the IP protocol is
addressing
no
Stationary Hosts - The original IP addressing was based on the assumption that a host is stationary,
attached to one specific network. A router uses an IP address to route an IP datagram. An IP address
has two parts: a prefix and a suffix. The prefix associates a host with a network. For example, the IP
address 10.3.4.24/8 defines a host attached to the network 10.0.0.0/8.
The IP addresses are designed to work with stationary hosts because part of the address defines the
network to which the host is attached.
Mobile Hosts - When a host moves from one network to another, the IP addressing structure needs to
be modified. Several solutions have been proposed.
1. Changing the Address - One simple solution is to let the mobile host change its address as it
goes to the new network. The host can use DHCP to obtain a new address to associate it with
the new network. This approach has several drawbacks. First, the configuration files would
need to be changed. Second, each time the computer moves from one network to another, it
must be rebooted. Third, the DNS tables need to be revised so that every other host in the
Internet is aware of the change. Fourth, if the host roams from one network to another during a
transmission, the data exchange will be interrupted. This is because the ports and IP addresses
of the client and the server must remain constant for the duration of the connection.
2. Two Addresses - The approach that is more feasible is the use of two addresses. The host has
its original address, called the home address, and a temporary address, called the care-of
address. The home address is permanent; it associates the host with its home network, the
network that is the permanent home of the host. The care-of address is temporary. When a host
moves from one network to another, the care-of address changes; it is associated with the
foreign network, the network to which the host moves. When a mobile host visits a foreign
network, it receives its care-of address during the agent discovery and registration phase
n
To make the change of address transparent to the rest of the Internet requires a home agent and a foreign
e.i
agent. Figure 4.14 shows the position of a home agent relative to the home network and a foreign agent
relative to the foreign network. We have shown the home and the foreign agents as routers, but we need
to emphasize that their specific function as an agent is performed in the application layer. In other
fre
words, they are both routers and hosts.
Home Agent - The home agent is usually a router attached to the home network of the mobile host.
The home agent acts on behalf of the mobile host when a remote host sends a packet to the mobile host.
s4
The home agent receives the packet and sends it to the foreign agent.
Foreign Agent - The foreign agent is usually a router attached to the foreign network. The foreign agent
te
receives and delivers packets sent by the home agent to the mobile host. The mobile host can also act
as a foreign agent. In other words, the mobile host and the foreign agent can be the same. However, to
no
do this, a mobile host must be able to receive a care-of address by itself, which can be done through the
use of DHCP. In addition, the mobile host needs the necessary software to allow it to communicate with
the home agent and to have two addresses: its home address and its care-of address. This dual addressing
must be transparent to the application programs. When the mobile host acts as a foreign agent, the care-
of address is called a collocated care-of address.
The advantage of using a collocated care-of address is that the mobile host can move to any network
without worrying about the availability of a foreign agent. The disadvantage is that the mobile host
needs extra software to act as its own foreign agent
Three Phases - To communicate with a remote host, a mobile host goes through three phases: agent
discovery, registration, and data transfer, as shown in Figure 4.15.
n
e.i
fre
The first phase, agent discovery, involves the mobile host, the foreign agent, and the home agent. The
second phase, registration, also involves the mobile host and the two agents. Finally, in the third phase,
te
subphases. A mobile host must discover (learn the address of) a home agent before it leaves its home
network. A mobile host must also discover a foreign agent after it has moved to a foreign network. This
discovery consists of learning the care-of address as well as the foreign agent’s address. The discovery
involves two types of messages: advertisement and solicitation
Agent Advertisement - When a router advertises its presence on a network using an ICMP router
advertisement, it can append an agent advertisement to the packet if it acts as an agent. Mobile IP does
not use a new packet type for agent advertisement; it uses the router advertisement packet of ICMP, and
appends an agent advertisement message
❑ Length. The 8-bit length field defines the total length of the extension message (not the length of the
ICMP advertisement message).
❑ Sequence number. The 16-bit sequence number field holds the message number. The recipient can
use the sequence number to determine if a message is lost.
❑ Lifetime. The lifetime field defines the number of seconds that the agent will accept requests. If the
value is a string of 1s, the lifetime is infinite.
❑ Code. The code field is an 8-bit flag in which each bit is set (1) or unset (0). The meanings of the
bits are shown in Table 4.2
Table 4.2 :Code bits
n
e.i
fre
s4
te
❑ Care-of Addresses. This field contains a list of addresses available for use as careof addresses. The
mobile host can choose one of these addresses. The selection of this care-of address is announced in the
no
registration request. Note that this field is used only by a foreign agent.
Agent Solicitation
When a mobile host has moved to a new network and has not received agent advertisements, it can
initiate an agent solicitation. It can use the ICMP solicitation message to inform an agent that it needs
assistance. Mobile IP does not use a new packet type for agent solicitation; it uses the router solicitation
packet of ICMP.
Registration - The second phase in mobile communication is registration. After a mobile host has
moved to a foreign network and discovered the foreign agent, it must register. There are four aspects of
registration:
1. The mobile host must register itself with the foreign agent.
2. The mobile host must register itself with its home agent. This is normally done by the foreign agent
on behalf of the mobile host.
3. The mobile host must renew registration if it has expired.
4. The mobile host must cancel its registration (deregistration) when it returns home. Request and Reply
To register with the foreign agent and the home agent, the mobile host uses a registration request and a
registration reply as shown in Figure 4.17.
Registration Request - A registration request is sent from the mobile host to the foreign agent to
register its care-of address and also to announce its home address and home agent address. The foreign
agent, after receiving and registering the request, relays the message to the home agent.
❑ Type. The 8-bit type field defines the type of message. For a request message the value of this field
n
is 1.
e.i
❑ Flag. The 8-bit flag field defines forwarding information. The value of each bit can be set or unset.
The meaning of each bit is given in Table 4.3.
fre
Table 4.3 : Registration request flag field bits
s4
te
no
❑ Lifetime. This field defines the number of seconds the registration is valid. If the field is a string of
0s, the request message is asking for deregistration. If the field is a string of 1s, the lifetime is infinite.
❑ Home address. This field contains the permanent (first) address of the mobile host.
❑ Home agent address. This field contains the address of the home agent.
❑ Care-of address. This field is the temporary (second) address of the mobile host. ❑ Identification.
This field contains a 64-bit number that is inserted into the request by the mobile host and repeated in
the reply message. It matches a request with a reply.
❑ Extensions. Variable length extensions are used for authentication. They allow a home agent to
authenticate the mobile agent
Registration Reply - A registration reply is sent from the home agent to the foreign agent and then
relayed to the mobile host. The reply confirms or denies the registration request. Figure 4.18 shows the
format of the registration reply. The fields are similar to those of the registration request with the
following exceptions. The value of the type field is 3. The code field replaces the flag field and shows
the result of the registration request (acceptance or denial). The care-of address field is not needed.
n
host. Figure 4.19 shows the idea.
e.i
fre
s4
te
no
n
Communication involving mobile IP can be inefficient. The inefficiency can be severe or moderate.
e.i
The severe case is called double crossing or 2X. The moderate case is called triangle routing or dog-leg
routing.
fre
Double Crossing - Double crossing occurs when a remote host communicates with a mobile host that
has moved to the same network (or site) as the remote host (see Figure 4.20). When the mobile host
sends a packet to the remote host, there is no inefficiency; the communication is local. However, when
the remote host sends a packet to the mobile host, the packet crosses the Internet twice. Since a computer
s4
usually communicates with other local computers (principle of locality), the inefficiency from double
crossing is significant.
te
Triangle Routing - Triangle routing, the less severe case, occurs when the remote host communicates
with a mobile host that is not attached to the same network (or site) as the mobile host. When the mobile
no
n
this information in a cache. The problem with this strategy is that the cache entry becomes outdated
once the mobile host moves. In this case the home agent needs to send a warning packet to the remote
host to inform it of the change.
e.i
fre
s4
te
no
CCNModul
e5:Tr
anspor
tlayer
MODULE5
1)Whatar
ethedi
ff
erentser
vicespr
ovi
dedbyt
het
ranspor
tlayer
?
1.Pr
ocess-
to-
ProcessCommuni
cat
ion
Thef
ir
stdut
yofat
ranspor
t-
layerpr
otocoli
stopr
ovi
depr
ocess-
to-
process
communi
cat
ion.Apr
ocessi
sanappl
icat
ion-
layerent
it
y(r
unni
ngpr
ogr
am)t
hat
usest
heser
vicesoft
het
ranspor
tlayer
.Thenet
wor
klayer i
sresponsi
blef
or
communi
cat
ionatt
hecomput
erl
evel(
host
-t
o-hostcommuni
cat
ion)
.Anet
wor
k-
l
ayerpr
otocolcan del
ivert
he message onl
ytot
he dest
inat
ion comput
er.
However
,thi
sisani
ncompl
etedel
iver
y.Themessagest
il
lneedst
obehanded
t
othecor
rectpr
ocess.Thi
siswher
eat
ranspor
t-
layerpr
otocolt
akesover
.A
n
t
ranspor
t-
layerpr
otocoli
sresponsi
blef
ordel
iver
y oft
he message t
othe
appr
t
r
opr
iat
anspor
e pr
tl
ocess.Fi
ayer
.
gur e.i
e shows t
he domai
ns ofa net
wor
klayerand a
fre
s4
te
no
Fi
gur
e1:Net
wor
klayerver
sust
ranspor
tlayer
2.Encapsul
ati
onandDecapsul
ati
on
Tosendamessagef
rom onepr
ocesst
oanot
her
,thet
ranspor
t-
layerpr
otocol
encapsul
atesanddecapsul
atesmessages(
Figur
e2)
.Encapsul
ati
onhappensat
t
hesendersi
te.Whenapr
ocesshasamessaget
osend,
itpassest
hemessage
t
othet
ranspor
tlayeral
ongwi
thapai
rofsocketaddr
essesandsomeot
her
pi
eces ofi
nfor
mat
ion,whi
ch depend on t
he t
ranspor
t-
layerpr
otocol
.The
t
ranspor
tlayerr
ecei
vest
hedat
a and addst
het
ranspor
t-
layerheader
.The
packet
s att
he t
ranspor
tlayeri
nthe I
nter
netar
e cal
led userdat
agr
ams,
segment
s,orpacket
s,dependi
ngonwhatt
ranspor
t-
layerpr
otocolweuse.I
n
Dept
.ofECE,
RNSI
TPage1
CCNModul
e5:Tr
anspor
tlayer
gener
al,
tr
anspor
t-
layerpayl
oadsar
ecal
ledaspacket
s.
Decapsul
ati
onhappensatt
her
ecei
versi
te.Whent
hemessagear
ri
vesatt
he
dest
inat
ion t
ranspor
tlayer
,the headeri
s dr
opped and t
he t
ranspor
tlayer
del
iver
sthemessaget
othepr
ocessr
unni
ngatt
heappl
icat
ionl
ayer
.Thesender
socketaddr
essi
spassedt
othepr
ocessi
ncasei
tneedst
orespondt
othe
messager
ecei
ved.
n
e.i
fre
Fi
gur
e2:Encapsul
ati
onanddecapsul
ati
on
3.Mul
ti
plexi
ngandDemul
ti
plexi
ng
s4
Wheneveran ent
it
y accept
sit
ems f
rom mor
ethan one sour
ce,t
hisi
s
te
r
efer
redt
oasmul
ti
plexi
ng(
manyt
oone)
;wheneveranent
it
ydel
iver
sit
emst
o
mor
ethanonesour
ce,t
hisi
sref
err
edt
oasdemul
ti
plexi
ng(
onet
omany)
.The
no
t
ranspor
tlayeratt
hesour
ceper
for
msmul
ti
plexi
ng;t
het
ranspor
tlayeratt
he
dest
inat
ionper
for
msdemul
ti
plexi
ng
Fi
gur
e3 showscommuni
cat
ion bet
ween acl
ientand t
wo ser
ver
s.
Thr
eecl
ientpr
ocessesar
erunni
ng att
hecl
ientsi
te,P1,P2,and P3.The
pr
ocesses P1 and P3 need t
o send r
equest
stot
he cor
respondi
ng ser
ver
pr
ocessr
unni
ngi
naser
ver
.Thecl
ientpr
ocessP2needst
osendar
equestt
o
t
hecor
respondi
ngser
verpr
ocessr
unni
ngatanot
herser
ver
.Thet
ranspor
tlayer
att
hecl
ientsi
teaccept
sthr
eemessagesf
rom t
het
hreepr
ocessesandcr
eat
es
t
hreepacket
s.I
tact
sasamul
ti
plexer
.Thepacket
s1and3uset
hesamel
ogi
cal
channelt
oreacht
het
ranspor
tlayeroft
hef
ir
stser
ver
.Whent
heyar
ri
veatt
he
ser
ver
,thet
ranspor
tlayerdoest
hej
obofademul
ti
plexeranddi
str
ibut
est
he
messagest
otwodi
ff
erentpr
ocesses.Thet
ranspor
tlayeratt
hesecondser
ver
r
ecei
vespacket2anddel
iver
sitt
othecor
respondi
ngpr
ocess.Not
ethatwest
il
l
Dept
.ofECE,
RNSI
TPage2
CCNModul
e5:Tr
anspor
tlayer
havedemul
ti
plexi
ngal
thought
her
eisonl
yonemessage.
n
e.i
fre
Fi
gur
e3:Mul
ti
plexi
nganddemul
ti
plexi
ng
4.Fl
owCont
rol
s4
Wheneveranent
it
ypr
oducesi
temsandanot
herent
it
yconsumest
hem,
ther
e
shoul
dbeabal
ancebet
weenpr
oduct
ionandconsumpt
ionr
ates.I
fthei
tems
te
ar
e pr
oduced f
ast
ert
han t
hey can be consumed,t
he consumercan be
no
over
whel
medandmayneedt
odi
scar
dsomei
tems.I
fthei
temsar
epr
oduced
mor
esl
owl
ythant
heycanbeconsumed,t
heconsumermustwai
t,andt
he
syst
em becomesl
essef
fi
cient
.Fl
owcont
roli
srel
atedt
othef
ir
sti
ssue.Weneed
t
opr
eventl
osi
ngt
hedat
ait
emsatt
heconsumersi
te.
Pushi
ngorPul
li
ng
Del
iver
yofi
temsf
rom apr
oducert
oaconsumercanoccuri
noneoft
woways:
pushi
ng orpul
li
ng.I
fthesenderdel
iver
sit
emswhenevert
heyar
epr
oduced
wi
thoutapr
iorr
equestf
rom t
heconsumert
hedel
iver
yisr
efer
r oaspushi
edt ng.
I
fthepr
oducerdel
iver
sthei
temsaf
tert
heconsumerhasr
equest
edt
hem,t
he
del
iver
yisr
efer
r oaspul
edt li
ng.Fi
gur
e4showst
heset
wot
ypesofdel
iver
y.
Dept
.ofECE,
RNSI
TPage3
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e4:Pushi
ngorpul
li
ng
Fl
owCont
rolatTr
anspor
tLayer
I
ncommuni
cat
ionatt
het
ranspor
tlayer
,wear
edeal
ingwi
thf
ourent
it
ies:
senderpr
ocess,sendert
ranspor
tlayer
,recei
vert
ranspor
tlayer
,and r
ecei
ver
pr
ocess.The sendi
ng pr
ocess att
he appl
icat
ion l
ayeri
s onl
y a pr
oducer
.It
pr
oducesmessagechunksandpushest
hem t
othet
ranspor
tlayer
.
Thesendi
ngt
ranspor
tlayerhasadoubl
erol
e:I
tisbot
haconsumeranda
pr
oducer
.Itconsumest
hemessagespushedbyt
hepr
oducer
.Itencapsul
atest
he
n
messages i
n packet
s and pushes t
e.ihem t
othe r
ecei
ving t
ranspor
tlayer
.The
r
ecei
vingt
ranspor
tlayeral
sohasadoubl
erol
e:i
tist
heconsumerf
ort
hepacket
s
r
ecei
vedf
rom t
hesenderandt
hepr
oducert
hatdecapsul
atest
hemessagesand
fre
del
iver
sthem t
otheappl
icat
ionl
ayer
.Thel
astdel
iver
y,however
,isnor
mal
lya
pul
li
ngdel
iver
y;t
het
ranspor
tlayerwai
tsunt
ilt
heappl
icat
ion-
layerpr
ocessasksf
or
s4
messages.
Fi
gur
e5showst
hatweneedatl
eastt
wocasesoff
low cont
rol
:fr
om t
he
te
sendi
ngt
ranspor
tlayert
othesendi
ngappl
icat
ionl
ayerandf
rom t
her
ecei
ving
no
t
ranspor
tlayert
othesendi
ngt
ranspor
tlayer
.
Fi
gur
e5:Fl
owcont
rolatt
het
ranspor
tlayer
5.Er
rorCont
rol
I
ntheI
nter
net
,si
ncet
heunder
lyi
ngnet
wor
klayer(
IP)i
sunr
eli
abl
e,weneedt
o
Dept
.ofECE,
RNSI
TPage4
CCNModul
e5:Tr
anspor
tlayer
maket
het
ranspor
tlayerr
eli
abl
eift
heappl
icat
ionr
equi
resr
eli
abi
li
ty.Rel
iabi
li
ty
canbeachi
evedt
oadder
rorcont
rolser
vicest
othet
ranspor
tlayer
.Er
rorcont
rol
att
het
ranspor
tlayeri
sresponsi
blef
or
1.Det
ect
inganddi
scar
dingcor
rupt
edpacket
s.
2.Keepi
ngt
rackofl
ostanddi
scar
dedpacket
sandr
esendi
ngt
hem.
3.Recogni
zingdupl
icat
epacket
sanddi
scar
dingt
hem.
4.Buf
fer
ingout
-of
-or
derpacket
sunt
ilt
hemi
ssi
ngpacket
sar
ri
ve.
Er
rorcont
rol
,unl
i
kef
low cont
rol
,invol
vesonl
ythesendi
ngandr
ecei
ving
t
ranspor
tlayer
s.Assumet
hatt
hemessagechunksexchangedbet
weent
he
appl
icat
ionandt
ranspor
tlayer
sar
eer
rorf
ree.Fi
gur
e6showst
heer
rorcont
rol
bet
weent
hesendi
ngandr
ecei
vingt
ranspor
tlayer
s.Aswi
tht
hecaseoff
low
cont
rol
,ther
ecei
vingt
ranspor
tlayermanageser
rorcont
rol
,mostoft
het
ime,
by
n
i
nfor
mingt
hesendi
ngt
ranspor
tlayeraboutt
hepr
obl
ems.
e.i
fre
s4
Fi
gur
e6:Er
rorcont
rolatt
het
ranspor
tlayer
te
SequenceNumber
s
no
Er
rorcont
rolr
equi
rest
hatt
hesendi
ngt
ranspor
tlayerknowswhi
chpacketi
s
t
ober
esentandt
her
ecei
vingt
ranspor
tlayerknowswhi
chpacketi
sadupl
icat
e,or
whi
ch packethas ar
ri
ved outofor
der
.Thi
s can be done i
fthe packet
s ar
e
number
ed.Wecanaddaf
iel
dtot
het
ranspor
t-
layerpackett
ohol
dthesequence
numberoft
hepacket
.Whenapacketi
scor
rupt
edorl
ost
,ther
ecei
vingt
ranspor
t
l
ayercansomehowi
nfor
mthesendi
ngt
ranspor
tlayert
oresendt
hatpacketusi
ng
t
hesequencenumber
.Ther
ecei
ving t
ranspor
tlayercan al
so det
ectdupl
icat
e
packet
sift
wor
ecei
vedpacket
shavet
hesamesequencenumber
.Theout
-of
-or
der
packet
scanber
ecogni
zedbyobser
vinggapsi
nthesequencenumber
s.Packet
s
ar
enumber
edsequent
ial
ly.However
,becauseweneedt
oincl
udet
hesequence
numberofeachpacketi
ntheheader
,weneedt
osetal
imi
t.I
ftheheaderoft
he
packetal
lowsm bi
tsf
ort
hesequencenumber
,thesequencenumber
srangef
rom 0
o2m -
t 1.
Dept
.ofECE,
RNSI
TPage5
CCNModul
e5:Tr
anspor
tlayer
Forexampl fm i
e,i s4,t
heonl
ysequencenumber
sar
e0t
hrough15,i
ncl
usi
ve.
However
,we
canwr
apar
oundt
hesequence.Sot
hesequencenumber
sint
hiscasear
e
I
not
herwor
ds,
thesequencenumber
sar o2m.
emodul
Acknowl
edgment
The r
ecei
versi
de can send an acknowl
edgment(
ACK)f
oreach ofa
col
lect
ionofpacket
sthathavear
ri
vedsaf
eandsound.Ther
ecei
vercansi
mpl
y
di
scar
dthecor
rupt
edpacket
s.Thesendercandet
ectl
ostpacket
sifi
tusesat
imer
.
Whenapacketi
ssent
,thesenderst
art
sat
imer
.IfanACKdoesnotar
ri
vebef
ore
t
het
imerexpi
res,t
hesenderr
esendst
hepacket
.Dupl
icat
epacket
scanbesi
lent
ly
di
scar
dedbyt
her
ecei
ver
.Out
-of
-or
derpacket
scanbeei
therdi
scar
ded(
tobe
n
t
reat
edasl
ostpacket
sbyt
hesender
),orst
e.i oredunt
ilt
hemi
ssi
ngonear
ri
ves.
6.Congest
ionCont
rol
Congest
ioni
nanet
wor
kmayoccuri
fthel
oadont
henet
wor
k—t
henumberof
fre
packet
ssentt
othenet
wor
kisgr
eat
ert
hant
hecapaci
tyoft
henet
wor
k,t
henumber
ofpacket
sanet
wor
kcanhandl
e.Congest
ioncont
rolr
efer
stot
hemechani
smsand
s4
t
echni
quest
hatcont
rolt
hecongest
ionandkeept
hel
oadbel
owt
hecapaci
ty.
Congest
ion happens i
n anysyst
em t
hati
nvol
ves wai
ti
ng.Forexampl
e,
te
congest
ionhappensonaf
reewaybecauseanyabnor
mal
it
yint
hef
low,
suchasan
no
acci
dent dur
ing r
ush hour
,cr
eat
es bl
ockage.Congest
ion i
n a net
wor
k or
i
nter
net
wor
koccur
sbecauser
out
ersandswi
tcheshavequeues—buf
fer
sthathol
d
t
hepacket
sbef
oreandaf
terpr
ocessi
ng.Ar
out
er,f
orexampl
e,hasani
nputqueue
andanout
putqueuef
oreachi
nter
face.I
far
out
ercannotpr
ocesst
hepacket
sat
t
hesamer
ateatwhi
cht
heyar
ri
ve,t
hequeuesbecomeover
loadedandcongest
ion
occur
s.Congest
ionatt
het
ranspor
tlayeri
sact
ual
lyt
her
esul
tofcongest
ionatt
he
net
wor
klayer
,whi
chmani
fest
sit
sel
fatt
het
ranspor
tlayer
.
2)Expl
aint
heconceptofsl
idi
ngwi
ndowwi
thaneatdi
agr
am.
Sl
idi
ngWi
ndow
Si
nce t
he sequence number o 2m,a ci
s use modul rcl
e can r
epr
esentt
he
sequencenumber
sfr o2m −1(
om 0t Figur
e7)
.Thebuf
feri
srepr
esent
edasa
setofsl
ices,cal
l hesl
edt idi
ngwi
ndow,t
hatoccupi
espar
toft
heci
rcl
eatany
Dept
.ofECE,
RNSI
TPage6
CCNModul
e5:Tr
anspor
tlayer
t
ime.Att
hesendersi
te,whenapacketi
ssent
,thecor
respondi
ngsl
icei
s
mar
ked.Whenal
lthesl
icesar
emar
ked,i
tmeanst
hatt
hebuf
feri
sful
landno
f
urt
hermessagescanbeaccept
edf
rom t
heappl
icat
ionl
ayer
.
Whenanacknowl
edgmentar
ri
ves,t
hecor
respondi
ngsl
icei
sunmar
ked.I
f
someconsecut
ivesl
icesf
rom t
hebegi
nni
ngoft
hewi
ndow ar
eunmar
ked,t
he
wi
ndowsl
idesovert
her
angeoft
hecor
respondi
ngsequencenumber
stoal
low
mor
efr
eesl
icesatt
heendoft
hewi
ndow.Fi
gur
e7showst
hesl
idi
ngwi
ndowat
t
hesender
.Thesequencenumber
sar
einmodul m =4)andt
o16( hesi
zeoft
he
wi
ndowi
s7.Thesl
idi
ngwi
ndowi
sjustanabst
ract
ion:t
heact
ualsi
tuat
ionuses
comput
ervar
iabl
est
ohol
dthesequencenumber
soft
henextpackett
obesent
andt
hel
astpacketsent
.
n
e.i
fre
s4
te
no
Fi
gur
e7:Sl
idi
ngwi
ndowi
nci
rcul
arf
ormat
Mostpr
otocol
sshowt
hesl
idi
ngwi
ndowusi
ngl
inearr
epr
esent
ati
on.Thei
deai
s
t
he same,buti
tnor
mal
lyt
akes l
ess space on paper
.Fi
gur
e 8 shows t
his
r
epr
esent
ati
on.
Dept
.ofECE,
RNSI
TPage7
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e8:Sl
idi
ngwi
ndowi
nli
nearf
ormat
n
3.Wr
it
eout
li
neandexpl
ainsendwi
e.i
ndow andr
ecei
vewi
ndow f
orGobackN
pr
otocol
/sel
ect
iver
epeatpr
otocol
.
fre
Go-
BackNpr
otocol
s4
Toi
mpr
ovet
heef
fi
ciencyoft
ransmi
ssi
on(
tof
il
lthepi
pe)
,mul
ti
plepacket
s
mustbei
ntr
ansi
ti
onwhi
let
hesenderi
swai
ti
ngf
oracknowl
edgment
.Inot
her
te
wor
ds,
weneedt
oletmor
ethanonepacketbeout
standi
ngt
okeept
hechannel
no
busywhi
let
hesenderi
swai
ti
ngf
oracknowl
edgment
.Oneoft
hepr
otocoli
s
cal
led Go-
Back-
N(GBN)
.Thekeyt
oGo- Ni
back- st
hatwecansendsever
al
packet
sbef
orer
ecei
vingacknowl
edgment
s,butt
her
ecei
vercanonl
ybuf
fer
onepacket
.Wekeepacopyoft
hesentpacket
sunt
ilt
heacknowl
edgment
s
ar
ri
ve.Fi
gur
e9showst
heout
li
neoft
hepr
otocol
.
Dept
.ofECE,
RNSI
TPage8
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e9:Go-
Back-
Npr
otocol
SendWi
ndow
Thesendwi
ndowi
sani
magi
nar
yboxcover
ingt
hesequencenumber
soft
he
dat
apacket
sthatcanbei
ntr
ansi
torcanbesent
.Ineachwi
ndowposi
ti
on,
someof
t
hesequencenumber
sdef
inet
hepacket
sthathavebeensent
;ot
her
sdef
inet
hose
t
hatcanbesent
.Themaxi
mum si
zeoft
hewi s2m -1,
ndowi wel
ett
hesi
zebef
ixed
andsett
othemaxi
mum val
ue,Fi
gur
e10showsasl
idi
ngwi
ndowofsi
ze7(
m =3)
f
ort
heGo-
Back-
Npr
otocol
.
n
e.i
fre
Fi
gur
e10:Sendwi
ndowf
orGo-
Back-
N
Thesendwi
ndow atanyt
imedi
videst
hepossi
blesequencenumber
sint
o
s4
f
ourr
egi
ons.Thef
ir
str
egi
on,l
eftoft
hewi
ndow,def
inest
hesequencenumber
s
bel
ongi
ngt
opacket
sthatar
eal
readyacknowl
edged.Thesenderdoesnotwor
ry
te
aboutt
hesepacket
sandkeepsnocopi
esoft
hem.Thesecondr
egi
on,col
ored,
no
def
inest
her
angeofsequencenumber
sbel
ongi
ngt
othepacket
sthathavebeen
sent
,buthaveanunknownst
atus.Thesenderneedst
owai
ttof
indouti
fthese
packet
shavebeenr
ecei
vedorwer
elost
.Thesear
ecal
ledasout
standi
ngpacket
s.
Thet
hir
drange,whi
tei
nthef
igur
e,def
inest
her
angeofsequencenumber
sfor
packet
sthatcanbesent
;however
,thecor
respondi
ngdat
ahavenotyetbeen
r
ecei
vedf
rom t
heappl
icat
ionl
ayer
.Fi
nal
ly,t
hef
our
thr
egi
on,r
ightoft
hewi
ndow,
def
inessequencenumber
sthatcannotbeusedunt
ilt
hewi
ndowsl
ides.
Dept
.ofECE,
RNSI
TPage9
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e11:Sl
idi
ngt
hesendwi
ndow
Fi
gur
e11showshowasendwi
ndowcansl
ideoneormor
esl
otst
other
ight
when an acknowl
edgment ar
ri
ves f
rom t
he ot
her end. I
n t
he f
igur
e,an
n
acknowl
edgmentwi
thack
No = 6 hasar
r
sequenceno6.
i
ved.Thi
smeanst e.i
hatt
her
ecei
veri
swai
ti
ng f
orpacket
swi
th
fre
Recei
veWi
ndow
Ther
ecei
vewi
ndow makessur
ethatt
hecor
rectdat
apacket
sar
erecei
ved
s4
andt
hatt
hecor
rectacknowl
edgment
sar
esent
.InGo-
Back-
N,t
hesi
zeoft
he
te
r
ecei
vewi
ndow i
sal
ways1.Ther
ecei
veri
sal
waysl
ooki
ngf
ort
hear
ri
valofa
speci
fi
cpacket
.Anypacketar
ri
vingoutofor
deri
sdi
scar
dedandneedst
obe
no
r
esent
.Fi
gur
e12showst
her
ecei
vewi
ndow.I
tneedsonl
yonevar
iabl
e,Rn(
recei
ve
wi
ndow,nextpacketexpect
ed)
,todef
inet
hisabst
ract
ion.Thesequencenumber
s
t
othel
eftoft
hewi
ndowbel
ongt
othepacket
sal
readyr
ecei
vedandacknowl
edged;
t
hesequencenumber
stot
her
ightoft
hiswi
ndowdef
inet
hepacket
sthatcannotbe
r
ecei
ved.Anyr
ecei
vedpacketwi
thasequencenumberi
ntheset
wor
egi
onsi
s
di
scar
ded.Onl
yapacketwi
thasequencenumbermat
chi
ngt
heval
ueofRni
s
accept
edandacknowl
edged.Ther
ecei
vewi
ndowal
sosl
ides,
butonl
yonesl
otata
t
ime.Whenacor
rectpacketi
srecei
ved,
thewi
ndowsl
ides,
Rn=( o2m.
Rn+1)modul
Dept
.ofECE,
RNSI
TPage10
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e12:Recei
vewi
ndowf
orGo-
Back-
N
FSMs
Fi
gur
e13showst
heFSMsf
ort
heGBNpr
otocol
.
Sender
Thesenderst
art
sint
her
eadyst
ate,
butt
her
eaf
teri
tcanbei
noneoft
het
wost
ates:
n
r
eadyorbl
ocki
ng.Thet
wovar
iabl
esar
enor
mal
e.i l
yini
ti
ali
zedt
o0(
Sf=Sn=0)
.
Readyst
ate.Fourevent
smayoccurwhent
hesenderi
sinr
eadyst
ate.
fre
a.I
far
equestcomesf
rom t
heappl
icat
ionl
ayer
,thesendercr
eat
esapacketwi
th
t
hesequence numbersett
oSn.Acopyoft
hepacketi
sst
ored,andt
hepacket
s4
i
ssent
.Thesenderal
sost
art
stheonl
yti
meri
fiti
snotr
unni
ng.Theval
ueofSn
i
snow i
ncr
ement
ed,( o2m.I
Sn=Sn+1)modul fthewi
ndow i
sful
l,Sn=(
Sf+
te
Ssi o2m,
ze)modul thesendergoest
othebl
ocki
ngst
ate.
no
b.I
fan er
ror
-f
ree ACK ar
ri
ves wi
th ackNo r
elat
ed t
o one oft
he out
standi
ng
packet
s,t
hesendersl
idest
hewi
ndow (
setSf=ackNo)
,andi
fal
lout
standi
ng
packet
s ar
e acknowl
edged (
ackNo = Sn)
,then t
he t
imeri
s st
opped.I
fal
l
out
standi
ngpacket
sar
enotacknowl
edged,
thet
imeri
srest
art
ed.
c.I
facor
rupt
edACK oraner
ror
-f
reeACK wi
thacknumbernotr
elat
edt
othe
out
standi
ngpacketar
ri
ves,
iti
sdi
scar
ded.
d.I
fat
ime-
outoccur
s,t
hesenderr
esendsal
lout
standi
ngpacket
sandr
est
art
sthe
t
imer
.
Bl
ocki
ngst
ate.Thr
eeevent
smayoccuri
nthi
scase:
a.I
faner
ror
-f
reeACKar
ri
veswi
thackNor
elat
edt
ooneoft
heout
standi
ngpacket
s,
t
hesendersl
idest
hewi
ndow(
setSf=ackNo)andi
fal
lout
standi
ngpacket
sar
e
acknowl
edged(
ackNo=Sn)
,thent
het
imeri
sst
opped.I
fal
lout
standi
ngpacket
s
Dept
.ofECE,
RNSI
TPage11
CCNModul
e5:Tr
anspor
tlayer
ar
enotacknowl
edged,
thet
imeri
srest
art
ed.Thesendert
henmovest
other
eady
st
ate.
b.I
facor
rupt
ed ACK oran er
ror
-f
reeACK wi
tht
heackNo notr
elat
ed t
othe
out
standi
ngpacket
sar
ri
ves,
theACKi
sdi
scar
ded.
c.I
fat
ime-
outoccur
s,t
hesendersendsal
lout
standi
ngpacket
sandr
est
art
sthe
t
imer
.
n
e.i
fre
s4
te
no
Fi
gur
e13FSMsf
ort
heGo-
Back-
Npr
otocol
Recei
ver
Ther
ecei
veri
sal
waysi
nther
eadyst
ate.Theonl
yvar
iabl
e,Rn,i
sini
ti
ali
zedt
o0.
Thr
eeevent
smayoccur
:
a.I
faner
ror
-f
reepacketwi
thseqNo=Rnar
ri
ves,t
hemessagei
nthepacketi
s
del
iver
ed
Dept
.ofECE,
RNSI
TPage12
CCNModul
e5:Tr
anspor
tlayer
t
otheappl
icat
ionl
ayer
.Thewi
ndowt
hensl
ides,
Rn=(
Rn+1)modul
o2m.
Fi
nal
lyanACKi
ssentwi
thackNo=Rn.
b.I
faner
ror
-f
reepacketwi
thseqNoout
sidet
hewi
ndow ar
ri
ves,t
hepacketi
s
di
scar
ded,
butanACKwi
thackNo=Rni
ssent
.
c.I
facor
rupt
edpacketar
ri
ves,
iti
sdi
scar
ded.
SendWi
ndowSi
ze
Thesi
zeoft
hesendwi
ndowmustbel han2m i
esst sbecausef
orexampl
e,choose
m =2,
whi
chmeanst
hesi
zeoft ndowcanbe2m -1,
hewi or3.Fi
gur
e14compar
es
awi
ndowsi
zeof3agai
nstawi
ndowsi
zeof4.I
fthesi
zeoft
hewi
ndowi
s3(
less
han2m)andal
t lthr
eeacknowl
edgment
sar
elost
,theonl
yti
merexpi
resandal
lthr
ee
n
packet
sar
eresent
.Ther
ecei
veri
snow expect
ingpacket3,notpacket0,sot
he
dupl
i
s4(
icat
epacketi
equalt
scor
o22)andal
rect
lydi
scar
lacknowl
e.i
ded.Ont
edgment
sar
heot
el
herhand,
ost
,t
ift
hesi
hesenderwi
l
zeoft
hewi
ndow
lsendadupl
icat
e
fre
ofpacket0.However
,thi
sti
met
hewi
ndowoft
her
ecei
verexpect
stor
ecei
vepacket
0(
int
henextcycl
e),soi
taccept
spacket0,notasadupl
icat
e,butast
hef
ir
st
s4
packeti
nthenextcycl
e.Thi
sisaner
ror
.Thi
sshowst
hatt
hesi
zeoft
hesend
wi
ndowmustbel han2m.
esst
te
no
Fi
gur
e14Sendwi
ndowsi
zef
orGo-
Back-
N
Exampl
e1
Dept
.ofECE,
RNSI
TPage13
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e15showsanexampl
eofGo- N.Thi
Back- sisanexampl
eofacasewher
ethe
f
orwar
dchanneli
srel
iabl
e,butt
her
ever
sei
snot
.Nodat
apacket
sar
elost
,but
someACKsar
edel
ayedandonei
slost
.Theexampl
eal
soshowshowcumul
ati
ve
acknowl
edgment
scanhel
pifacknowl
edgment
sar
edel
ayedorl
ost
.
n
e.i
fre
s4
te
Fi
gur
e15:Fl
owdi
agr
am f
orExampl
e1
Af
teri
nit
ial
izat
ion,t
her
e ar
e some senderevent
s.Requestevent
s ar
e
no
t
ri
gger
edbymessagechunksf
rom t
heappl
icat
ionl
ayer
;ar
ri
valevent
sar
etr
igger
ed
byACKsr
ecei
vedf
rom t
henet
wor
klayer
.Ther
eisnot
ime-
outeventher
ebecause
al
lout
standi
ngpacket
sar
eacknowl
edgedbef
oret
het
imerexpi
res.Al
thoughACK2
i
slost
,ACK3i
scumul
ati
veandser
vesasbot
hACK2andACK3.Ther
ear
efour
event
satt
her
ecei
versi
te.
Exampl
e2
Fi
gur
e16showswhathappenswhenapacketi
slost
.Packet
s0,
1,2,
and3ar
esent
.
However
,packet1i
slost
.Ther
ecei
verr
ecei
vespacket
s2and3,butt
heyar
e
di
scar
dedbecauset
heyar
erecei
vedoutofor
der(
packet1i
sexpect
ed)
.Whent
he
r
ecei
verr
ecei
vespacket
s2and3,i
tsendsACK1t
oshowt
hati
texpect
stor
ecei
ve
packet1.However
,theseACKsar
enotusef
ulf
ort
hesenderbecauset
heackNoi
s
oSf,notgr
equalt eat hanSf
ert .Sot
hesenderdi
scar
dst
hem.Whent
het
ime-
out
Dept
.ofECE,
RNSI
TPage14
CCNModul
e5:Tr
anspor
tlayer
occur
s,t
hesenderr
esendspacket
s1,
2,and3,
whi
char
eacknowl
edged.
Go-
Back-
Nver
susSt
op-
and-
Wai
t
TheSt
op-
and-
Wai
tpr
otocoli
sact
ual
lyaGo-
Back-
Npr
otocoli
nwhi
cht
her
ear
eonl
y
t
wosequencenumber
sandt
hesendwi
ndowsi
zei
s1.I
not
herwor m =1and2m
ds,
−1=1.I
nGo-
Back-
N,wesai
dthatt
hear
it
hmet
ici o2m;i
smodul nSt
op-
and-
Wai
tit
i
smodul
o2,
whi
chi
sthesameas2m whenm =1.
n
e.i
fre
s4
te
no
Dept
.ofECE,
RNSI
TPage15
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e16:Fl
owdi
agr
am f
orExampl
e2
Sel
ect
ive-
RepeatPr
otocol
TheGo- N pr
Back- otocolsi
mpl
if
iest
hepr
ocessatt
her
ecei
ver
.Ther
ecei
ver
keepst
rackofonl
yonevar
iabl
e,andt
her
eisnoneedt
obuf
ferout
-of
-or
derpacket
s;
t
heyar
esi
mpl
ydi
scar
ded.However
,thi
spr
otocoli
sinef
fi
cienti
ftheunder
lyi
ng
net
wor
kpr
otocoll
osesal
otofpacket
s.Each t
imeasi
ngl
epacketi
slostor
cor
rupt
ed,t
hesenderr
esendsal
lout
standi
ngpacket
s,event
houghsomeoft
hese
packet
smayhavebeenr
ecei
vedsaf
eandsoundbutoutofor
der
.Ift
henet
wor
k
n
l
ayeri
slosi
ngmanypacket
sbecauseofcongest
ioni
nthenet
wor
k,t
her
esendi
ng
ofal
mor
loft
heseout
epacket
sar
el
standi
ost
ngpacket
.Thi
shasanaval
e.i
smakest
hecongest
ancheef
fectt
ionwor
hatmayr
se,andevent
esul
tint
het
ot
ual
al
ly
fre
col
lapseoft
henet
wor
k.
Anot
herpr
otocol
,cal
led t
he Sel
ect
ive-
Repeat(
SR)pr
otocol
,has been
devi
sed,whi
ch,ast
henamei
mpl
ies,r
esendsonl
ysel
ect
ivepacket
s,t
hoset
hatar
e
s4
act
ual
l
ylost
.
te
Theout
li
neoft
hispr
otocoli
sshowni
nFi
gur
e17.
no
Fi
gur
e17:
Out
li
neofSel
ect
ive-
Repeat
Wi
ndows
TheSel
ect
ive-
Repeatpr
otocolal
sousest
wowi
ndows:asendwi
ndowanda
r
ecei
ve wi
ndow.However
,ther
e ar
e di
ff
erences bet
ween t
he wi
ndows i
nthi
s
Dept
.ofECE,
RNSI
TPage16
CCNModul
e5:Tr
anspor
tlayer
pr
otocolandt
heonesi
nGo-
Back-
N.Fi
rst
,themaxi
mum si
zeoft
hesendwi
ndowi
s
muchsmal
ler
;i s2m-
ti 1.Ther
easonf
ort
hiswi
llbedi
scussedl
ater
.Second,t
he
r
ecei
vewi
ndowi
sthesamesi
zeast
hesendwi
ndow.
Thesendwi
ndow maxi zecanbe2m-
mum si 1.Forexampl
e,i
fm =4,t
he
sequencenumber
sgof
rom 0t
o15,butt
hemaxi
mum si
zeoft
hewi
ndowi
sjust8
(
iti
s15i
ntheGo-
Back-
N Pr
otocol
).TheSel
ect
ive-
Repeatsendwi
ndow i
nFi
gur
e
18.
1toemphasi
zet
hesi
ze.
Ther
ecei
vewi
ndowi
nSel
ect
ive-
Repeati
stot
all
ydi
ff
erentf
rom t
heonei
nGo
-
Back-
N.Thesi
zeoft
her
ecei
vewi
ndowi
sthesameast
hesi
zeoft
hesendwi
ndow
max2m-
( 1).TheSel
ect
ive-
Repeatpr
otocolal
lowsasmanypacket
sast
hesi
zeof
t
her
ecei
vewi
ndow t
o ar
ri
veoutofor
derand bekeptunt
ilt
her
eisasetof
consecut
ivepacket
stobedel
iver
edt
otheappl
icat
ionl
ayer
.Becauset
hesi
zesof
n
t
hesendwi
ndow andr
ecei
vewi
ndow ar
ethesame,al
lthepacket
sint
hesend
packetcan ar
emphasi
zet
r
hati
i
veoutofor
nar
eli
abl
epr
otocolt
e.i
derand best
her
or
ecei
ed unt
ilt
heycan bedel
verneverdel
iver
spacket
iver
ed.To
soutof
fre
or
dert
otheappl
icat
ionl
ayer
.
Fi
gur
e18.
2showst
her
ecei
vewi
ndow i
nSel
ect
ive-
Repeat
.Thosesl
otsi
nsi
det
he
s4
wi
ndow t
hatar
eshadeddef
inepacket
sthathavear
ri
vedoutofor
derandar
e
wai
ti
ngf
ort
heear
li
ert
ransmi
tt
edpackett
oar
ri
vebef
oredel
iver
ytot
heappl
icat
ion
te
l
ayer
.
no
Fi
gur
e18.
1:Sendwi
ndowf
orSel
ect
ive-
Repeatpr
otocol
Dept
.ofECE,
RNSI
TPage17
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e18.
2:Recei
vewi
ndowf
orSel
ect
ive-
Repeatpr
otocol
Exampl
e3
n
Assumeasendersends6packet
s:packet
s0,
1,2,
3,4,
and5.Thesenderr
ecei
ves
anACKwi
thackNo=3.Whati
sthei
nt
e.i
er
pret
ati
oni
fthesyst
em i
susi
ngGBNorSR?
fre
Sol
uti
on
I
fthesyst
em i
susi
ngGBN,i
tmeanst
hatpacket
s0,1,and2havebeenr
ecei
ved
s4
uncor
rupt
edandt
her
ecei
veri
sexpect
ingpacket3.I
fthesyst
em i
susi
ngSR,i
t
meanst
hatpacket3hasbeenr
ecei
veduncor
rupt
ed;t
heACKdoesnotsayanyt
hing
te
aboutot
herpacket
s.
FSMs
no
Fi
gur
e19showst
heFSMsf
ort
heSel
ect
ive-
Repeatpr
otocol
.Iti
ssi
mil
art
othe
onesf
ort
heGBN,
butt
her
ear
esomedi
ff
erences.
Sender
Thesenderst
art
sint
her
eadyst
ate,butl
ateri
tcanbei
noneoft
het
wost
ates:
r
eadyorbl
ocki
ng.Thef
oll
owi
ngshowst
heevent
sandt
hecor
respondi
ngact
ionsi
n
eachst
ate.
Readyst
ate.Fourevent
smayoccuri
nthi
scase:
a.I
far
equestcomesf
rom t
heappl
icat
ionl
ayer
,thesendercr
eat
esapacketwi
th
t oSn.Acopyoft
hesequencenumbersett hepacketi
sst
ored,
andt
hepacketi
s
sent
.Ift
het
imeri
snotr
unni
ng,t
hesenderst
art
sthet
imer ueofSni
.Theval s
nowi
ncr
ement Sn=(
ed, Sn+1)modul
o2m.I
fthewi
ndowi
sful
lSn=(
, Sf+Ssi
ze)
o2m,
modul thesendergoest
othebl
ocki
ngst
ate.
b.I
faner
ror
-f
reeACKar
ri
veswi
thackNor
elat
edt
ooneoft
heout
standi
ngpacket
s,
Dept
.ofECE,
RNSI
TPage18
CCNModul
e5:Tr
anspor
tlayer
t
hat packeti
smar
kedasacknowl
edged.I
ftheackNo=Sf
,thewi
ndowsl
idest
o
t
her
ightunt
i heSfpoi
lt ntst
othef
ir
stunacknowl
edgedpacket(
allconsecut
ive
acknowl
edgedpacket
sar
enow out
sidet
hewi
ndow)
.Ift
her
ear
eout
standi
ng
packet
s,t
het
imeri
srest
art
ed;ot
her
wise,
thet
imeri
sst
opped.
c.I
facor
rupt
edACKoraner
ror
-f
reeACKwi
thackNonotr
elat
edt
oanout
standi
ng
packetar
ri
ves,
iti
sdi
scar
ded.
d.I
fat
ime-
outoccur
s,t
hesenderr
esendsal
lunacknowl
edgedpacket
sint
he
wi
ndowandr
est
art
sthet
imer
.
Bl
ocki
ngst
ate.Thr
eeevent
smayoccuri
nthi
scase:
a.I
faner
ror
-f
reeACKar
ri
veswi
thackNor
elat
edt
ooneoft
heout
standi
ngpacket
s,
t
hatpacketi
smar
kedasacknowl
edged.I
naddi
ti
on,i
ftheackNo= Sf
,the
wi
ndowi
ssl
idt
other
ightunt
i heSfpoi
lt ntst
othef
ir
stunacknowl
edgedpacket
n
(
allconsecut
iveacknowl
edged packet
sar
enow out
sidet
hewi
ndow)
.Ift
he
wi
ndow
hassl
id,
thesendermovest
other
e.i
eadyst
ate.
fre
b.I
facor
rupt
edACKoraner
ror
-f
reeACKwi
tht
heackNonotr
elat
edt
oout
standi
ng
packet
sar
ri
ves,
theACKi
sdi
scar
ded.
s4
c.I
fat
ime-
outoccur
s,t
hesenderr
esendsal
lunacknowl
edgedpacket
sint
he
wi
ndowand r
est
art
sthet
imer
.
te
no
Dept
.ofECE,
RNSI
TPage19
CCNModul
e5:Tr
anspor
tlayer
n
e.i
fre
s4
te
no
Recei
ver
Ther
ecei
veri
sal
waysi
nther
eadyst
ate.Thr
eeevent
smayoccur
:
a.I
faner
ror
-f
reepacketwi
thseqNoi
nthewi
ndowar
ri
ves,
thepacketi
sst
oredand
anACKwi
thackNo=seqNoi
ssent
.Inaddi
ti
on,i
ftheseqNo=Rn,t
hent
he
packetand al
lpr
evi
ousl
y ar
ri
ved consecut
ive packet
s ar
e del
iver
ed t
othe
appl
icat
ionl
ayerandt
hewi
ndowsl
idessot heRnpoi
hatt ntst
othef
ir
stempt
y
sl
ot.
Dept
.ofECE,
RNSI
TPage20
CCNModul
e5:Tr
anspor
tlayer
b.I
faner
ror
-f
reepacketwi
thseqNoout
sidet
hewi
ndow ar
ri
ves,t
hepacketi
s
di
scar
ded,
butanACKwi
thackNo=Rni
sret
urnedt
othesender
.Thi
sisneeded
t
olett
hesendersl
idei
tswi
ndowi
fsomeACKsr
elat
edt
opacket
swi
thseqNo<
Rnwer
elost
.
c.I
facor
rupt
edpacketar
ri
ves,
thepacketi
sdi
scar
ded.
Exampl
e4
Thi
sexampl
eissi
mil
art
oExampl
e2(
Figur
e16)i
nwhi
chpacket1i
slost
.Sel
ect
ive-
Repeatbehavi
ouri
sshowni
nthi
scase.Fi
gur
e19showst
hesi
tuat
ion.
n
e.i
fre
s4
te
no
Fi
gur
e19:Fl
owdi
agr
am f
orExampl
e4
Att
hesender
,packet0i
str
ansmi
tt
edandacknowl
edged.Packet1i
slost
.
Packet
s2and3ar
ri
veoutofor
derandar
eacknowl
edged.Whent
het
imert
imes
out
,packet1(
theonl
yunacknowl
edgedpacket
)isr
esentandi
sacknowl
edged.The
sendwi
ndowt
hensl
ides.
Att
her
ecei
versi
teweneedt
odi
sti
ngui
shbet
weent
heaccept
anceofa
packetandi
tsdel
iver
ytot
heappl
icat
ionl
ayer
.Att
hesecondar
ri
val
,packet2
Dept
.ofECE,
RNSI
TPage21
CCNModul
e5:Tr
anspor
tlayer
ar
ri
vesandi
sst
oredandmar
ked(
shadedsl
ot)
,buti
tcannotbedel
iver
edbecause
packet1i
smi
ssi
ng.Att
henextar
ri
val
,packet3ar
ri
vesandi
smar
kedandst
ored,
butst
il
lnoneoft
hepacket
scanbedel
iver
ed.Onl
yatt
hel
astar
ri
val
,whenf
inal
lya
copyofpacket1ar
ri
ves,canpacket
s1,2,and3bedel
iver
edt
otheappl
icat
ion
l
ayer
.Ther
ear
etwocondi
ti
onsf
ort
hedel
iver
yofpacket
stot
heappl
icat
ionl
ayer
:
Fi
rst
,asetofconsecut
ivepacket
smusthavear
ri
ved.Second,t
hesetst
art
sfr
om
t
hebegi
nni
ngoft
hewi
ndow.Af
tert
hef
ir
star
ri
val
,ther
ewasonl
yonepacketandi
t
st
art
edf
rom t
hebegi
nni
ngoft
hewi
ndow.Af
tert
hel
astar
ri
val
,ther
ear
ethr
ee
packet
sandt
hef
ir
stonest
art
sfr
om t
hebegi
nni
ngoft
hewi
ndow.Thekeyi
sthata
r
eli
abl
etr
anspor
tlayerpr
omi
sest
odel
iverpacket
sinor
der
.
Wi
ndowSi
zes
Wecannowshowwhyt
hesi
zeoft
hesenderand r
ecei
verwi
ndowscanbe
n
atmostone- fof2m.Foranexampl
hal e,wechoosem =2,
whi
chmeanst
hesi
zeof
t
hewi s2m/
ndowi 2or2(m−1)=2.Fi
gur
e.i
e23.
36compar
esawi
ndowsi
zeof2wi
tha
wi
ndowsi
zeof3.I
fthesi
zeoft
hewi
ndowi
s2andal
lacknowl
edgment
sar
elost
,
fre
t
het
imerf
orpacket0expi
resandpacket0i
sresent
.However
,thewi
ndow oft
he
r
ecei
veri
snow expect
ing packet2,notpacket0,so t
hisdupl
icat
epacketi
s
s4
cor
rect
lydi
scar
ded(
thesequencenumber0i
snoti
nthewi
ndow)
.Whent
hesi
zeof
t
hewi
ndowi
s3andal
lacknowl
edgment
sar
elost
,thesendersendsadupl
icat
eof
te
packet0.However
,thi
sti
me,
thewi
ndowoft
her
ecei
verexpect
stor
ecei
vepacket0
no
(
0ispar
toft
hewi
ndow)
,soi
taccept
spacket0,
notasadupl
icat
e,butasapacket
i
nthenextcycl
e.Thi
siscl
ear
lyaner
ror
.
4.Whatar
etheser
vicespr
ovi
dedbyUDP?Ment
ionanyf
ourt
ypi
calappl
icat
ionsof
UDP.
Pr
ocess-
to-
ProcessCommuni
cat
ion
UDP pr
ovi
des pr
ocess-
to-
process communi
cat
ion usi
ng socketaddr
esses,a
combi
nat
ionofI
Paddr
essesandpor
tnumber
s.
Connect
ionl
essSer
vices
UDPpr
ovi
desaconnect
ionl
essser
vice.Thi
smeanst
hateachuserdat
agr
am sent
byUDPi
sani
ndependentdat
agr
am.Ther
eisnor
elat
ionshi
pbet
weent
hedi
ff
erent
userdat
agr
amseveni
ftheyar
ecomi
ngf
rom t
hesamesour
cepr
ocessandgoi
ng
t
othesamedest
inat
ionpr
ogr
am.Theuserdat
agr
amsar
enotnumber
ed.Al
so,
Dept
.ofECE,
RNSI
TPage22
CCNModul
e5:Tr
anspor
tlayer
unl
ikeTCP,t
her
eisnoconnect
ionest
abl
ishmentandnoconnect
iont
ermi
nat
ion.
Thi
smeanst
hateachuserdat
agr
am cant
ravelonadi
ff
erentpat
h.Oneoft
he
r
ami
fi
cat
ionsofbei
ngconnect
ionl
essi
sthatt
hepr
ocesst
hatusesUDPcannot
sendast
ream ofdat
atoUDPandexpectUDPt
ochopt
hem i
ntodi
ff
erent
,rel
ated
userdat
agr
ams.I
nst
eadeachr
equestmustbesmal
lenought
ofi
tint
ooneuser
dat
agr
am.Onl
ythosepr
ocessessendi
ngshor
tmessages,messagesl
esst
han
65,
507byt
es(
65,
535mi
nus8byt
esf
ort
heUDPheaderandmi
nus20byt
esf
ort
he
I
Pheader
),canuseUDP.
Fl
owCont
rol
UDP i
saver
ysi
mpl
epr
otocol
.Ther
eisnof
low cont
rol
,andhencenowi
ndow
mechani
sm.Ther
ecei
vermayover
fl
owwi
thi
ncomi
ngmessages.Thel
ackoff
low
cont
rolmeanst
hatt
hepr
ocessusi
ngUDPshoul
dpr
ovi
def
ort
hisser
vice,
ifneeded.
n
Er
rorCont
rol
Ther
t
ei
hatt
snoer
rorcont
rolmechani
hesenderdoesnotknowi
e.i
sm i
nUDPexceptf
ort
famessagehasbeenl
hechecksum.Thi
ostordupl
icat
smeans
ed.Whent
he
fre
r
ecei
verdet
ect
san er
rort
hrough t
hechecksum,t
heuserdat
agr
am i
ssi
lent
ly
di
scar
ded.Thel
ackofer
rorcont
rolmeanst
hatt
hepr
ocessusi
ngUDP shoul
d
s4
pr
ovi
def
ort
hisser
vice,
ifneeded.
Checksum
te
par
toft
heheaderoft
heI
Ppacketi
nwhi
cht
heuserdat
agr
am i
stobeencapsul
ated
wi
thsomef
iel
dsf
il
ledwi
th0s(
seeFi
gur
e20)
.
Fi
gur
e20:Pseudoheaderf
orchecksum cal
cul
ati
on
Dept
.ofECE,
RNSI
TPage23
CCNModul
e5:Tr
anspor
tlayer
I
fthechecksum doesnoti
ncl
udet
hepseudoheader
,auserdat
agr
am may
ar
ri
vesaf
eandsound.However
,ift
heI
Pheaderi
scor
rupt
ed,
itmaybedel
iver
edt
o
t
hewr
onghost
.Thepr
otocolf
iel
disaddedt
oensur
ethatt
hepacketbel
ongst
o
UDP,
andnott
oTCP.Wewi
llseel
atert
hati
fapr
ocesscanuseei
therUDPorTCP,
t
hedest
inat
ionpor
tnumbercanbet
hesame.Theval
ueoft
hepr
otocolf
iel
dfor
UDPi
s17.I
fthi
sval
uei
schangeddur
ingt
ransmi
ssi
on,t
hechecksum cal
cul
ati
on
att
her
ecei
verwi
lldet
ecti
tandUDPdr
opst
hepacket
.Iti
snotdel
iver
edt
othe
wr
ongpr
otocol
.
Congest
ionCont
rol
Si
nceUDPi
saconnect
ionl
esspr
otocol
,itdoesnotpr
ovi
decongest
ioncont
rol
.
UDP assumest
hatt
hepacket
ssentar
esmal
landspor
adi
candcannotcr
eat
e
congest
ioni
nthenet
wor
k.Thi
sassumpt
ionmayormaynotbet
ruet
oday,when
n
UDPi
susedf
ori
nter
act
iver
eal
-t
imet
ransf
erofaudi
oandvi
deo.
Encapsul
ati
onandDecapsul
Tosendamessagef
r
at
om onepr
i
on
e.i
ocesst
oanot
her
,theUDPpr
otocolencapsul
ates
fre
anddecapsul
atesmessages.
Queui
ng
s4
I
nUDP,queuesar
eassoci
atedwi
thpor
ts.Att
hecl
ientsi
te,whenapr
ocessst
art
s,
i
trequest
sapor
tnumberf
rom t
heoper
ati
ng syst
em.Somei
mpl
ement
ati
ons
te
cr
eat
ebot
hani
ncomi
ngandanout
goi
ngqueue.associ
atedwi
theachpr
ocess.
Ot
heri
mpl
ement
ati
ons cr
eat
e onl
y an i
ncomi
ng queue associ
ated wi
th each
no
pr
ocess.
Mul
ti
plexi
ngandDemul
ti
plexi
ng
I
nahostr
unni
ngaTCP/
IP pr
otocolsui
te,t
her
eisonl
yoneUDP butpossi
bly
sever
alpr
ocessest
hatmaywantt
o uset
heser
vicesofUDP.To handl
ethi
s
si
tuat
ion,
UDPmul
ti
plexesanddemul
ti
plexes.
Typi
calAppl
icat
ions
Thef
oll
owi
ngshowssomet
ypi
calappl
icat
ionst
hatcanbenef
itmor
efr
om t
he
ser
vicesofUDPt
hanf
rom t
hoseofTCP.
UDP i
s sui
tabl
efor a pr
ocess t
hat r
equi
res si
mpl
erequest
-r
esponse
communi
cat
ionwi
thl
it
tl
econcer
nforf
low ander
rorcont
rol
.Iti
snotusual
ly
usedf
orapr
ocesssuchasFTPt
hatneedst
osendbul
kdat
a.
UDPi
ssui
tabl
eforapr
ocesswi
thi
nter
nalf
low-ander
ror
-cont
rolmechani
sms.
Forexampl
e,t
heTr
ivi
alFi
leTr
ansf
erPr
otocol(
TFTP)pr
ocessi
ncl
udesf
lowand
Dept
.ofECE,
RNSI
TPage24
CCNModul
e5:Tr
anspor
tlayer
er
rorcont
rol
.Itcaneasi
lyuseUDP.
UDPi
sasui
tabl
etr
anspor
tpr
otocolf
ormul
ti
cast
ing.Mul
ti
cast
ingcapabi
li
tyi
s
embeddedi
ntheUDPsof
twar
ebutnoti
ntheTCPsof
twar
e.
UDPi
susedf
ormanagementpr
ocessessuchasSNMP.
UDPi
susedf
orsomer
out
eupdat
ingpr
otocol
ssuchasRout
ingI
nfor
mat
ion
Pr
otocol(
RIP)
.
UDPi
snor
mal
lyusedf
ori
nter
act
iver
eal
-t
imeappl
icat
ionst
hatcannott
oler
ate
unevendel
aybet
weensect
ionsofar
ecei
vedmessage.
5.Whatar
ethedi
ff
erentTCPser
vicesandf
eat
ures?Expl
aint
hem
Pr
ocess-
to-
ProcessCommuni
cat
ion
TCPpr
ovi
despr
ocess-
to-
processcommuni
cat
ionusi
ngpor
tnumber
s.
n
St
ream Del
iver
ySer
vice
TCP,
wi
t
unl
hpr
ikeUDP,
edef
i
isast
ream-
nedboundar
i
or
est
i
ent
edpr
oUDPf
e.i
otocol
ordel
i
.I
ver
nUDP,
apr
ocesssendsmessages
y.UDPaddsi
tsownheadert
oeachof
fre
t
hesemessagesanddel
iver
sitt
oIPf
ort
ransmi
ssi
on.Eachmessagef
rom t
he
pr
ocessi
scal
ledauserdat
agr
am,andbecomes,event
ual
ly,oneI
P dat
agr
am.
s4
Nei
therI
PnorUDPr
ecogni
zesanyr
elat
ionshi
pbet
weent
hedat
agr
ams.
TCP,ont
heot
herhand,al
lowst
hesendi
ngpr
ocesst
odel
iverdat
aasa
te
st
ream ofbyt
esandal
l
owst
her
ecei
vingpr
ocesst
oobt
aindat
aasast
ream of
byt
es.TCP cr
eat
es an envi
ronmenti
n whi
ch t
he t
wo pr
ocesses seem t
o be
no
connect
edbyani
magi
nar
y“t
ube”t
hatcar
ri
est
hei
rbyt
esacr
osst
heI
nter
net
.Thi
s
i
magi
nar
yenvi
ronmenti
sdepi
ctedi
nFi
gur
e21.Thesendi
ngpr
ocesspr
oduces
(
wri
test
o)t
hest
ream andt
her
ecei
vingpr
ocessconsumes(
readsf
rom)i
t.
Fi
gur
e21:St
ream del
iver
y
Sendi
ngandRecei
vingBuf
fer
s
Onewayt
oimpl
ementabuf
feri
stouseaci
rcul
arar
rayof1-
byt
elocat
ions
Dept
.ofECE,
RNSI
TPage25
CCNModul
e5:Tr
anspor
tlayer
asshowni
nFi
gur
e22.Forsi
mpl
ici
ty,i
tisshown ast
wobuf
fer
sof20byt
eseach;
nor
mal
lyt
he buf
fer
s ar
e hundr
eds ort
housands ofbyt
es,dependi
ng on t
he
i
mpl
ement
ati
on.Weal
soshow t
hebuf
fer
sast
hesamesi
ze,whi
chi
snotal
ways
t
hecase.Thef
igur
eshowst
hemovementoft
hedat
ainonedi
rect
ion.Att
hesender
,
t
he buf
ferhas t
hree t
ypes ofchamber
s.The whi
te sect
ion cont
ains empt
y
chamber
sthatcanbef
il
ledbyt
hesendi
ngpr
ocess(
producer
).Thecol
oredar
ea
hol
dsbyt
est
hathavebeensentbutnotyetacknowl
edged.TheTCPsenderkeeps
t
hesebyt
esi
nthebuf
ferunt
ili
trecei
vesanacknowl
edgment
.Theshadedar
ea
cont
ainsbyt
est
obesentbyt
hesendi
ngTCP.However
,aswewi
llseel
ateri
nthi
s
chapt
er,TCPmaybeabl
etosendonl
ypar
toft
hisshadedsect
ion.Thi
scoul
dbe
duet
othesl
ownessoft
her
ecei
vingpr
ocessort
ocongest
ioni
nthenet
wor
k.Al
so
not
ethat
,af
tert
hebyt
esi
nthecol
oredchamber
sar
eacknowl
edged,
thechamber
s
n
ar
erecycl
edandavai
labl
eforusebyt
hesendi
ngpr
ocess.
di
vi
Theoper
dedi
ntot
ati
onoft
woar
eas(
hebuf
feratt
shownaswhi
t
e.i
her
ecei
veri
eandcol
or
ssi
mpl
ed)
er.Theci
.Thewhi
t
r
ear
cul
arbuf
eacont
ai
feri
ns
s
fre
empt
ychamber
stobef
il
ledbybyt
esr
ecei
vedf
rom t
henet
wor
k.Thecol
ored
sect
ionscont
ainr
ecei
vedbyt
est
hatcanber
eadbyt
her
ecei
vingpr
ocess.Whena
s4
byt
eisr
eadbyt
her
ecei
vingpr
ocess,
thechamberi
srecycl
edandaddedt
othepool
ofempt
ychamber
s.
te
no
Fi
gur
e22:Sendi
ngandr
ecei
vingbuf
fer
s
Segment
s
Al
thoughbuf
fer
inghandl
est
hedi
spar
it
ybet
weent
hespeedoft
hepr
oduci
ngand
consumi
ngpr
ocesses,weneedonemor
est
epbef
orewecansenddat
a.The
net
wor
klayer
,asaser
vicepr
ovi
derf
orTCP,
needst
osenddat
ainpacket
s,notasa
st
ream ofbyt
es.Att
het
ranspor
tlayer
,TCPgr
oupsanumberofbyt
est
oget
heri
nto
apacketcal
l
edasegment
.
TCPaddsaheadert
oeachsegment(
forcont
rolpur
poses)anddel
iver
sthe
Dept
.ofECE,
RNSI
TPage26
CCNModul
e5:Tr
anspor
tlayer
segmentt
othenet
wor
klayerf
ort
ransmi
ssi
on.Thesegment
sar
eencapsul
atedi
n
an I
P dat
agr
am and t
ransmi
tt
ed.Thi
s ent
ir
e oper
ati
on i
str
anspar
entt
othe
r
ecei
vingpr
ocess.Segment
smayber
ecei
vedoutofor
der
,lostorcor
rupt
ed,and
r
esent
.Al
loft
hesear
ehandl
edbyt
heTCPr
ecei
verwi
tht
her
ecei
vingappl
icat
ion
pr
ocessunawar
eofTCP’
sact
ivi
ti
es.Fi
gur
e23showshow segment
sar
ecr
eat
ed
f
rom t
hebyt
esi
nthebuf
fer
s.
Segment
sar
enotnecessar
il
yal
lthesamesi
ze.I
nthef
igur
e,f
orsi
mpl
ici
ty,
it
i
sshownonesegmentcar
ryi
ng3byt
esandt
heot
hercar
ryi
ng5byt
es.I
nreal
it
y,
segment
scar
ryhundr
eds,
ifnott
housands,
ofbyt
es.
n
e.i
fre
s4
Fi
gur
e23:TCPsegment
s
te
Ful
l-
Dupl
exCommuni
cat
ion
TCPof
fer
sful
l-
dupl
exser
vice,wher
edat
acanf
low i
nbot
hdi
rect
ionsatt
hesame
no
t
ime.Each TCP endpoi
ntt
hen hasi
tsown sendi
ng and r
ecei
ving buf
fer
,and
segment
smovei
nbot
hdi
rect
ions.
Mul
ti
plexi
ngandDemul
ti
plexi
ng
Li
keUDP,TCP per
for
msmul
ti
plexi
ng att
hesenderand demul
ti
plexi
ng att
he
r
ecei
ver
.However
,si
nceTCPi
saconnect
ion-
ori
ent
edpr
otocol
,aconnect
ionneeds
t
obeest
abl
ishedf
oreachpai
rofpr
ocesses.
Connect
ion-
Ori
ent
edSer
vice
TCP,
unl
ikeUDP,
isaconnect
ion-
ori
ent
edpr
otocol
.Whenapr
ocessatsi
teAwant
s
t
osendt
oandr
ecei
vedat
afr
om anot
herpr
ocessatsi
teB,t
hef
oll
owi
ngt
hree
phasesoccur
:
1.Thet
woTCP’
sest
abl
ishal
ogi
calconnect
ionbet
weent
hem.
2.Dat
aar
eexchangedi
nbot
hdi
rect
ions.
3.Theconnect
ioni
ster
minat
ed.
Dept
.ofECE,
RNSI
TPage27
CCNModul
e5:Tr
anspor
tlayer
Thi
sisa l
ogi
calconnect
ion,nota physi
calconnect
ion.TheTCP segmenti
s
encapsul
atedi
nanI
Pdat
agr
am andcanbesentoutofor
der
,orl
ostorcor
rupt
ed,
andt
henr
esent
.Eachmayber
out
edoveradi
ff
erentpat
htor
eacht
hedest
inat
ion.
Ther
eisnophysi
calconnect
ion.TCP cr
eat
esast
ream-
ori
ent
edenvi
ronmenti
n
whi
chi
taccept
sther
esponsi
bil
it
yofdel
iver
ingt
hebyt
esi
nor
dert
otheot
hersi
te.
Rel
iabl
eSer
vice
TCP i
sar
eli
abl
etr
anspor
tpr
otocol
.Itusesanacknowl
edgmentmechani
sm t
o
checkt
hesaf
eandsoundar
ri
valofdat
a.
TCPFeat
ures
n
Number
ingSyst
em
Al
r
though t
ecei
ved,t
heTCP sof
her
eisnof
i
t
el
war
df
ekeepst
r
e.i
ackoft
hesegment
orasegmentnumberval
uei
sbei
nt
ng t
ransmi
tt
ed or
hesegmentheader
.
fre
I
nst
ead,
ther
ear
etwof
iel
ds,
cal
ledt
hesequencenumberandt
heacknowl
edgment
number
.Theset
wof
iel
dsr
efert
oabyt
enumberandnotasegmentnumber
.
s4
Byt
eNumber
TCP number
s al
ldat
a byt
es (
oct
ets)t
hatar
etr
ansmi
tt
ed i
n a connect
ion.
te
Number
ingi
sindependenti
neachdi
rect
ion.WhenTCPr
ecei
vesbyt
esofdat
afr
om
a pr
ocess,TCP st
ores t
hem i
nthe sendi
ng buf
ferand number
sthem.The
no
number
ingdoesnotnecessar
il
yst
artf
rom 0.I
nst
ead,TCPchoosesanar
bit
rar
y
ween0and232 -1f
numberbet ort
henumberoft
hef
ir
stbyt
e.Forexampl
e,i
fthe
numberhappenst
obe1057andt
het
otaldat
atobesenti
s6000byt
es,t
hebyt
es
ar
enumber
edf
rom 1057t
o7056.Wewi
llseet
hatbyt
enumber
ingi
susedf
orf
low
ander
rorcont
rol
.
SequenceNumber
Af
tert
hebyt
eshavebeennumber
ed,TCPassi
gnsasequencenumbert
oeach
segmentt
hati
sbei
ngsent
.Thesequencenumber
,ineachdi
rect
ion,i
sdef
inedas
f
oll
ows:
1.Thesequencenumberoft
hef
ir
stsegmenti
stheI
SN(
ini
ti
alsequencenumber
),
whi
chi
sar
andom number
.
2.Thesequencenumberofanyot
hersegmenti
sthesequencenumberoft
he
pr
evi
oussegmentpl
ust
henumberofbyt
es(
realori
magi
nar
y)car
ri
edbyt
he
Dept
.ofECE,
RNSI
TPage28
CCNModul
e5:Tr
anspor
tlayer
pr
evi
oussegment
.
Acknowl
edgmentNumber
Communi
cat
ioni
nTCPi
sful
ldupl
ex;whenaconnect
ioni
sest
abl
ished,
bot
hpar
ti
es
cansendandr
ecei
vedat
aatt
hesamet
ime.Eachpar
tynumber
sthebyt
es,
usual
ly
wi
thadi
ff
erentst
art
ingbyt
enumber
.Thesequencenumberi
neachdi
rect
ion
showst
henumberoft
hef
ir
stbyt
ecar
ri
edbyt
hesegment
.Eachpar
tyal
sousesan
acknowl
edgmentnumbert
o conf
ir
m t
he byt
es i
thas r
ecei
ved.However
,the
acknowl
edgmentnumberdef
inest
henumberoft
henextbyt
ethatt
he par
ty
expect
stor
ecei
ve.I
naddi
ti
on,t
heacknowl
edgmentnumberi
scumul
ati
ve,whi
ch
meanst
hatt
hepar
tyt
akest
henumberoft
hel
astbyt
ethati
thasr
ecei
ved,
saf
eand
sound,adds1t
oit
,andannouncest
hissum ast
heacknowl
edgmentnumber
.The
t
erm cumul
ati
veher
emeanst
hati
fapar
tyuses5643asanacknowl
edgment
n
number
,ithasr
ecei
vedal
lbyt
esf
rom t
hebegi
nni
ngupt
o5642.Not
ethatt
hisdoes
notmeant
hatt
hepar
doesnothavet
tyhasr
obe0.
ecei
e.i
ved5642byt
es,becauset
hef
ir
stbyt
enumber
fre
6.Wi
thaneatdi
agr
am expl
ainTCPsegmentf
ormat
s4
Segment
Apacketi
nTCPi
scal
ledasegment
.
te
For
mat
Thef
ormatofasegmenti
sshowni
nFi
gur
e23.
1.Thesegmentconsi
stsofa
no
headerof20t
o60byt
es,f
oll
owedbydat
afr
om t
heappl
icat
ionpr
ogr
am.The
headeri
s20byt
esi
fther
ear
enoopt
ionsandupt
o60byt
esi
fitcont
ainsopt
ions.
Dept
.ofECE,
RNSI
TPage29
CCNModul
e5:Tr
anspor
tlayer
Fi
gur
e23.
1:TCPsegmentf
ormat
n
Sour
cepor
taddr
ess.Thi
sisa16-
bitf
iel
dthatdef
inest
hepor
tnumberoft
he
appl
i
Dest
i
cat
i
nat
i
onpr
ogr
onpor
am i
nt
taddr
hehostt
ess.Thi
si
e.i
hati
ssendi
sa16-
bitf
i
ngt
el
hesegment
dthatdef
i
.
nest
hepor
tnumberoft
he
fre
appl
icat
ionpr
ogr
am i
nthehostt
hati
srecei
vingt
hesegment
.
Sequencenumber
.Thi
s32-
bitf
iel
ddef
inest
henumberassi
gnedt
othef
ir
stbyt
e
s4
ofdat
acont
ainedi
nthi
ssegment
.Aswesai
dbef
ore,TCPi
sast
ream t
ranspor
t
pr
otocol
.Toensur
econnect
ivi
ty,eachbyt
etobet
ransmi
tt
edi
snumber
ed.The
te
sequencenumbert
ell
sthedest
inat
ionwhi
chbyt
eint
hissequencei
sthef
ir
st
byt
eint
hesegment
.Dur
ingconnect
ionest
abl
ishment
,eachpar
tyusesar
andom
no
numbergener
atort
ocr
eat
eani
nit
ialsequencenumber(
ISN)
,whi
chi
susual
ly
di
ff
erenti
neachdi
rect
ion.
Acknowl
edgmentnumber
.Thi
s32-
bitf
iel
ddef
inest
hebyt
enumbert
hatt
he
r
ecei
veroft
hesegmenti
sexpect
ingt
orecei
vef
rom t
heot
herpar
ty.I
fthe
r
ecei
veroft
hesegmenthassuccessf
ull
yrecei
vedbyt
enumberxf
rom t
heot
her
par
ty,
itr
etur
nsx+1ast
heacknowl
edgmentnumber
.Acknowl
edgmentanddat
a
canbepi
ggybackedt
oget
her
.
Headerl
engt
h.Thi
s4-
bitf
iel
dindi
cat
est
henumberof4-
byt
ewor
dsi
ntheTCP
header
.Thel
engt
hoft
heheadercanbebet
ween20and60byt
es.Ther
efor
e,t
he
val
ueoft
hisf
iel
disal
waysbet
ween5(
5×4=20)and15(
15×4=60)
.
Cont
rol
.Thi
sfi
elddef
ines6di
ff
erentcont
rolbi
tsorf
lags,asshowni
nFi
gur
e
24.
8.Oneormor
eoft
hesebi
tscanbesetatat
ime.Thesebi
tsenabl
efl
ow
Dept
.ofECE,
RNSI
TPage30
CCNModul
e5:Tr
anspor
tlayer
cont
rol
,connect
ionest
abl
ishmentandt
ermi
nat
ion,connect
ionabor
ti
on,andt
he
modeofdat
atr
ansf
eri
nTCP.Abr
iefdescr
ipt
ionofeachbi
tisshowni
nthe
f
igur
e.24
Wi
ndow si
ze.Thi
sfi
elddef
inest
hewi
ndow si
zeoft
hesendi
ngTCPi
nbyt
es.
Not
ethatt
hel
engt
hoft
hisf
iel
dis16bi
ts,whi
chmeanst
hatt
hemaxi
mum si
ze
n
oft
hewi
ndowi
s65,
535byt
es.Thi
sval
uei
snor
mal
lyr
efer
redt
oast
her
ecei
ving
wi
ndow (
di
ctat
i
rwnd)andi
onoft
her
sdet
ecei
er
veri
nt
mi
nedbyt
hi
scase.
e.i
her
ecei
ver
.Thesendermustobeyt
he
fre
Checksum.Thi
s16-
bitf
iel
d cont
ainst
hechecksum.Thecal
cul
ati
on oft
he
checksum f
orTCPf
oll
owst
hesamepr
ocedur
east
heonedescr
ibedf
orUDP.
However
,theuseoft
hechecksum i
ntheUDPdat
agr
am i
sopt
ional
,wher
east
he
s4
useoft
hechecksum f
orTCPi
smandat
ory.
te
Ur
gentpoi
nter
.Thi
s16-
bitf
iel
d,whi
chi
sval
idonl
yift
heur
gentf
lagi
sset
,is
usedwhent
hesegmentcont
ainsur
gentdat
a.I
tdef
inesaval
uet
hatmustbe
no
addedt
othesequencenumbert
oobt
aint
henumberoft
hel
astur
gentbyt
eint
he
dat
asect
ionoft
hesegment
.
Opt
ions.Ther
ecanbeupt
o40byt
esofopt
ionali
nfor
mat
ioni
ntheTCPheader
.
Encapsul
ati
on
ATCPsegmentencapsul
atest
hedat
arecei
vedf
rom t
heappl
icat
ionl
ayer
.TheTCP
segmenti
sencapsul
atedi
nanI
Pdat
agr
am,whi
chi
ntur
nisencapsul
atedi
na
f
rameatt
hedat
a-l
inkl
ayer
.
Dept
.ofECE,
RNSI
TPage31