0% found this document useful (0 votes)
14 views740 pages

CN Complete

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

CN Complete

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

COMPUTER NETWORKS

Lecture I
Overview of Data Communications
and Networking
• Data Communication
• Networks & Internet
• Protocols & Standards
• Layered Tasks
• Internet Model
• OSI Model
Data Communication
 Sharing of information is “Data Communication”
 Sharing can be local (face to face)

 Remote (over a distance)

 “Data” refers to facts, concepts and / or instructions


 In the context of computers, data represented in the form

of 0’s and 1’s


 ―Data Communication‖ is ―Exchange of data between
two/more devices via a transmission medium.
Characteristics of Data Communication

 Delivery: system must deliver data to correct


destination
 Accuracy: Accurate data should be delivered
 Timeliness: Data delivered late are useless
Components of Data Communication

 Message: It is the Information (data) to be


communicated (shared) with others
 Sender: The device that sends the message
 Receiver: The device that receives the message
 Medium: Physical path by which a message travels
from sender to receiver
 Protocol: A set of rules that governs the data
communication
Data Flow
 Communication between two devices can be:
 Simplex
 Half-Duplex
 Full-Duplex
Data Flow

Simplex (one way street)


 The communication is unidirectional
 Only one device on a link can transmit; the other can
only receive
 Use the entire capacity of the channel to send data
 Example: Keyboards, Monitors

Data
Data Flow

Half-Duplex (one-lane with two-directional traffic)


 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
 The entire capacity of a channel is taken over by the
transmitting device
 Example: Walkie-talkies
Data

Data
Data Flow

Full-Duplex (Duplex) (two-way street)


 Both stations can transmit and receive at same time
 Signals going in either direction sharing the capacity of the
link
 Sharing can occur in two ways:
 Link has two physically separate transmission paths
• One for sending and the other for receiving

 The capacity of the channel is divided between signals travelling in


both directions
 Example: Telephone network
Data

Data
Network Criteria
 Reliability depends on
 Frequency of failure: all networks fail occasionally
 Recovery time: how long does it takes to restore

the service
 Catastrophe: networks should be protected from

fire, earthquake, theft, etc.


 Security depends on
 Unauthorized access should be prevented
 Should be protected from viruses, spywares,

adwares, malwares etc.


Physical Structure
 It refers to the way two or more devices are
attached to a link
 Point-to-Point: provides a dedicated link
between two devices. i.e. entire capacity
of the link is reserved for transmission
between those two devices
 Multi-point: In this configuration more
than two devices share the same link
 If several devices can use the link

simultaneously then called „spatially


shared connection‟

 If devices take turns then it is a time-shared connection


(temporally)
Topology
 Topology of a network is the geometric
representation of the links and nodes of a
physical network.

ETC.
Mesh Topology
 Every device has a dedicated point-to-point
link to every other device
 A fully connected mesh network has n(n-
1)/2 links ( nC2 )
 Every device required to have at least n-1
I/O ports
 Eliminates traffic problem as links are not
shared
 It is robust as breaking one link couldn't defunct the network
completely
 Privacy/security is maintained

 Installation and reconfiguration is difficult due to complicated


connections
 Expensive in terms of cost and space

 Very Difficult to add/remove a device


Star Topology
 Each computer has a point-point
link only to a central controller
called the HUB
 HUB acts as an exchange to send
data from one device to another
 Less expensive than mesh
 It is robust as one link failure causes that device to go out of
the network and it does not affect others
 Easy fault finding

 when one device sending data to another device, all other


devices have to be idle
 however, a switch in place of hub can eliminate this problem
Bus Topology
 Multi-point
 One long cable acts as a
backbone to link all the
devices
 There is a limit on the no of
drop lines (tapes) as in each
tape some energy is lost
 Installation is easy

 It uses less cabling than star or mesh

 difficult reconnection and fault finding

 Adding new device may require modification/replacement of the


backbone otherwise the performance will be degraded
 Fault in bus stops all transmission, the damaged area reflects
signal back in the direction of origin, creating noise in both
directions
Ring Topology
 Point-to-point
 Each device is linked only
to its immediate
neighbours
 To add or remove a
device requires moving
two connections only
 Each device in the ring incorporates a repeater to regenerate a
signal before passing to neighbour.
 Easy to install and reconfiguration

 Maximum ring length and no of devices are fixed

 failure of one device causes network failure if not bypassed

 unidirectional data traffic


Protocol !!!
 What is a Protocol?
 What does a protocol do?
 How would you recognize a protocol if you
met one?
A Human Analogy
 What you do when you want to ask some one
for the time of day?
Protocol
 First you offer a
greeting (Hi )
 The typical response to
a Hi is a returned Hi
 This response is an
indication that you can
proceed and ask for the
time
 And the conversation
continues . . .
A Network Protocol
 Visiting a Web site
 Type in the URL in Web
browser
 First your computer will
send a connection request
message to the Web Server
 Web Server will respond by
returning a connection reply
message
 Your computer then sends
the name of the web page
 Finally the server returns
the page to you.
Defining A Protocol

A Protocol defines the format and the order


of messages exchanged between two or
more communicating entities, as well as the
actions taken on the transmission and/or
receipt of a message of other event.
. . . J. F. Kurose
Standards Organizations
 Standards Creation Committees
 International Standards Organization (ISO)
 International Telecommunications Union-Telecommunication standards (ITU-T)
 American National Standards Institute (ANSI)
 Institute of Electrical and Electronics Engineers (IEEE)
 Electronic Industries Association (EIA)
 Forums
 The forums work with universities and users to test, evaluate and the conclusion is
presented to standard bodies to standardize new technologies
 Regulatory Agencies
 Govt. agencies responsible for protecting the public interest.
 Internet Standards
 Internet draft is a working document with no official status and a 6 month life
time.
 If recommended by IETF then a draft may be published as a Request for
Comment (RFC)
Layered Tasks
 The service that we expect from a Computer Network are much
more complex than just sending a signal from one device to
another.
 To solve a complex problem we apply the strategy “Divide and
Rule”. i.e. the main problem is divided into some small tasks/
levels of reduced complexity and then handled individually.
 In other words Each level is responsible to solve a more focused
problem of the original problem is a called layer in network
terminology.
 Each layer observes a different level of abstraction and performs
some well defined functions.
 Each layer uses the service of the layer below below it and each
layer provides service to its upper layer.
 There exists an interface between each pair of adjacent layers
that defines the information and services a layer must provide to
the adjacent layer.
The Internet model
 The layered protocol stack that is
used in practice is a five ordered
layer Internet model, also called
TCP/IP protocol suite
 The responsibility of each layer is
well defined and focused
 Each end user device engaged in communication must have
these layers in it (in form of HW or SW)
 An intermediate device may not have all the layers but at least
first two/three layers
 Layer x on one device communicates with layer x of other
device.
 The processes on each machine that communicate at a given
layer are called peer-to-peer processes.
Peer-to-peer processes
An exchange using the Internet model
Physical layer
 The responsibility of physical layer is to coordinate the functions
required to transmit a bit stream over a physical medium
 The duties are
 Defines the characteristics of the interface between devices and
transmission medium
 Type of transmission medium, topology, etc…
 Representation of bits
 Encoding, voltage level, duration etc…
 Data rate
 Synchronization of bits
 Sender‟s and receiver‟s clock shynchronization
Data link layer

 is responsible for transmitting frames from


one node to the next
 The duties are
 Framing

 Stream of bits received from upper layer is divided into manageable


data units(?) called frame
 Physical addressing
 Adds the address of sender and receiver in the header

 Flow control
 This mechanism helps to prevents overflow at receiving side

 Error control
 Mechanism to detect/correct errors in transmission

 Access Control
 Which device has the control over the link at a given time
Datalink layer contd.
 Physical addressing and hop-hop delivery can
be done in one network only

 If the message is to be passed across the


network then network layer functionality is
required.
Network Layer
 The network layer is responsible for the delivery of packets
from the original source to the final destination possibly
across multiple networks.
 The Duties are
 Logical addressing
 It adds logical addresses into the packet header
 Routing
 Forwarding the packet towards the destination
Transport layer
 The transport layer is responsible for delivery of a message
from one process to another.
 The Duties
 Port addressing
 Actual transmission occurs from a specific process on one device to a
process of another.
 Port address (an integer) defines the process/application in a device
 Segmentation and reassembly
 Message received from application layer is divided in to transmittable
segments containing sequence nos
Transport layer contd.
 Connection control
 Two types of connection service is allowed
 Connection oriented: establish the connection, use the connection, release
the connection. (guarantee of delivery)
 Example: telephone
 Connection less: each message carries the destination address and routed
through the system
 Example: postal service
 Flow Control
 Responsible for end-to-end flow control as well as
intermediate flow control (congestion)
 Error Control
 End-to-end error control
Application layer

 The application layer is responsible for providing


services to the user.
 It provides user interfaces and support services
such as email, remote file transfer, remote logins
etc…
Summary of duties
OSI model
 Session Layer is the network dialog controller, It
establishes maintains and synchronizes the interaction
between communicating systems
 Duties are
 Dialog control
 Synchronization at data level
 Presentation layer is concerned with syntax and
semantics of the information exchanged between two
systems
 Duties are
 Translation: converting to bit streams
 Encryption: to ensure privacy
 Compression: increases virtual BW
Lecture II
The Physical Layer

• Signals
• Digital Transmission
• Analog Transmission
• Multiplexing
• Transmission Media
Position of the physical layer
Signals
 Information is transmitted in the form of
electromagnetic signals
 Signals are of two types
 Analog Signal is a continuous signal in which the signal
intensity varies smoothly over time
 Digital Signal is a discrete signal in which the signal intensity
maintains a constant level for some period and then changes
to another constant level.
 Analog Data: human voice, Digital data: data stored in a
computer
Periodic / Aperiodic Signals

Periodic Signal: A signal completes a pattern within a measurable


time frame (period)
The completion of one full pattern is called a cycle. The
period is constant for any given periodic signal
Aperiodic Signal: Changes without exhibiting a pattern
In data communication, we commonly use periodic and analog
signals and aperiodic digital signals

Aperiodic Signal
Periodic Signal
Analog Signals
 The sine wave is the most fundamental form of
a periodic signal
 Represented as s(t)=Asin(2ft+)
 Characteristics
 Amplitude: intensity of signal at any given time
 Frequency: no of cycles/periods in one second,
measured in Hz
 Frequency = 1/Period
 Phase: describes the position of the waveform
relative to time zero
 A complete cycle is 360o = 2
Amplitude Period and frequency
Time and frequency domains

A signal can also be represented in frequency domain


Composite signals
 A single-frequency sine wave is not useful in
data communications; we need to change one
or more of its characteristics to make it useful.
 When we change one or more characteristics
of a single-frequency signal, it becomes a
composite signal made of many frequencies.
 A composite signal is composed of multiple
sine waves called harmonics
Three harmonics
Digital Signals
 Digital signals can be better described by two terms
 Bit interval: time required to send a single bit
 Bit rate: number of bit intervals in one second
 A digital signal is a composite signal having an infinite
number of frequencies i.e. infinite bandwidth
 The digital BW is bits per sec (bps)
Analog vs Digital
• Channels or links are of two types
• low-pass: lower limit is zero and
upper limit is any frequency ()
• band-pass: has a band width with
frequencies f1and f2

 A digital signal theoretically needs a BW between o and 


 if the upper limit will be relaxed than digital transmission can use a low-pass
channel

 An analog signal has a narrower BW with frequencies f1and f2


 Also BW of analog signal can be shifted, i.e. f1and f2 can be shifted to f3 and
f4
 Analog signal can use a band-pass channel
Channel capacity
The channel capacity is a very important consideration in data
communications that is how fast we can send data, in bits per
second, over a channel.
DATA RATE LIMITS
The maximum data rate limit over a medium is
decided by following factors:

1.Bandwidth of channel.
2.Signal levels
3.Channel quality (level of noise)

•Two theoretical formulas were developed to


calculate the data rate: one by Nyquist for a
noiseless channel, another by Shannon for a noisy
channel.
1.For noiseless channel-Nyquist bit rate
2.For noisy channel-Shannon capacity.
Data rate limits
 Data rate depends on
 The BW available

 The levels of signal that can be used

 The quality of channel (i.e. the level of noise)

 Nyquist Bit rate: noise less channel


 Bit rate= 2  BW  log L

 For a noise less channel the nyquist bit rate defines the
theoretical maximum bit rate
 BW: band width of channel, L: no of signal levels used to
represent data
 Shannon Capacity: noisy channel
 Capacity = BW  log(1+SNR)

 The signal-to-noise ratio is the statistical ratio of power of the


signal to the power of the noise
Decibel

The decibel (dB) measures the relative strength of two


signals or one signal at two different points
The decibel is positive if signal is strengthened & it is
negative when signal attenuates.

It is calculated as
db = 10 log10(P2/P1)
Variables P1& P2are the power of signal at two points.
Example
We have a channel with a 1 MHz bandwidth. The SNR for this
channel is 63; what is the appropriate bit rate and signal level?

Solution

First, we use the Shannon formula to find our upper limit.

C = B log2 (1 + SNR) = 106 log2 (1 + 63) = 106 log2 (64) = 6 Mbps


Then we use the Nyquist formula to find the
number of signal levels.
6 Mbps = 2  1 MHz  log2 L  L = 8
We need to send 265k bps over a noiseless channel with a bandwidth
of20kHz. How many signal levels do we need?
Solution:
We can use the Nyquist formula as shown:

Since this result is not a power of 2 we need to either


increase the number of levels or reduce the bit rate If we
have 128 levels, the bit rate is 280 kbps If we have 64 levels,
the bit rate is 240 kbps
Consider an extremely noisy channel in which the value of the
signal to noise ratio is almost zero In other words, the noise is
so strong that the signal is faint What is the Capacity C of the
channel?

This means that the capacity of this channel is zero


regardless of the bandwidth In other words, we cannot
receive any data through this channel
Calculate the theoretical highest bit rate of a regular telephone line A
telephone line normally has a bandwidth of 3000 Hz 300 to 3300 Hz)
assigned for data communications The signal to noise ratio is usually
3162.

Calculation of SNR in db

SNRdb= 10 log10SNR
or
•SNRdb= 10 log10S/N
Assume that SNRdB =36 and the channel bandwidth is 2 MHz
Calculate the theoretical channel capacity?

Assume that SNRdB =45 and the channel bandwidth is 10


MHz Calculate the theoretical channel capacity?
Calculate the maximum bit rate for a channel having bandwidth 3100Hz
and SNR ratio 20 Db.

We have to use formula (SNRdb= 10 log10SNR)


Given
Given BW =3100Hz & SNR ratio =20 Db
i.e. 20 Db =10log10[SNR], SNR = 100
Maximum bit rate for noisy channel is given by
C=BW x Log2(1+S/N)
= 3100 x Log2(1+100)
= 20,640 bits/sec
Transmission Impairment
 In practice the signal sent at sending end using
a transmission medium is not exactly same at
receiving end due to some impairments
 Attenuation: loss of energy

 Decibel: is the unit to measure the relative strength


of two signals
 dB = 10 log10 (P2/P1)
 It is negative if attenuated and +ve if amplified
Suppose a signal travels through a transmission medium and its
power is reduced to one half Calculate signal power in db

Ans:
Since power is reduced to half this means that P 2 =0. 5 P 1 Hence, the attenuation
(loss of power) can be calculated as

A loss of 3dB(−3dB) is equivalent to losing one-half the power.


The loss in a cable is usually defined in decibels per kilometer (dB/km) If
the signal at the beginning of a cable with -0. 3 dB/km has a power of 2
mW, what is the power of the signal at 5 km?

The loss in the cable in decibels is 5× -0.3 = -1.5 dB We can calculate


the power as
Distortion
 Signal changes its forms at the receiving end
 It is normally happens in case of composite
signals
 As each signal component has its own
propagation speed thus received out of phase
Noise
 Several types of noise such as
 thermal noise: random motion of electrons in a wire
 induced noise: sources such as motors and elecrical
appliances
 cross talk: effect of one wire over the other
 impulse noise: is a spike may corrupt the original
signal that comes from power lines and lightning
PERFORMANCE

One important issue in networking is the performance of the network—


how good is it?

 Bandwidth - capacity of the system


 Throughput - no. of bits that can be pushed through
 Latency (Delay) - delay incurred by a bit from start to finish
 Bandwidth-Delay Product
In networking, we use the term bandwidth in
two contexts.

 The first, bandwidth in hertz, refers to the range of frequencies in a


composite signal or the range of frequencies that a channel can pass.

 The second, bandwidth in bits per second, refers to the speed of bit
transmission in a channel or link. Often referred to as Capacity.
A network with bandwidth of 10 Mbps can pass only an average of
12,000 frames per minute with each frame carrying an average of 10,000
bits. What is the throughput of this network?

Solution
We can calculate the throughput as

The throughput is almost one-fifth of the bandwidth in this case.


Propagation & Transmission delay

 Propagation speed - speed at which a bit


travels though the medium from source to
destination.
 Transmission speed - the speed at which all
the bits in a message arrive at the
destination. (difference in arrival time of
first and last bit)
Propagation and Transmission Delay

 Propagation Delay = Distance/Propagation speed

 Transmission Delay = Message size/bandwidth bps

 Latency = Propagation delay + Transmission delay +


Queueing time + Processing time
Example

What is the propagation time if the distance between the two points is
12,000 km? Assume the propagation speed to be 2.4 × 108 m/s in
cable.

Solution
We can calculate the propagation time as
Example

What are the propagation time and the transmission time for a 2.5-kbyte
message (an e-mail) if the bandwidth of the network is 1 Gbps? Assume
that the distance between the sender and the receiver is 12,000 km and
that light travels at 2.4 × 108 m/s.

3.90
Example
Example

What are the propagation time and the transmission time


for a 5-Mbyte message (an image) if the bandwidth of the
network is 1 Mbps? Assume that the distance between the
sender and the receiver is 12,000 km and that light travels
at 2.4 × 108 m/s.

Solution

3.92
Example (continued)

Note that in this case, because the message is very long and the bandwidth is not very high,
the dominant factor is the transmission time, not the propagation time. The propagation time
can be ignored.

3.93
Bandwidth Delay Product

In data communications, the bandwidth-delay product is the product of a data link's capacity
(in bits per second) and its round-trip delay time (in seconds). The result, an amount of data
measured in bits (or bytes), is equivalent to the maximum amount of data on the network circuit
at any given time.

3.94
Digital Transmission

Line coding
Block Coding
Sampling
Transmission Mode
What is Line Coding?
 Is the process of converting binary data (a
sequence of bits) to a digital signal
Signal Level versus Data Level
 No of values allowed in a signal
 No of values used to represent data
DC Component
 A component having zero frequency
 Can‟t be passed through a transformer
 Energy consumed is useless
Pulse Rate versus Bit Rate
 No of pulses per second
 Minimum amount of time required to transmit a symbol
 No of Bits per second
 If a pulse carries one bit then pulse rate and bit rate are
same
Example
A signal has two data levels with a pulse duration of 1 ms. We
calculate the pulse rate and bit rate as follows:
Pulse Rate = 1/ 10-3= 1000 pulses/s
Bit Rate = Pulse Rate x log2 L = 1000 x log2 2 = 1000 bps
Self Synchronization
 No Synchronization: if receivers clock is faster

 A Signal that includes timing information along


with data is called a self-synchronizing signal
 i.e. transitions in the signal alerts the receiver to
reset the clock
Example

In a digital transmission, the receiver clock is 0.1


percent faster than the sender clock. How many extra
bits per second does the receiver receive if the data
rate is 1 Kbps? How many if the data rate is 1 Mbps?

Solution
At 1 Kbps:
1000 bits sent 1001 bits received1 extra bps
At 1 Mbps:
1,000,000 bits sent 1,001,000 bits received1000 extra bps
Line Coding Schemes
UniPolar Encoding

Note:

Unipolar encoding uses only one voltage


level.
Unipolar Encoding
 One is coded as +ve voltage
 Zero is coded as 0ve voltage
Polar Encoding

Note:

Polar encoding uses two voltage levels


(positive and negative).
Polar Encoding
 Avarage voltage level is decreased
 DC component problem is avoided
 Four Important type of polar encoding are:

There are many others also!


NRZ-L Encoding

Note:

In NRZ-L the level of the signal is


dependent upon the state of the bit.
NRZ-I Encoding

Note:

In NRZ-I the signal is inverted if a 1 is


encountered.
NRZ Encoding

 Loss of synchronization incase of continuous


ones or zeros
RZ Encoding

Note:

RZ uses three values i.e. +ve, zero & -ve


Signal change occurs during each bit
RZ Encoding

 A +ve voltage means 1 and –ve voltage means


zero.
 But signal returns to zero at mid of the bit
interval
RZ Encoding
Note:

RZ is a good encoded digital signal that contain


a provision for synchronization.
But it requires two signal changes to encode 1
bit  more bandwidth!
Manchester Encoding

Note:

In Manchester encoding, the transition at


the middle of the bit is used for both
synchronization and bit representation.
Manchester Encoding

 It achieves the synchronization but with two levels of


amplitude
 Datarate(R) = 1/tb , tb: bit duration in seconds
 Modulation rate (D) = R/b, b: no of bits per signal
element
Diff-Manchester Encoding

Note:

In differential Manchester encoding, the


transition at the middle of the bit is used
only for synchronization.
The bit representation is defined by the
inversion or noninversion at the
beginning of the bit.
Diff-Manchester Encoding

 Manchester Encoding used for 802.3 base band


– CSMA/CD Lans
 Diff-Manchester is used foe 802.5 token ring
LAn
Bipolar Encoding

Note:

In bipolar encoding, we use three levels:


positive, zero,
and negative.
Bipolar Encoding
2B1Q Encoding
 Two Binary One Quaternary
 Each pulse represents 2 bits

-1
-3
MLT-3 Encoding
 Multi transmission, three level (MLT-3)
 The signal transition from one level to the next
at the beginning of a 1 bit
Block Coding
 To ensure synchronization some
redundant bits may be introduced

Steps in Transformation
 Division
 Substitution
 Line Coding
Block Coding
Substitution
4B/5B Encoding
 Each 4-bit 'nibble' of received data has an extra
5th bit added.
 If input data is dealt with in 4-bit nibbles there
are 24 = 16 different bit patterns. With 5-bit
'packets' there are 25 = 32 different bit
patterns.
 As a result, the 5-bit patterns can always have
two '1's in them even if the data is all '0's a
translation.
 This enables clock synchronizations required
for reliable data transfer.
4B/5B encoding
Data Code Data Code

0000 11110 1000 10010

0001 01001 1001 10011

0010 10100 1010 10110


0011 10101 1011 10111
0100 01010 1100 11010
0101 01011 1101 11011
0110 01110 1110 11100
0111 01111 1111 11101
Example 8B/6T
 sends 8 data bits as six ternary (one of three voltage
levels i.e. +, 0, -) signals.
 Each bit block of 8-bit group with a six symbol code
 i.e. 8 bit  28 & six symbol 36 possibilities
 i.e. the carrier just needs to be running at 3/4 of the
speed of the data rate.
 Helps to maintain synchronization and error checking
Pulse Amplitude Modulation
 Generates a series of pulses by sampling a
given analog signal
 Sampling is measuring amplitude in equal intervals
PAM

Note:

Pulse amplitude modulation has some


applications, but it is not used by itself in
data communication. However, it is the
first step in another very popular
conversion method called
pulse code modulation.
PCM: Quantization
 It is a method of assigning integral values in a
specific range to sampled instances
Binary encoding
 Each quantized value is translated into a 7bit
binary equivalent.
 The eighth bit indicates the sign
Line coding
 The binary digits are transformed to a digital
signal by using one of the line coding
techniques.
Analog to PCM Digital Code
Sampling rate
 Accuracy of reproduction depend on the no of
samples taken
 What should be the sampling rate?

Note:

According to the Nyquist theorem, the


sampling rate must be at least 2 times the
highest frequency.
Nyquist Theorem
Example

What sampling rate is needed for a signal with a bandwidth of


10,000 Hz (1000 to 11,000 Hz)?
Solution
The sampling rate must be twice the highest frequency in the
signal:

Sampling rate = 2 x (11,000) = 22,000 samples/s


Example

A signal is sampled. Each sample requires at least 12 levels of


precision (+0 to +5 and -0 to -5). How many bits should be
sent for each sample?
Solution
We need 4 bits; 1 bit for the sign and 3 bits for the value.

A 3-bit value can represent 23 = 8 levels (000 to 111), which is


more than what we need.
A 2-bit value is not enough since 22 = 4.
A 4-bit value is too much because 24 = 16.
Example

We want to digitize the human voice. What is the bit rate,


assuming 8 bits per sample?

Solution
The human voice normally contains frequencies from 0 to
4000 Hz.
Sampling rate = 4000 x 2 = 8000 samples/s

Bit rate = sampling rate x number of bits per sample


= 8000 x 8 = 64,000 bps = 64 Kbps
Transmission mode
Parallel Transmission
 Information is organized into group of bits
 All bits of one group are transmitted with each clock tick
from one device to other

 More speed
 Cost is high restricted to short distance
Serial Transmission
 One bit follows another using same line

 Reduced cost (by a factor n)


 Parallel/serial converter required
 May used for large distance
Asynchronous Transmission
 Serial transmission occurs in one of the two
ways
Note:

In asynchronous transmission, we send 1


start bit (0) at the beginning and 1 or
more stop bits (1s) at the end of each byte.
There may be a gap between each byte.
Asynchronous Transmission
 Insertion of extra bits & a gap makes it slower
 But cheap and effective

 Suitable for low speed communication like KB to


computer. i.e. typing is done one character at a time
and unpredictable gap between characters.
Asynchronous Transmission
 When receiver detects a start bit, it starts a timer and
begins counting
 After receiving a stop bit it ignores all pulses till next
start bit arrives and resets the timer
Note:

Asynchronous here means “asynchronous


at the byte level,” but the bits are still
synchronized; their durations are the
same.
Synchronous Transmission

Note:

In synchronous transmission,
we send bits one after another without
start/stop bits or gaps.
It is the responsibility of the receiver to
group the bits.
Synchronous Transmission
 More speed
 Synchronization is necessary

 Accuracy is completely dependent on the


ability of the receiving device to keep an
accurate count of the bits as they come in
 Byte synchronization is done in datalink layer
Analog Transmission
Modulation of Digital Data

Digital-to-Analog Conversion
Amplitude Shift Keying (ASK)
Frequency Shift Keying (FSK)
Phase Shift Keying (PSK)
Quadrature Amplitude Modulation
Bit/Baud Comparison
Digital to analog modulation

It is Needed if the transmission line is analog but the data


produced is binary.
Example: sending data from a computer via a public access
telephone line
Bit rate / Baud rate
Note:

Bit rate is the number of bits per second. Baud


rate is the number of signal units per second.
Baud rate is less than or equal to the bit rate.
The sending device produces a signal that acts as a basis
of information signal called carrier signal or carrier
frequency
The digital information is then modulates the carrier signal
by modifying one or more of its characteristics.
Example

An analog signal carries 4 bits in each signal unit. If 1000


signal units are sent per second, find the baud rate and the bit
rate
Solution

Baud rate = 1000 bauds per second (baud/s)


Bit rate = 1000 x 4 = 4000 bps
Example

The bit rate of a signal is 3000. If each signal unit carries 6


bits, what is the baud rate?
Solution

Baud rate = 3000 / 6 = 500 baud/s


Amplitude Shift Keying
• The intensity of the signal is
varied to represent binary one
or zero
• ASK is highly susceptible to
noise interference, i.e a zero
may be changed to 1 or vice
versa
• If one of the bit values is represented by no
voltage then it is called on/off keying (OOK). It
results in reduction of energy transmitted.
• ASK modulated signal contains many simple
frequencies
• band width is given by BW=(1+d) Nbaud
• Where Nbaud is the baud rate and d is a factor
of modulation with minimum value=0
Example
Given a bandwidth of 10,000 Hz (1000 to 11,000 Hz), draw the full-
duplex ASK diagram of the system. Find the carriers and the bandwidths
in each direction. Assume there is no gap between the bands in the two
directions.
Solution

For full-duplex ASK, the bandwidth for each direction is


BW = 10000 / 2 = 5000 Hz
The carrier frequencies can be chosen at the middle of each band
fc (forward) = 1000 + 5000/2 = 3500 Hz
fc (backward) = 11000 – 5000/2 = 8500 Hz
Frequency Shift Keying
 Frequency of carrier signal
varies to represent a binary
1 or 0
 Effect of noise is less,
receiving device ignores
spikes but more Bandwidth
is required
 Although there are two
carrier frequencies, the
process of modulation
produces a composite signal
 Bandwidth = fc1 – fc0 + Nbaud
Example
Find the maximum bit rates for an FSK signal if the bandwidth
of the medium is 12,000 Hz and the difference between the
two carriers is 2000 Hz. Transmission is in full-duplex mode.

Solution
Because the transmission is full duplex, only 6000 Hz is
allocated for each direction.
BW = baud rate + fc1 - fc0
Baud rate = BW - (fc1 - fc0 ) = 6000 - 2000 = 4000
But because the baud rate is the same as the bit rate, the bit
rate is 4000 bps.
Phase Shift Keying
 Phase of carrier signal varies
to represent a binary 1
(180o)or 0 (0o) also called 2-
PSK or binary PSK
 Avoids problems of noise and
bandwidth
 Can be represented in a
constallation diagram or
phase-state diagram
 BW=same as of ASK
 More variations in phase may
be added to represent more
than one bit
Other variations of PSK
4-PSK / Q-PSK, 2 bits per baud

8-PSK, 3 bits per baud

i. The bit rate increases as


compared to baud rate
ii. But needs sophisticated
devices to distinguish small
difference in phase
Quadrature Amplitude Modulation

Note:

QAM is a combination of ASK and PSK


so that a maximum contrast between each
signal unit (bit, dibit, tribit, and so on) is
achieved.
4-QAM & 8-QAM Constellation
16-QAM constellations

QAM is less susceptible to noise than ASK?


Bandwidth required for QAM is same as PSK and ASK
Bit/Baud Comparison
Modem Standards
Modem stands for modulator/demodulator.

A telephone line has a bandwidth of almost 2400 Hz for data


transmission.
Modulation/Demodulation

 A modulator creates a band-pass


signal from binary data.
 A demodulator recovers the
binary data from the modulated
signal
V series modems
V.32 constellation & BW
• published by ITU-T
• it uses a technique called trellis coded modulation I.e. QAM plus
one redundant bit
• 32 QAM with a baud rate of 2400 and datarate is
2400*4=9600kbps (1 bit redundant)
V.32bis constellation & BW
 Uses 128-QAM (7 bits/ baud
with 1 bit for error control)
 datarate (2400*6)=14400 bps
V.90
 Asymetric modems, i.e. downloading speed is 56 kbps and
uploading speed is 33.6 kbps
 This is possible if one party is using digital signaling
V.92
 can adjust their speed I.e. if noise allows than it can upload at a
rate of 48 Kbps
 Additional features like modem can interrupt internet connection
for a incoming phone call etc.
Traditional modems
• Sampled, digitized and
at telephone comp

• The quantization noise


introduced thus data rate is
limited according to
shannon capacity i.e. 33.6k

56 K Modems
• signal not affected by
quantization noise and not
limited by shannon capacity
• sampling is done at a rate
of 8000 samples/sec with 8 bits
per sample.
• One bit is used for control thus
speed becomes 8000*7=56 kbps
Modulation of Analog Signals
• Representation of analog information by an analog signal
• i.e. shifting the center frequency of baseband signal up to
the radio carrier
• It is needed because
• To reduce Antenna length (length  1/f)
• helps in frequency division multiplexing
• To support medium characteristics

Methods:
Amplitude Modulation (AM)
Frequency Modulation (FM)
Phase Modulation (PM)
Amplitude modulation
• The carrier signal is modulated so that
its amplitude varies with the changing
amplitude of modulating signal
• Phase and frequency remains the same
• The modulating signal becomes an
envelope to the carrier
• The bandwidth of an AM signal is twice
the bandwidth of the modulating signal
• BWt = 2  BWm
• BWt is total bandwidth
• BWm is bandwidth of modulating signal
Frequency modulation
• The carrier signal is modulated so
that its frequency varies with the
changing amplitude of modulating
signal
• Phase and peak amplitde remains
the same
•The bandwidth of an AM signal is
ten times the bandwidth of the
modulating signal
• BWt = 10  BWm
• BWt is total bandwidth
• BWm is bandwidth of modulating
signal
Lecture III
The Physical Layer contd.

• Multiplexing
• Transmission Media
• Switching
Multiplexing
 It is not practical to have a separate line for each other device
we want to communicate
 Therefore, it is better to share communication medium
 The technique used to share a link by more than one device is
called multiplexing
 Multiplexing needs that the BW of the link should be greater
than the total individual BW of the devices connected.
 In a multiplexed system one link may contain more than one
channel
Categories of multiplexing
Frequency Division Multiplexing
 FDM is an analog
multiplexing technique
that combines signals
 Signals generated by
each device modulate
different carrier
frequencies
 These modulated
signals are combined to
form a composite
signal
 Demultiplexer uses a
series of filters to
decompose the signal
into its component
signals
FDM
f

t
• Carrier frequencies are separated by sufficient BW to
accommodate modulated signal
•These BW ranges are channels through which the various
signal travel
• Channels must be separated by strips of unused BWs
(called Guard Bands) to prevent signals from overlapping
• Carrier frequencies must not interfere with the original
signals
Example 1
Assume that a voice channel occupies a bandwidth of 4 KHz. We need to
combine three voice channels into a link with a bandwidth of 12 KHz,
from 20 to 32 KHz. Show the configuration using the frequency domain
without the use of guard bands.

Solution
Shift (modulate)
each of the three
voice channels to
a different
bandwidth, as
shown in Figure
Example

Five channels, each with a 100-KHz bandwidth, are to be multiplexed


together. What is the minimum bandwidth of the link if there is a need
for a guard band of 10 KHz between the channels to prevent
interference?
Solution

For five channels, we need at least four guard bands. This means that the
required bandwidth is at least

5 x 100 + 4 x 10
= 540 KHz
as shown in Figure
Time division Multiplexing
 Each shared connection occupies a portion of time but
uses full BW f

 The data flow of each connection is


divided into units
 For n input connections, a frame is t
organised into a minimum of n units
 Each slot
carrying one
unit from each
section
 Data rate of the
link has to be n
times the data
rate of one unit
Time division Multiplexing contd.
 If the data rate of a link is 3 times the data rate of a
connection
 then the duration of a unit on a connection will be 3
times that of a time slot
Example
Four 1-Kbps connections are multiplexed together. A unit is 1 bit. Find
(1) the duration of 1 bit before multiplexing, (2) the transmission rate of
the link, (3) the duration of a time slot, and (4) the duration of a frame?

Solution
1. The duration of 1 bit is 1/1 Kbps, or 0.001 s (1 ms).
2. The rate of the link is 4 times the rate of connection, i.e. 4
Kbps.
3. The duration of each time slot is 1/4 th of the bit duration
before multiplexing i.e. 1/4 ms or 250 ms.
or inverse of data rate i.e. 1/4 Kbps = 250 ms.
4. The duration of a frame is same as duration of each unit,
i.e. 1 ms.
or 4 times the bit duration i.e. 4 * 250 ms = 1ms
Example
Four channels are multiplexed using TDM. If each channel sends 100
bytes/s and we multiplex 1 byte per channel, show the frame traveling on
the link, the size of the frame, the duration of a frame, the frame rate, and
the bit rate for the link.
Solution
Example

A multiplexer combines four 100-Kbps channels using a time slot of 2


bits. Show the output with four arbitrary inputs. What is the frame rate?
What is the frame duration? What is the bit rate? What is the bit
duration?

Solution
Synchronization

• Synchronization between multiplexer and demultiplexer is


important otherwise a bit of one channel may be received by
other channel
• To avoid this one or more synchronization bits may be added
called Framing bits
Example Solution
We have four sources, each creating 250
characters per second. If the 1. The data rate of each source
interleaved unit is a character and 1 is 2508=2000 bps
synchronizing bit is added to each 2. The duration of a character
frame, find is 1/250 s, or 4 ms.
3. The link needs to send 250
(1) the data rate of each source, frames per second.
(2) the duration of each character in each 4. The duration of each frame
source, is 1/250 s, or 4 ms.
5. Each frame is 4 x 8 + 1 = 33
(3) the frame rate, bits.
(4) the duration of each frame, 6. The data rate of the link is
250 x 33, or 8250 bps.
(5) the number of bits in each frame, and
(6) the data rate of the link.
Bit Padding
 If one or more devices are faster than other
devices than faster devices are given more time
slots than others
 e.g. we can accommodate a device 5 times
faster than others by giving time slots as 5:1
 When speeds are not integer multiples of each
other then bit padding is used
 In bit padding the multiplexer adds extra bits to
device‟s source stream to force the speed
relationships as integer multiples
Example 9
Two channels, one with a bit rate of 100 Kbps and another
with a bit rate of 200 Kbps, are to be multiplexed. How this
can be achieved? What is the frame rate? What is the frame
duration? What is the bit rate of the link?
Solution
We can allocate one slot to the first channel and two slots to
the second channel. Each frame carries 3 bits. The frame rate
is 100,000 frames per second because it carries 1 bit from the
first channel. The frame duration is 1/100,000 s, or 10 ms.
The bit rate is 100,000 frames/s x 3 bits/frame, or 300 Kbps.
Multiplexing and inverse multiplexing

• Inverse multiplexing takes data from high speed line and breaks
it into portions that can be sent across several lower speed lines
• If an organisation wants to send data, audio and video, each
requires a different bandwidth
• using an agreement called Bandwidth on Demand
• The organisation can use any of the channel whenever and
however it needs them
Transmission Media
 Signals in the form of electromagnetic energy is
propagated through transmission media from
one device to another device
 A selected portion of electromagnetic spectrum
are currently usable for telecommunication like
Power, radio waves, infrared, visible light, ultra-
violate, and X, gamma and cosmic rays etc.
Classes of transmission media
Guided Media
 Provides a conduit from one device to another,
includes
 Twisted-Pair Cable
 Consists of two conductors, each with its own plastic
insulation, twisted together

 Due to twists, the noise interference and crosstalk affects


both wires equally thus cancels each other
 i.e. no of twists per unit length determines the quality of the
cable; more twists mean better quality
Unshielded vs Shielded Twisted-Pair Cable

 STP has a metal foil or braided-mesh covering that


encases each pair of insulated conductor
 Metal casing improves mechanical strength, prevents
penetration of noise or cross talk but is bulkier and more
expensive
 STP is produced by IBM and seldom used else where.
 EIA developed standards for UTP in 7 categories
Categories of Unshielded Twisted-Pair cables

Category Bandwidth Data Rate Digital/Analog Use

1 very low < 100 kbps Analog Telephone

2 < 2 MHz 2 Mbps Analog/digital T-1 lines

3 16 MHz 10 Mbps Digital LANs

4 20 MHz 20 Mbps Digital LANs

5 100 MHz 100 Mbps Digital LANs

6 200 MHz 200 Mbps Digital LANs

7 (draft) 600 MHz 600 Mbps Digital LANs


UTP Contd.
 RJ-45 (Registered-Jack)is
used for 4-pair UTP cable
 UTP can pass a wide range
of frequencies
 Performance is measured
as attenuation versus
frequency and distance
 Attenuation is measured as
decibels per mile and is
increased sharply after
100KHz
Coaxial Cable
 It can carry higher frequency ranges
than UTP

 The outer metallic wrapping serves


both as a shield against noise and Category
Impedan
Use
as the second conductor ce
75 W
 These cables are categorized by RG-59 Cable TV

their radio government (RG) ratings RG-58 50 W


Thin
Ethernet
 These are categorized according to Thick
gauge of wire, thickness and type of RG-11 50 W
Ethernet
insulation, construction of the shield
and size of type of outer casing
Coaxial Cable contd.
 BNC connectors are
used(Bayone-Neill-Concelman)
 BNC connector is used to connect
end of the cable to a device
 BNC-T is used in ethernet
 BNC terminator is used at the end
of the cable
 Attenuation is much higher than
the UTP
 Frequent use of repeaters is
needed to avoid attenuation
Fiber-Optic cables
 Transmits signals in the form of visible light
 It uses the refraction property of light for transmission
 i.e. light travels in a straight line in an uniform
medium and changes the direction when passes from
one medium to another having different density

Core: glass or plastic, cladding: covering with less dense glass or plastic
Propagation modes
Current technology allows two modes of propagating
light along optical channels

Multimode: multiple beams


Single mode: single focused beam
Mechanism
 Multimode step index:
 The density of core remains constant
from core center to edges.
 Light moves in a straight line and
reflects back from edge
 Distortion is more as various rays
received at different times
 Multimode graded index:
 The density of core varies (decreases)
from core center to edges.
 Light undergoes a series of refraction
 Distortion is less as compared to step-index as distance traveled is less
and received time variation is less
 Single Mode:
 Uses focused source of light and step-index fiber having small diameter
 Propagation of beams is almost horizontal
Fiber Optics contd. Type Core
Clad
ding
Mode

 Optical fibers are defined by 50/125 50 125


Multimode,
the ratio of their diameter of graded-index

their core to cladding 62.5/125 62.5 125


Multimode,
graded-index
 Cable composition 100/125 100 125
Multimode,
graded-index
 Outer jacket is made of either
PVC or teflon 7/125 7 125 Single-mode

 Inside the jacket are Kevlar


strands to strengthen the cable
 Below the Kevlar another plastic
coating is there
 The fiber is at the center of the
cable, and it consists of cladding
and the core
Fiber Optics contd.
 It uses three different types of
connectors
 Subscriber channel(SC) connector
used in cable TV with a push/pull
locking system
 Straight Tip (ST) connector is used
for connecting cable to networking
devices with a bayonet locking
system
 MT-RJ is a new connector with same
size as RJ-45
 Attenuation is flatter than TP and
coax thus less no of repeaters are
needed to transmit(10 times less)
Advantages and Disadvantages
Adavntages
 Higher Bandwidth
 BW is not limited by medium but by signal generation and reception
 Less Signal Attenuation
 Can run 50 KM without regeneration
 No electromagnetic interference
 Resistance to corrosive materials

 Light weight

 Tapping is difficult

Disadvantages
 Installation and Maintenance

 Unidirectional (two fibers needed to make it bi-directional)

 Cost
Unguided Media
 It transports electromagnetic waves without using a
physical conductor called Wireless Communication

 Unguided signals can travel from source to destination


in several ways
Radio and microwaves of Electromagnetic spectrum is divided into 8 ranges

Band Range Propagation Application


VLF 3–30 KHz Ground Long-range radio navigation
Radio beacons and
LF 30–300 KHz Ground
navigational locators
MF 300 KHz–3 MHz Sky AM radio
Citizens band (CB),
HF 3–30 MHz Sky
ship/aircraft communication
Sky and VHF TV,
VHF 30–300 MHz
line-of-sight FM radio
UHF TV, cellular phones,
UHF 300 MHz–3 GHz Line-of-sight
paging, satellite

SHF 3–30 GHz Line-of-sight Satellite communication

EHF 30–300 GHz Line-of-sight Long-range radio navigation


Wireless transmission waves
 Wireless transmission is broadly divided into three groups
 Radio Wave: Between 3KHz to 1GHz, omni directional, can travel long
distance thus making suitable for log-distance broadcasting like AM
radio, FM radio, TV, cordless phones etc.
 Low and medium frequencies can penetrate walls, uses omni directional
antennas, high interference
 Microwave: Ranging from 1 and 300GHz, unidirectional, low interference
uses unidirectional antennas with line-of-Sight (LOS) propagation
 Very high frequency microwaves cannot penetrate walls, used for long
distance transmission, cellular phones, wireless LANs, two types:
terrestrial microwave and satellite microwave
 Infrared: frequencies from 300GHz to 400THz, can be used for very
short range communication, cannot penetrate walls, confined to one
room only(remote control of TV), no licensing required
 May be used to communicate between devices such as keyboards, mice,
PCs, printers, handset, PDAs etc.
Antennas
Radiation and reception of electromagnetic waves
Coupling of wires to space for radio transmission
It
works as an adapter between a guided and unguided
media Unidirectional Antenna
Switching
 To connect multiple devices over a distance we
adopt a method called switching
 Switches are hardware and/or software devices
capable of creating temporary connections as
per requirements
 A switched network consists of a series of
interlinked switches
 Switching Methods
 Circuit switching
 Packet switching
Circuit Switching
 It creates a direct physical connection between two
devices i.e. it establishes a physical circuit before
transmission
 It uses a device
with n I/P s and
m O/Ps

 Circuit Switching Techniques


 Space Division Switches

 Crossbar switch, multistage switch

 Time division switches

 Time Slot Interchange, TDM Bus


Crossbar switch
 It connects n I/Ps and m O/Ps in a grid
 Each cross point consists of a electronic switch

 The order of switch required is huge O(nm)


 It is impractical because of the size of the crossbar
 It is also inefficient because in practice 25% of the
switches are used at a given time
Multistage switch
 Uses crossbar switches in several stages
 The design of multistage switch depends on the no of stages
and the no of switches required in each stage

 Number of outputs in one stage=number of switches in the


next stage
 The number of cross points required is much less than a
crossbar switch
 The reduction in the number of cross points results in blocking.
i.e. one input is blocked to connect to a output due to
unavailability of a path
Time Division Switches
 It uses time division multiplexing to achieve switching
 Time Slot Interchange(TSI)
 It changes ordering of slots based on desired connections

 It consists of RAM with several memory location


 Size of each location is same as size of time slot
 TSI fills up incoming data inorder of reception
 Slots are sent out in an order based on the decission of
control unit
TDM Bus
 In this case the I/P and
O/P are connected to a
high speed bus through
input output gates
 Each input gate is closed
during the time slots and
only one output gate is
closed.
 The controlling unit
decided which switches
are to be closed
TDM Bus
 Space division switches have no delay and time division
switches requires cross points
 Combining both technologies will result in switches that are
optimised both in physically (no of components) and temporally
(delay)
 It can be designed as TST, TSST, STTS, etc.
Telephone Network

 Telephone network is made of three major components: local


loops, trunks, and switching offices
 Local loop: that connects the subscriber telephone to the nearest
end office or local central office
 Trunk: transmission media that handle the communication
between offices, normally handles hundreds or thousands of
connections through multiplexing
 Switching Office: A switch connects several local loops or trunks
and allows a connection between different subscribers.
Making a Connection
 Accessing the switching station at the end offices is
accomplished through dialing
 In case of rotary dialing a digital signal is sent to the end office
 In case of touch-tone technique two analog signals are sent to
the end office, depending on the row and column of the switch
position.
 e.g. for 8, the signals 852Hz and 1336Hz are sent
Note:

Voice communication used analog signals


in the past, but is now moving to digital
signals. On the other hand, dialing started
with digital signals (rotary) and is now
moving to analog signals (touch-tone).
Packet Switching
 Circuit switching are best suited for voice
communication, as data communication are bursty in
nature i.e. data transmitted in blocks with gaps
between them
 A circuit switched link assumes a single data rate for
both devices
 In Circuit switching all transmissions are equal, priority
base communication is not allowed
 In Packet switching data transmitted in discrete units
called packets
 There are two approaches for packet switching
 Datagram approach, and Virtual Circuit approach
Datagram Approach

 In this approach each packet treated independently called


datagrams
 Each datagram contains appropriate information about the
destinations and the network carries the datagrams towards
destination
 Datagrams may reach at destination out of order
 The links joining each pair of nodes may contain multiple
channels. Each of these channels is capable of carrying
datagrams from several sources or from a single source
Virtual Circuit Approach
 In this approach the relationship between all packets belonging
to a message is preserved
 A single route is chosen between sender and receiver at the
beginning of session
 All packets now travel one after another along the same route
 It is implemented in two formats
 Switched Virtual Circuit (SVC), and Permanent Virtual Circuit (PVC)
 Switched Virtual Circuit
 A Virtual Circuit is created whenever it is needed (e.g. TCP‟s three way
handshake) and exists for the duration of the specific exchange
 Each time a device makes a connection to another device, the route may
be same or may differ in response to varying network conditions
 Permanent Virtual Circuit
 The same virtual circuit is provided between two users on a contineous
basis. The circuit is dedicated to specific users without making a
connection establishment or release
A Comparison for data traffic
 A circuit switch connection creates a physical path between two
points where as a virtual circuit creates a route between two
points
 The Network resources (link and switches) that make a path
are dedicated but that make a route can be shared by other
connections
 The line efficiency is greater in Packet switching as a single link
can be shared by many packets over time
 A packet switching network can perform data-rate conversion.
i.e. two stations having different data rates can exchange
packets but it is not possible in circuit switching
 In a typical user/host data connection, much of the time line is
idle thus making circuit switching inefficient
 When traffic becomes heavy on a circuit switching network,
some calls are blocked, but in packet switching network
Effect of Packet Size

 Virtual circuit from x to y


 a and b are intermediate switches
 Message of size 40 octets
 Packet header 3 octets (control
information)
 Case I: entire message sent as one
packet
 Case II: entire message sent as
two packets
 Case III: entire message sent as
five packets
 Case IV: entire message sent as
ten packets
Packet Size contd.
 Case I
 packet is first transmitted from X to a. when the entire packet is received
by a, it can then be transmitted to b.
 Ignoring switching time, total transmission time is 433=129 octet time
 Case II
 Node a can begin transmitting the first packet as soon it has arrived
from X, without waiting for the second packet. Overlapping in
transmission time!
 Total transmission time is 234=92 octet time
 Case III
 packets are transmitted still faster due to more number of overlapping
 Total transmission time is 117=77 octet time
 Case IV
 Total transmission time is 712=84 octet time
 Time is increased as fixed header becomes an overhead. i.e. 3 10=30
octets of header information for 40 octets of data!
One more comparison
 Performance
 Propagation delay
 Time it takes a signal to
propagate from one
node to another
 Transmission Time
 Time it takes for a
transmitter to push a
block of data to the
medium
 Propagation delay
 Time it takes for a node
to perform the
necessary processing as
it switches data
Circuit Switching Datagram Virtual-Circuit
Dedicated transmission path No dedicated path No dedicated path
Continuous transmission of data Transmission of packet Transmission of packet

Fast enough for interactive Fast enough for interactive Fast enough for interactive
Messages are not stored Packets may be stored until Packets may be stored until
transmitted delivered
The path is established for Route established for each Route established for entire
entire conversation packet conversation
Call set-up delay, transmission Packet transmission delay Call setup delay, packet
delay transmission delay
Busy signal if called party busy Sender may be notified if Sender notified of connection
packet not delivered denial
Overload may block call setup; Overload increases packet delay Overload may block call set-up;
no delay for established calls increases packet delay
Usually no speed or code Speed and code conversion Speed and code conversion
conversion
Fixed Bandwidth Dynamic use of bandwidth Dynamic use of bandwidth
No overhead bits after call Overhead bits in each Overhead bits in each
setup packet packet
End of Module I
COMPUTER NETWORKS
(BCSE 3306)

Lecture Notes
Module II
Out Line of Module II
 Data-Link Layer
 Error detection and correction
 Data link control and protocols
 Point-to-Point access (PPP)
 Multiple Access
 Local Area Networks: Ethernet
 Wireless LANS
 Virtual Circuit Switching: Frame Relay and ATM

Text: “Data Communications and Networking” Third Edition,


Behrouz A Forcuzan, Tata Mc Graw-Hill.
Chapter 10 - Chapter 15 and Chapter 18
Lecture I
• Error Detection and Correction
• Types of Errors
• Detection
• Error Correction
• Data Link Control and Protocols
• Stop and Wait ARQ
• Go-Back-N ARQ
• Selective Repeat ARQ
• HDLC
• PPP
Errors in Transmission
 Data can be corrupted during transmission, for reliable
communication, errors must be detected and
corrected
 Two types of transmission errors
 Single bit error: only one bit of the data unit is changed

 Burst error: two or more bits in the data unit have changed
Error Detection Methods
 Vertical Redundancy Check (VRC)
 Append a single bit at the end of data block such
that the number of ones is even
 Even Parity (odd parity is similar)
0110011  01100110
0110001  01100011
 VRC is also known as Parity Check
 Performance:
 Detects all odd-number errors in a data block

7
Error Detection Methods
 Longitudinal Redundancy Check (LRC)
 Organize data into a table and create a parity for
each column

11100111 11011101 00111001 10101001

11100111
11011101
00111001
10101001
10101010

11100111 11011101 00111001 10101001 10101010


Original Data LRC

8
Detection mechanisms
 To detect errors in transmission the concept of
redundancy is used i.e. adding extra bits along with
data and transmitted to other end.

 Detection Methods
 Parity Check
Cyclic Redundancy
Check (CRC)
 Checksum
Parity check
 It can be simple or two dimensional
 Simple Parity Check
 A redundant bit called parity bit is added to every data unit
so that the total no of 1s (including parity bit) in the unit
becomes even or odd
 Performance:
 it can detect all single
bit errors,
 also it can detect

burst errors of odd size


i.e. 1, 3, 5 etc.
 However it can not

detect burst errors of


even size, i.e. 2, 4, 6 etc
Two-Dimensional Parity Check
 A block of bits is organised in a table, now parity bit is
calculated for each row then parity bit of each column
thus generating one more row (redundant data unit).
 The extra data unit is also transmitted
 Performance
 A redundancy of n
bits can easily detect
a burst error of n bits
 If some even number

of bits of two data units


gets corrupted in same
position then it can not be detected
2D Parity Check

What is its performance?


12
2D Parity Check: Performance

13
2D Parity Check: Performance

14
Example: Two dimensional Parity Check
 Suppose the following block is sent:
10101001 00111001 11011101 11100111 10101010
 However, it is hit by a burst noise of length 8, and some
bits are corrupted.
10100011 10001001 11011101 11100111 10101010
 When the receiver checks the parity bits, some of the bits do
not follow the even-parity rule
10100011 10001001 11011101 11100111 10101010
 and the whole block is discarded.
Cyclic Redundancy Check (CRC)
 It is the Most powerful method based on binary division
 The redundancy bits used by CRC are derived by dividing the data unit by a
predetermined divisor; the remainder is the CRC

 Method
 A string of n 0s appended to data unit, n is one less then the number of bits present in the
predetermined divisor
 Data unit appended with 0s is divided by the divisor using modulo-2 division and the
remainder is collected
 Remainder replaces n no of 0s appended to data unit and transmitted
 At the receiving end the data along with CRC is divided by the divisor and if remainder is Zero
than no error
Binary Division in CRC: An Example

Sending End Receiving End


CRC contd.
 Modulo-2 division
 If left most bit of dividend is 1 then quotient will be 1 else 0
 0-0 = 0, 1-1=0, 1-0=1, 0-1=1
 Note: we are dealing with bit-patterens not with quantitative values
 Divisor
 It is calculated from an algebraic polynomial

 Properties
 It should not be divisible by x, guarantees that
all burst errors of a length equal to the degree of
polynomial are detected
 It should be divisible by x+1, guarantees that
all burst errors affecting an odd number of bits
are detected
Standard Polynomials
Name Polynomial Application

CRC-8 x8 + x2 + x + 1 ATM header


CRC-10 x10 + x9 + x5 + x4 + x 2 + 1 ATM AAL
ITU-16 x16 + x12 + x5 + 1 HDLC
x32 + x26 + x23 + x22 + x16 + x12 + x11 +
ITU-32 LANs
x10 + x8 + x7 + x5 + x4 + x2 + x + 1

 An Example
 It is obvious that we cannot choose x (binary 10) or x2 + x (binary
110) as both are divisible by x.
 However, we can choose x + 1 (binary 11) because it is not
divisible by x, but is divisible by x + 1.
 We can also choose x2 + 1 (binary 101) because it is divisible by x
+ 1 (binary division).
Checksum
 A simple but effective method based on redundancy
 Method
 Subdivide the data unit into equal segment of n bits
 These segments are added using ones complement arithmetic so that
result is also n bits

 The sum is complemented and


appended at the end of original data unit
as redundant bits
 At the receiving end all the groups are
added again and if the result is zero then
there is no error

 Performance
 Detects all errors involving an odd number of
bits as well as most errors involving an even
number of bits
Example
 Suppose the following block of 16 bits is to be sent using a checksum of 8 bits.
 10101001 00111001
 The numbers are added using one’s complement
 10101001
 00111001
 ------------
 Sum 11100010 , Checksum 00011101
 The pattern sent is 10101001 00111001 00011101
 Now suppose the receiver receives the pattern sent without any error.
 Receiver adds all sections using same method
10101001
00111001
00011101
Sum 11111111 , Complement 00000000 means that the pattern is OK.
Example
Now suppose there is a burst error of length 5 that affects 4 bits.
10101111 11111001 00011101
When the receiver adds the three sections, it gets
10101111
11111001
00011101
Partial Sum 1 11000101
Carry 1
Sum 11000110
Complement 00111001 the pattern is corrupted.
Hamming Distance
 The Hamming distance between two words is
the number of differences between
corresponding bits.
 The minimum Hamming distance is the smallest
Hamming distance between
all possible pairs in a set of words.

10.23
We can count the number of 1s in the Xoring of two words

1. The Hamming distance d(000, 011) is 2 because

2. The Hamming distance d(10101, 11110) is 3 because

10.24
Example 10.5

Find the minimum Hamming distance of the coding scheme in


Table 10.1.

Solution
We first find all Hamming distances.

10.25The dmin in this case is 2.


Example 10.6

Find the minimum Hamming distance of the coding scheme in


Table 10.2.

Solution
We first find all the Hamming distances.

10.26 The dmin in this case is 3.


Error Correction
 Two ways of error correction
 Error correction by retransmission
 When an error is detected, receiver asks sender to
retransmit the whole data unit
 This method is normally used in TCP/IP. i.e. CRC is used
in Link layer and Checksum is used in Network and
Transport Layer
 Forward Error Correction
 A receiver uses an error correcting code, but it requires
more number of redundant bits to know the position of
error in comparison to error detection methods
 e.g. for a single bit error, one bit parity is sufficient to
know if there is error or no error, i.e. 0 or 1
Forward Error correction
 Redundancy bits needed is
 Let number of data bits be m, and redundant bits be r
 Therefore total no of bits sent is m+r
 Then r must be able to indicate m+r+1 different
states. i.e. to indicate if there is an error in one of the
m+r positions and one state is needed to say that
there is no error
 One bit can represent 2 states, then r bit can
represent 2r states therefore the inequation
2r  m+r+1 must be satisfied
 Now given the value of m, r can be calculated
 e.g. if m=7 then r has to be 4, i.e.
24  7+4+1 is satisfied
Hamming Code for Single bit error Correction
 Provides a practical solution to FEC
 Method:
 Let number of data bits (m) be 7 => number of redundant bits
(r) are 4
 Position of redundant bits are defined as 1st, 2nd, 4th, and 8th,
i.e. 2x, x=0,1,2,…

 Value of each of r bits is calculated as parity bit for one


combination of data bits given as follows
 r1: data bits 1, 3, 5, 7, 9, 11 (binary value containing 1 at 1st position)
 r2: data bits 2, 3, 6, 7, 10, 11 (binary value containing 1 at 2st position)
 r3: data bits 4, 5, 6, 7 (binary value containing 1 at 3rd position)
 r4: data bits 8, 9, 10, 11 (binary value containing 1 at 4th position)
Redundancy bits calculation
Error detection using Hamming code
Burst error Correction
 Hamming code cannot correct a burst error directly.
But by rearranging the sending data the code may be
applied
 Method:
 Instead of sending all
bits in a data unit
together, we organise N
units in a column and
then send first unit of
each unit followed by
second bit of each and
so on
 If a burst error of M bits occur (M<N), then only one bit from
each of the M units is corrupted
 We can then correct the corrupted bit applying the Hamming
code N times
Data link control and Protocols
 Flow Control and Error control are the
important responsibilities of link layer,
collectively called as data link control
 Flow Control
 refers to a set of procedures used to restrict the
amount of data that the sender can send before
waiting for acknowledgement
 Error Control
 It is based on the Automatic Repeat reQuest (ARQ),
i.e. any time an error is detected, specified frames
are retransmitted also called Positive
Acknowledgement with Retransmission(PAR)
Stop and Wait ARQ
 The sending device sends a frame and waits for the
acknowledgement before sending another
 The sending device keeps a copy of the last frame transmitted
until it receives an ACK
 Both data and ACK frames are numbered and a data frame 0
acknowledged by ACK 1 frame indicating that the receiver has
received data 0 and expecting Data 1.
 If a receiver receives a damaged frame then it is discarded
without any response to sender
 Sender maintains a variable ‘S’, that holds the number of
recently sent frame. Receiver maintains a variable ‘R’ that holds
the number of next expected frame
 The sender starts a timer when a fame is sent, if ACK is not
received within a pre allotted time period (Time out) the same
frame is retransmitted
 The receiver sends ACK if a correct frame is received
Operation Lost or
damaged frame
Normal

Lost ACK Delayed ACK


Piggybacking
 To achieve full duplex (bi-directional transmission) we use a concept
called piggybacking
 It is a method to combine data frame with an ACK instead of sending
two separate frames, thus ACK gets a free ride on the next out going
data frame. It saves bandwidth.
 Characteristics of Stop & Wait
 It is simple but inefficient
because
a) The network will be
completely idle during times
that the receiver responses
b) Wasting of substantial
amount of BW Round Trip Time(RTT): The time
c) Duplication due to required for a frame to arrive at the
premature retransmission or receiver plus the transmission time for
lost ACK ACK to come back
Example
 Given Channel BW=50Kbps, RTT=500ms, 1 frame contains
1000bits, then Find channel utilization
 Answer (Method 1)
 At t=0 first frame transmission starts
 The time required to push 1000 bits to medium (1 frame) is
t=1000/50,000=20ms
 1st bit arrives at t=250ms (RTT/2), the last bit arrives at t=270ms
 Ignoring the processing time, and length of ACK, At t=520ms ACK
arrives at the sender, i.e. At t=520ms the next frame transmission starts
 i.e. 20ms utilization time and 500ms waiting time for a total of 520 ms
communication time
 Utilization = 4%, waiting=96% loss of BW
 Answer (Method 2)
 The system can send 50000.5=25,000 (BWdelay)bits during the time
it takes for the data to go from the sender to the receiver and then back
again.
 However, the system sends only 1000 bits. i.e. the link utilization is only
1000/25,000, or 4%.
Sliding Window
 The main disadvantage of Stop and wait method is loss of
bandwidth and efficiency is low
 To improve efficiency, multiple frames should be in transition
while waiting for ACK
 In this method an window amount of frames can be sent
without receiving ACK
 An imaginary window with fixed size slides over the frames at
sending end. It contains the frames to be transmitted next
 It is implemented in two ways. 1. Go Back n ARQ 2. Selective
Repeat ARQ
Window size = 7 frames
Sequence number 0, 1,
Direction of transmission
2, . . ., 7 then wrap
around
Go Back n ARQ
 The sender maintains three variables
 S: holds the sequence number of the recently sent frame
 SF: holds the sequence number of the first frame in the window
 SL: holds sequence number of last frame in the window
 The size of the window W = SL – SF + 1
 The receiver maintains only one variable
 R: holds the sequence number of the next frame expected
Direction of transmission
Go Back n ARQ

Lost or damaged frame


Normal
Go Back n ARQ contd.
 A damaged or lost ACK results in two situations
 If next ACK arrives before the timer expires, no
retransmission is required
 If next ACK does not arrive before timer expires then all the
frames starting from last ACK received is retransmitted
again, thus the name Go Back n
 A delayed ACK results in two situations
 If next ACK arrives before the timer expires, no
retransmission is required
 If no ACK is received before timer expires then all the
frames starting from last ACK is resent again and these
frames are discarded at the other end if already received
before
 Piggybacking
 Each direction needs a window
Go Back n ARQ: Sender Window size
 Size of Sender window < 2m
 m is the number of bits available in the header to store the
sequence number of the frames
 Let m = 2 then

sequence nos are


0, 1, 2, 3
(i.e. 4 frames)
 Sender window

size = 3 frames?
Other wise there
will be problem
Selective Repeat ARQ
 Go Back n method is inefficient in case of noisy links where
there is higher probability of damage, as this method has to
resent multiple frames making the condition more worse
 To avoid this we have another method called Selective repeat
ARQ, which resends only the damaged/lost frame instead of all
frames.
 Sender and Receiver windows
 Both have a window having size at most on-half of the value 2m
Selective Repeat ARQ, lost frame

• Draw the figures for


• lost Ack
• delayed ACK
• Piggybacking
Selective Repeat ARQ, sender window size

 Bandwidth-Delay Product
 It is a measure of efficiency of an ARQ, it is a measure of no
of bits that can be sent while waiting from the receiver
 i.e. BW (bits/sec)  round trip time (sec) = no of bits
Example
In a Stop-and-Wait ARQ system, the bandwidth of the line is 1 Mbps,
and 1 bit takes 20 ms to make a round trip. What is the bandwidth-delay
product? If the system data frames are 1000 bits in length, what is the
utilization percentage of the link? What is the utilization percentage of
the link, if the link uses Go-Back-N ARQ with a 15-frame sequence?
Solution
Stop & Wait ARQ
 The bandwidth-delay product is 1  106  20  10-3 = 20,000 bits , can be sent during
one RTT, But system sends only 1000 bits. i.e. link utilization is 1000/20,000 = 5%.

Go Back n ARQ
 The bandwidth-delay product is still 20,000.
 The system can send up to 15 frames or 15,000 bits during a round trip.
 This means the utilization is 15,000/20,000 = 75%.
 Of course, if there are damaged frames, the utilization percentage is much less
because frames have to be resent.
HDLC Protocol
 High-level Data Link Control is an actual protocol
designed(by ISO in 1979) to support half-duplex and
full-duplex communication over point-to-point and
multipoint links
 Two Transfer Modes defined
 Normal Response Mode (NRM)
 Asynchronous Balance Mode (ABM)
 NRM: in this unbalanced mode one
station is designated as primary
station and others are secondary
 A primary station can send
commands and secondary stations
can only respond to the commands
Uses both point-to-point and
multipoint links
HDLC Protocol contd
 Asynchronous Balance Mode (ABM): in this balanced
mode each station can command and response.
 It uses point-to-point link

 Frames: HDLC defines three types of frames


 Information Frames (I-Frame):used to carry user data and
control information relating to user data
 Supervisory frames (S-Frame): used only to carry control
information
 Unnumbered Frames (U-Frames): reserved for system
management or link management
HDLC Frame Formats

 Each frame contains up to 6 fields as shown above


 Flag: An 8-bit sequence with a bit-pattern that
identifies both beginning and end of a frame and also
used for synchronization.
 Address: It contains the secondary station’s address
i.e. a ‘to address’ if frame created by primary or
contains a ‘from address’ if created by secondary.
 It can be on byte or multiple bytes. If the last bit of one byte
is a 1 then there is no other byte. If the last bit is zero then
next byte is also contains address
 The system that does not use primary/secondary
configuration like ethernet needs two address field for
sender and receiver respectively
HDLC Frame Formats
 Control: 1 or 2 byte segment used for flow and error
control
 Information: contains user information or network
management information. Length is fixed within each
network
 FCS: Frame Check Sequence field contains either a 2-
byte or 4 byte CRC
HDLC I-Frame Format

 Control field
 first bit is zero for I-Frame
 Next thee bits called N(S) represents sequence number of
data frames
 P/F bit used for dual purpose i.e. if value is one then it is
either POLL bit or a FINAL bit. If 0 then it is unused
 Poll: when a frame is sent by primary to secondary
 Final: when frame sent from secondary to primary
 Next thee bits called N(R) represents sequence number of
ACK frames when piggybacked
 Information field
 Contains user users data, i.e. data received from upper layer
HDLC S-Frame Format

 These frames are used for ACK, flow and error


control, i.e. used for ACK whenever piggybacking is
inappropriate or not possible
 Control field
 First two bits are 10 for S-Frame
 Next two code bits defines 4 types of S-Frame
 Receive Ready (RR): value 00, it can be used in 4 different
ways
 ACK: P/F=0, used by receiver to send an +ve ACK for a received I-
Frame, N(R) contains next frame expected
 Poll: P=1, used by primary for polling
 Final: F=1, used by secondary to tell that nothing t be sent
 +ve response to select, F=1, used by secondary, ready to receive
HDLC S-Frame Control field contd.
 Receive Not Ready (RNR): value 10, can be used in 3 different
ways
 ACK, RNR: used by receiver, acknowledging receipt of all frames up to &
excluding N(R), and announces busy condition, i.e. unable to receive
more frames
 Select: P=1, used by primary to send information to secondaries
 -ve response to Selcet: F=1, used by secondary, unable to receive data
 Reject (REJ): value 01, used by receiver to represent –ve ACK
(NAK)
 Selective reject (SREJ): code 11, used by receiver, NAK for
Selective repeat ARQ
 P/F bit is as discussed for I-Frames
 Next thee bits called N(R) represents sequence number of ACK
or NAK value
 It has no N(S) field as it is never used for data transmission
HDLC U-Frame

 Theses frames are used to exchange session management and control


information
 It contains 5 code bits having following options
Code Command Meaning Response

00 001 SNRM Set Normal Response Mode


Set Normal Response Mode
11 011 SNRME (Extended)

Set Asynchronous Balance


11 100 SABM Mode, Disconnect Mode DM

Set Asynchronous Balance


11 110 SABME Mode (Extended)
00 000 UI Unnumberd Information UI

00 110 Unnumberd Acknowledgement UA


Disconnect, Request
00 010 DISC Disconnect RD

Set Initialization Mode,


10 000 SIM Request Information Mode RIM
00 1000 UP Unnumbered poll
11 001 RSET Reset
11 101 XID Exchange ID XID
10 001 Frame Reject FRMR
Data Transparency
 If a data field of an HDLC frame
contains a pattern that is same as
flag sequence then receiver
interprets it the sequence as ending
flag which causes problem called
lack of data transparency
 To ensure that the flag sequence
does not appear in the any where
else in the frame HDLC uses
technique called Bit Stuffing
 According to this technique each
time a sender wants to transmit a
bit sequence having more than five
consecutive 1s, it stuffs (inserts)
one redundant 0 after the fifth 1.
 At the receiving end receiver
deletes (unstuffs) one 0 after fifth 1
in the received bit stream.
Point-to-Point Access: PPP
 It is deigned to connect home computers to the
server of ISP.
 They are connected to the Internet either
through a telephone line or cable TV
connection using a modem
 PPP is a datalink layer protocol
 PPP provides following services
 It defines the data format of the frame
 Establishment of link and exchange of data
 Authentication
Point-to-Point Access: PPP

 It employs a version of HDLC frame


 Flag: 011111110, identifies boundaries of a PPP frame
 Address: 11111111, uses broadcast address, as it is a
point to point
 Control: 11000000, format of U-frame and shows that
does not contain any sequence number, thus no flow
or error control
 Protocol: it defines the type of data field, i.e. either
user data or any other information
 Data: carries either user data or other information
 FCS: 2-byte or 4-byte CRC.
Point-to-Point Access: PPP
 Idle state: link is not being
used, no active carrier, line is
quit
 Establishing State: one of the
endpoints starts
communication, options are
negotiated. If negotiation is
successful, system goes to
authentication state
 Authenticating State: is
optional, if successful,
connection goes networking
state, otherwise goes to
termination stage
 Terminating stage: closing
the connection
PPP Stack
 PPP uses a stack of protocols to provide the service.
Each time, a PPP packet can carry packets related to
one of these protocols in its data field. The type of
protocol is defined by the protocol field
 Link Control Protocol (LCP)
 It is responsible for establishing, maintaining, configuring,
and terminating links
 Also provides negotiation mechanism to set options
PPP Stack
 Code: Type of LCP Packet  Length: length of LCP Packet
 ID: A value used to match request with  Information: extra information
reply. needed for LCP Packet
Code Packet Type
0116 Configure-request  Options: There are many options that can be
0216 Configure-ack
negotiated between two end points
 Options are inserted in the information field
0316 Configure-nak
 Some of the options are as follows
0416 Configure-reject
0516 Terminate-request
0616 Terminate-ack Option Default

0716 Code-reject Maximum receive unit 1500


0816 Protocol-reject Authentication protocol None
0916 Echo-request Protocol field compression Off
0A16 Echo-reply Address and control field
Off
0B16 Discard-request compression
LCP Packet Options
 Configuration Packets: are used to negotiate options
 Configuration Request: initiating communication
 Configuration ACK: if options of configuration Request are accepted.
 Configure NAK: if configurations are revised, then sender sends a totally
new configuration request
 Configure Reject: if some options are not recognized then these are
marked with reject packet, sender send a new configure request
 Link Termination Packets: are used to disconnect the link
 Termination Request: either of the two parties
 Termination Reply: other answers
 Link Monitoring and Debugging Packets
 Code Reject: receives a packet with unknown code
 Protocol Reject: receives a packet with unknown protocol
 Echo Request & Echo Reply: to monitor the link
 Discard Request: loop-back test packet, used by sender to check internal
condition, request is simply discarded
Authentication Protocol
 PPP is designed to be used over dial-up links where
verification of user identity is necessary
 Two protocols are used for authentication(PAP &
CHAP).
 Password Authentication Protocol(PAP)
 User needs to access sends an authentication
identification(user name) and a password
 The system checks the validity of the identification and
password and either accepts or denies connection
PAP contd.
 PAP packet is embedded in information frame of PPP
 Authentication request: request access
 Authentication-ACK: accept access
 Authentication-NAK: to deny access
Challenge Handshake Authentication Protocol
 Is a three way handshaking protocol that provides
more security than PAP
 System sends the user a challenge packet containing a
challenge value, usually a few bytes
 User applies a predefined function to received value and
own password and produces a result. Sends the result back
to system
 System also performs same operation with same data and
compares with the received result.
CHAP Contd.
 4 packet types as shown
Network Control Protocol (NCP)
 After successful authentication connection goes to
network state
 NCP used to encapsulate data coming from network
layer to PPP frame
 Internetwork Protocol Control Protocol(IPCP)
 Before the packet can be sent one more connection at the
network layer has to established
 The set of packets that establish and terminate a network
layer connection for IP Packets is called IPCP
Network Control Protocol Contd.
 It uses 7 types of packets
 Configuration request packet is used to negotiate options with other party
 After configuration link is ready to carry IP data in the payload field of PPP,
and the value of protocol field is changed to 002116
 After data transmission again IPCP takes control to terminate the network
connection A Complete Example
Types of IPCP packets
Code IPCP Packet

01 Configure-request
02 Configure-ack
03 Configure-nak
04 Configure-reject
05 Terminate-request
06 Terminate-ack
07 Code-reject
Lecture II
• Multiple Access
• Random Access
• Controlled Access
• Channelization
• Wired LAN: Ethernet (802.3)
• Traditional Ethernet
• Fast Ethernet
• Gigabit Ethernet
• Wireless LAN
• IEEE 802.11
• Bluetooth (802.15)
Access Control
 The way to coordinate access to a link when used by
more than one device
 The methods may be classified as follows
Random Access
 According to this method , each station has the right
to the medium without being controlled by any other
station
 Some procedures are defined to resolve the access
conflict called collision.

 Multiple Access (ALOHA)


 Any station sends when a
frame is ready
 Waits for an ACK, if not
received in allotted time
then the frame is resent
Carrier Sense Multiple Access (CSMA)
 To minimize the chance of collision, The CSMA method is
developed
 Each station listens before transmitting. i.e. transmission
is possible only if line is idle
 Possibility of collision still exists because of propagation
delay
 The garbled signal
reaches at times t4
and t5 respectively
 Two strategies to
sense a busy
medium
 Non persistent
 persistent
CSMA, Persistence Strategies
 If the line is idle, station sends immediately,
otherwise waits a random period of time
before resending
 Reduces the chance of collision as it is
unlikely that two stations will wait same
amount of time. But decreases efficiency as
waits unnecessarily random amount of time

 If the line is idle, the station sends with a


probability
 1-persistent: station sends frame with a
probability 1 (i.e. 100%). Increases chance of
collision
 P-persistent: station sends a frame with a
probability p and refrains with a probability 1-
p
CSMA/CD (Collision Detection)
 After sending the system monitors for a collision
 If collision detected, it informs others by sending a jam signal and waits for
some time(?) before resending
 To reduce the probability of collision, station waits for a little time for first time.
Changes waiting time for subsequent collision
CSMA/CD Contd.
 Back-off methods
 Exponential Back-off
 System waits between 0 – 2nmax-propagation time

 ‘n’ is the attempted no of transmissions

 Random Back-off
 system waits for a random amount of time before
resending.
 The random number is generated based on current value of
parameter n.
 ‘n’ is initially 0 and incremented by one each time a collision
occurs
 When jam signal is received by others, they will discard
the part of the frame received.
 This method is used in traditional Ethernet
CSMA/CA (Collision Avoidance)
 This procedure avoids collision, uses
one of the persistence strategies
 After it finds a line is idle
 System waits an Inter Frame Gap
(IFG) amount of time then another
random amount of time before
sending and sets a timer
 If it does not receive ACK before
timer expires then it increments
back-off and waits this amount of
time before sensing the line again.
 Used in W-LANs.
Controlled Access
 A Station cannot send unless authorized by other stations
 Reservation Method
 A station needs to reserve before sending

 Time is divided into intervals, In each interval, a reservation


frame precedes the data frames sent in that interval
 If N stations are there in the system, there are exactly N
reservation mini slots. Each belonging to a station
Polling
 One device designated as primary and others are as secondary
 Primary has control over the link, the secondaries follows
instructions
 Polling: Primary asks secondary if they have anything to send
 Select: primary needs to send to a secondary
Token Passing
 A station authorized to send data when it receives a
special frame called token
 A token keeps circulating around the ring
 If a station needs to send it captures the token and
sends data frames.

 Finally it releases the


token when finishes. Now
the token may be used by
others
Channelization
Channelization is a multiple-access method in which the
available bandwidth of a link is shared in time, frequency,
or through code, between different stations.

FDMA: The bandwidth is divided into channels


TDMA: bandwidth is one channel that is time shared
CDMA: one channel carries all transmissions simultaneously
with different code
FDMA
 Separation of the whole spectrum into smaller frequency bands
 A channel gets a certain band of the spectrum for the whole time
 Advantages:
 no dynamic coordination
necessary k1 k2 k3 k4 k5 k6

 works also for analog signals c


f

 Disadvantages:
 waste of bandwidth
if the traffic is
distributed unevenly
 inflexible t
 guard spaces
TDMA
 A channel gets the whole spectrum for a
certain amount of time k k k k4 k5 k6
1 2 3

 Advantages: c

 only one carrier in the f

medium at any time


 throughput high even
for many users
t

 Disadvantages:
 precise
synchronization
necessary
CDMA
 Each channel has a unique code
k1 k2 k3 k4 k5 k6

 All channels use the same spectrum


at the same time c
 Advantages:
 bandwidth efficient
 no coordination and synchronization
necessary
 good protection against interference and f
tapping
 Disadvantages:
 lower user data rates
 more complex signal regeneration
t
 Implemented using spread spectrum
technology
Access method - Mathematical Representation
 Each station is assigned a code, which is a
sequence of numbers called chips
 0 represented as –1 and 1 as +1
 Disadvantages:
 higher complexity of a receiver (receiver cannot just listen into the

medium and start receiving if there is a signal)


 all signals should have the same strength at a receiver

 Advantages:

 all terminals can use the


same frequency, no planning
needed
 huge code space (e.g. 232)
compared to frequency space
 interferences is not coded
 forward error correction and
encryption can be easily
integrated
Local Area Networks: Ethernet
In 1985, the Institute of Electrical and Electronics Engineers(IEEE)
started a project, called Project 802, to set standards to enable
intercommunication among equipment from a variety of
manufacturers.
It is a way of specifying functions of the physical layer and the
data-link layer of major LAN protocols.
The Ethernet LAN was developed in the 1970s.

Since then, it has gone through four generations:


Standard Ethernet (10 Mbps)
Fast Ethernet (100 Mbps)
Gigabit Ethernet (1 Gbps, 10 Gbps)
Traditional Ethernet
 Designed to operate at 10Mbps
 Access method used is 1-persistent CSMA/CD
 Frame defined by 802.3, contains seven fields

 Preamble: 7bytes of alternating 0s and 1s that alert the receiving system to


the coming frame and enable it to synchronize
 Start Frame Delimiter: 1 byte (10101011) signals beginning of frame. Last
chance for synchronization.
 Destination and Source address: 6 bytes, contains the physical address of
source and destinations
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
Physical Address
 The 6-byte (48-bit) physical address is embedded into NIC.
 The address is normally represented in two-digit hexadecimal
notation
 e.g. 12:34:56:78:9A:BC

The least significant bit of the first byte defines the type of address.
If the bit is 0, the address is unicast;otherwise, it is multicast.

The broadcast destination address is a special case of the multicast address in which
all bits are 1s.
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 from the left. If it is even, the address is
unicast. If it is odd, the address is multicast. If all digits are
F’s, the address is broadcast. Therefore, we have the
following:
a. This is a unicast address because A in binary is 1010.
b. This is a multicast address because 7 in binary is 0111.
c. This is a broadcast address because all digits are F’s.
13.94
Categories of traditional Ethernet
10Base5 10Base2

• Called Thinnet, uses


CSMA/CD
• called Thicknet, One segment < = 500 • thin coaxial cable, span
mts and uses coaxial cable length <= 185 mts
• Access method is CSMA/CD
• Bus topology LAN,
•Uses BUS topology
10Base-T, Twisted Pair Ethernet
10Base-FL (Fiber Link)

• Uses star topology LAN, with


a hub to connect multiple
devices • Star topology LAN
with a hub
• max length 100 mts
• UTP cable and RJ-45
• Uses two pairs of
connectors fiber optic cables
Fast Ethernet (100 Mbps)
 IEEE 802.3u
 Access method, frame format, min and max frame
length and addressing are same as Traditional
Ethernet (10 Mbps)
 There is no need for CSMA/CD, but it is there to be
compatible with traditional Ethernet
 Auto negotiation: A new feature added to Fast
Ethernet that allows a station or a hub to
 Allow incompatible devices to connect one another. i.e. back
word compatible with traditional Ethernet to work in 10Mbps
 Allow one device to have multiple capabilities.
 Allow a station to check hub’s capabilities
Fast Ethernet Implementations
100Base-TX implementation

Encoding and decoding


• Uses 2 pairs of cat-
•To maintain synchronization, the
5/STP twisted pair with
encoder first performs block encoding.
Star topology
• The 4 parallel bits received from NIC
• Transceiver is
are encoded into 5 serial bits using
responsible for
4B/5B (requires a bw of 125MHz i.e
transmitting, receiving,
125Mbps)
detecting collisions, and
encoding and decoding of • The data is then encoded in to MLT-3
data
100Base-FX Implementation

• uses two pairs of fiber-


optic cables in a physical star
Encoding and Decoding
topology •To maintain synchronization, the encoder
performs block encoding
• The transceiver is
• The four parallel bits received from NIC
responsible for transmitting, is encoded into 5 serial bits using 4B/5B
sending, detecting the
• Then the data is encoded using NRZ-I
collision, and
encoding/decoding.
100Base-T4 Implementation

 Uses Cat-3, 4-pair UTP


 uses 8B/6T for encoding and decoding, which reduces the bW
from 100 to 75Mbaud.
 100Base-T4 is designed to operate on 25-Mbaud BW
 Two pairs are designed for unidirectional transmission, other two
for bi-directional transmission. Unidirectional pairs are kept free to
carry collision signals.
Gigabit Ethernet
 IEEE 802.3z
 Uses full-duplex mode without CSMA/CD
 Lack of collision implies that the max length of the
cable is determined by the signal attenuation in the
cable, not by the collision detection process
 GMII specifies a parallel data path (8 bits at a time)
between RS sub-and transceiver
 Implementation
 Gigabit Ethernet can be categorized as either a two wire or a
four wire implementation.
 The two wire implementations use either fiber-optic cable
(1000Base-SX, shortwave or 1000Base-LX, long wave) or
STP (1000Base-CX)
Wireless LANS
 Defined by IEEE 802.11 & Bluetooth
 The standard 802.11 defines two kinds of services
 Basic Service Set(BSS): the basic building block of WLan
 Extended Service Set(ESS): communicating among BSSs

 Basic Service Set


 Is made of stationary or mobile wireless stations and an
optional central base station known as Access Point (AP)
Service Sets
 The BSS without AP is a stand alone network and can’t send
data to other BSSs
 It is called an Ad hoc Network or Infrastructure Less Network

 An BSS with an AP is called Infrastructure based network

 Extended Service Sets


 Is made up of two or more
BSSs with Aps
 Communication between two
stations in two different BSSs
usually occurs via two Aps
 APs are connected via
distribution System
Station types
 Three types of stations are defined based on
their mobility
 No-transition
 is either stationary or moving only inside a BSS
 BSS-transition
 can move from one BSS to another, but the movement
is confined to one ESS
 ESS-transition
 can move from one ESS to another. But standard does
not guarantee the continuity in communication
MAC sub-layers in IEEE 802.11
 Defines two MACs and is called
as Distributed Foundation
Wireless Medium Access Control
(DFWMAC)

 Distributed coordination
function(DCF)
 The CSMA/CD access method of ethernet fails in wireless
medium
 so it uses the basic method CSMA/CA and an optional
method avoiding hidden terminal problem

 Point coordination function (PCF)


 uses contention free polling method by AP for time bounded
service
Motivation for CSMA/CA
 WLANs cannot implement CSMA/CD because
 It requires that the station must be able to send data
and receive collision at the same time. (i.e. two paths
and increased BW!)
 Collision may not be detected due to hidden terminal
problem
 Signal fading could prevent a station at one end from
hearing a collision from other end called near/far
terminal problem
 Thus DCF implements CSMA/CA
Hidden and Exposed terminals
 Hidden terminals
 A sends to B, C cannot receive A
 C wants to send to B, C senses a “free” medium (CS fails)
 collision at B, A cannot receive the collision (CD fails)
 A is “hidden” for C

 Exposed terminals A B C

 B sends to A, C wants to send to another terminal (not A or B)


 C has to wait, CS signals a medium in use

 but A is outside the radio range of C, therefore waiting is not


necessary
 C is “exposed” to B
Near and Far terminals
 Terminals A and B send, C receives
 signal strength decreases proportional to the square of the
distance
 the signal of terminal B therefore drowns out A’s signal
 C cannot receive A

A B C
Also severe problem for CDMA networks as all signals arrive
with more or less same strength - precise power control
needed!
Inter-frame spacing times
 802.11 MAC uses three different parameters for waiting
time that define the priorities of medium access
 Short inter-frame spacing(SIFS): shortest waiting time and
hence highest priority is defined for control messages like
ACK or polling responses, for DSSS SIFS is 10s and for FHSS
it is 28s
 PCF inter-frame spacing(PIFS): A medium priority waiting
time used for a time-bounded service like AP polling. Defined
as SIFS plus one slot time
 DCF inter-frame spacing(DIFS): longest waiting time and has
the lowest priority for medium access. Used for data service
within a contention period Defined as SIFS plus two slot times
 Slot time is 50s for FHSS and 20s for DSSS
Process CSMA with CTS and RTS
 Before sending a frame source senses the medium
 Channel uses a persistent strategy with back-off until the
channel is idle
 Station now waits for a period of time

called the Distributed Inter-Frame Space;


then sends a control frame called RTS
(request to send)
 After receiving the RTS and waiting a
short period of time called short inter-
frame space, the destination station
sends a control frame called CTS(clear
to Send)
 Source sends data after waiting an amount of time
equal to SIFS
 Destination waits for SIFS before sending ACK
CSMA/CA flowchart
Process Collision Avoidance
 When station sends RTS frame, it
includes the duration of the time that it
needs to occupy the channel
 The stations that are affected by this

transmission create a timer called NAV.


 Each other station first checks NAV
before sensing the channel
 If two or more stations try to send RTS at the same
time and there is a collision, then sender tries again if it
does not receive CTS
 As the wireless medium is noisy, It is more efficient to
replace a large frame with some smaller frames.
MAC sub-layer Frame format

Field Frame Control sub-fields Explanation

Version The current version is 0.


Type Type of information: management (00), control (01), or data (10).
Subtype Defines the subtype of each type
To DS Defined later.
From DS Defined later.
More flag When set to 1, means more fragments.
Retry When set to 1, means retransmitted frame.
Pwr mgt When set to 1, means station is in power management mode.
More data When set to 1, means station has more data to send.
WEP Wired equivalent privacy. When set to 1, means encryption implemented.
Rsvd Reserved.
Other fields
 D: This field defines the duration of the transmission used to
set NAV
 Addresses: Four address fields, each 6byte long
 Sequence Control: Defines the sequence# of the frame used
for flow control
 Frame body: Contains information based on the type and sub-
type field in FC
 FCS: 4byte CRC-32 error detection sequence
 Frame types: standard defines three types of frames
 Management frames: Are used for the initial communication
between station and access points
 Control frames: Used for accessing the channel and ACK
frames
 Data frames: used for carrying data and control information
Control Frame format Sub-
Meaning
type
 For control frame type field is 01
1011 Request to send (RTS)

1100 Clear to send (CTS)

1101 Acknowledgment (ACK)

Addressing Mechanism (FC)


Add 1: address of next device
To From Address Address Address Address
DS DS 1 2 3 4 Add 2 : the address of previous
Destination Source device
0 0 BSS ID N/A
station station
Add 3 : the address of Final
Destination Sending Source destination if not defined by
0 1 N/A
station AP station
Add 1
Receiving Source Destination
1 0 N/A Add 4 : the address of original
AP station station
Receiving Sending Destination Source source if not same as Add 2.
1 1
AP AP station station
Addressing mechanism: case 1 Case 2

To DS=0, from DS=0


• the frame is not going and is
To DS=0, from DS=1
not coming from a distribution
system. • the frame is coming from a
distribution system.
• i.e the frame is going from
one station in a BSS to another • i.e the frame is coming from
system without passing through an AP and going to a station
distribution system
• The ACK is sent to the AP
Addressing mechanism: case 3 case 4

To DS=1, from DS=0 To DS=1, from DS=1


• the frame is going from a
• The frame is going from one
station to an AP AP to another AP via wireless
• The ACK is sent to the medium
original station
• As in wire medium ethernet
• Address 3 contains the final frame has to be used
destination in another BSS
Bluetooth
 Is a wireless LAN technology designed to connect devices of
different functions such as telephones, notebooks, computers,
cameras, printers, coffee makers, and so on
 A Bluetooth LAN can be connected to Internet if one of the
gadgets has this capability
 It can not be large
 This technology can be used to connect peripheral devices to
computer, monitoring devices can be connected to sensors etc.
 Originally developed by Ericsson and named after Harald
Blaatand (king of Denmark, 940-981). Later in 1998 five
companies (Ericsson, Intel, IBM, Nokia, Toshiba) founded
Bluetooth consortium to develop a low cost, single chip, radio
based wireless network
 Today the Bluetooth technology is the implementation of a
protocol defined by 802.15 and is called WPAN that is operable
in a small area with small number of devices
Bluetooth
 A Bluetooth network is called a piconet and needs no
infrastructure, this type of WPANS may be used in
various scenarios
 Connection of peripheral devices to a desktop

 Support of ad-hoc networking

 e.g. teacher distributing data to students PDAs inside the


class
 Bridging of networks
 Using piconets, a mobile phone can be connected to a PDA
or laptop. The mobile phone can now act as a bridge
between local piconet and GSM
 Bluetooth is designed to provide local wireless access
at very low cost with a limited BW and without any
extra infrastructure
Bluetooth Architecture
 Operates on 79 channels in 2.4GHz band with 1MHz carrier
spacing
 Each device performs frequency hopping with 1600 hops/sec in
a pseudo random fashion
 A piconet is a collection of Bluetooth devices which are
synchronized to the same hopping sequence with following
properties
 Can have up-to eight stations, one of which
is called the Master, rest are slaves
 Master determines hopping pattern
 Communication may be on-to-one, or one-
to-many
 An additional eighth slave may be in parked state, i.e. cant participate
actively in piconet
 The limit is eight because the address field contains 3 bits and any parked
device can be active if one of the seven slaves goes to parked state
Bluetooth Architecture
 A group of piconets is combined to form a scatternet and can
accommodate more devices.
 Different piconets in a scatternet use different hopping

sequences
 One device may participate in more than one piconet one at a

time
 A master of one piconet
can act as a slave in other
piconet but one cant be
master in two piconets

 communication between different piconets takes place by


devices jumping back and forth between these nets
 however scatternets are not yet supported by all devices
Bluetooth layers (Protocol Stack)
 Radio Layer
 Specifications of air interface
and equivalent to physical
layer of internet model
 Band: 2.4GHz ISM band
divided into 79 channels of
1MHz each
 FHSS: 1600 hops/sec, i.e. one frequency is used for 625 s
 Modulation: uses Gaussian FSK and are available in three
classes
 Power class 1: max power of 100mW and min power of 1mW, 100m
range without obstacles
 Power class 2: max power of 2.5mW and min power of 0.25mW, 10m
range without obstacles
 Power class 3: max power of 1mW
Base Band Layer
 Uses Time Division Duplex-TDMA
 If the piconet has only one slave, then
the master uses even numbered slots
and slave uses odd numbered slots
 TDD-TDMA allows the communication
in half-duplex mode. i.e. in slot 0
master sends and slave receives and
in slot 1 slave sends master receives
 If it has more slaves then master uses
even numbered slots where as odd
numbered slots are used by slaves.

 if master sends to slave 1 at slot 0 then slave 1 answers at


slot 1 then master sends to slave 2 in slot 2 slave 2 answers at
slot 3, and the cycle continues
Base Band Layer Frame format
 A frame can be of three types
 One slot frame: 259s is used for hopping and control
mechanism thus the frame can last upto 366s or of 366 bits
 Three slot frame: length of frame = 3*625-259=1616 bits
 Five slot frame: length of frame = 2866 bits

 Access code: contains synchronization bits and the identifier of


master
 Header: is a repeated 18 bit pattern, each pattern contains
 Address: represents active slave address. can define seven secondaries, 0
is used for broadcasting from master to slaves
Base Band Layer Frame format contd.
 Type: type of data coming from upper layer
 F: used for flow control
 A: used for ACK, uses stop and wait ARQ without retransmission
 S: sequence number of frame
 HEC: header error correction uses checksum
 The header has three identical 18-bit sections. Receiver
compares these three sections bit by bit. If all three
corresponding bits are same than the bit is accepted otherwise
majority is taken.
 This is a form of Forward error correction
 Payload: it contains the data or control information from upper
layers.
L2CAP data packet format
 The logical link control and adaptation protocol is used
for data exchange on an asynchronous connection link

 Length defines the size of the data, in bytes


 CID defines a unique identifier for the virtual channel created
 L2CAP duties
 Multiplexing: supports many application layer protocols

 Segmentation and reassembly: divides large packets of

upper layer (65535) to smaller size


 QoS: uses best effort service

 Group management: allows devices to create logical

addressing among themselves to form a multicast group


Lecture III

• Wide Area Networks


• Virtual Circuit
• Frame Relay
• ATM
Wide Area Networks
 WANs provide long distance transmission over large
geographical areas
 It utilizes public, leased or private communication
equipments to span over countries or continents
 It uses one of the packet switching methods called
virtual circuit switching.
 Frame relay is a link layer protocol used in WAN
technology, which provides relatively high speed
transmission
 ATM (Asynchronous Transfer Mode) is another
protocol for WAN technology that works as a super
highway of communication.
Virtual circuit switching in WAN
 Global Addressing
 A source or destination need
to have a global address,
which should be unique in
the scope of WAN
 Virtual Circuit Identifier
 Is a small number that only
has switch scope and is
actually used for data
transfer
 i.e it is used by a frame
between two switch
 When a frame arrives a
switch, it has one VCI; when
it leaves, it has another
VCI Phases
 To communicate, the source
and destination need to go
through three phases. i.e.
setup, data transfer, & tear
down

 Data Transfer phase


 All switches have table called
a switching table with at least
4 columns
 When a frame arrives it
checks its VCI and incoming
port no.
Data transfer Phase
 It finds corresponding out going port and changes
the VCI as in the table before sending out
 The data transfer phase is active until the source
sends all its frames
Setup Phase
 Setup phase
 Source and destination use their global addresses to help
switches make table entries for connection
 Two approaches: PVC, SVC
 Permanent Virtual Circuit
 For each destination one circuit is dedicated (always
present) whether in use or not
 The corresponding table entry is recorded for all switches by
the administrator
 An out going VCI is given to the source, and an incoming
VCI is given to the destination
 If there is a need for duplex communication then two virtual
circuits are established
Switched Virtual Circuit
 SVC creates a temporary connection, that exists only when data
are transmitted between source and destination
 Setup request
 Source sends the set up frame to the switch, switch finds out going port
from its routing table and creates entry in the switching table for the
incoming virtual circuit
 Acknowledgement
 The last field of switching table entry is made from ACK

setup ACK
Frame Relay
 Is a virtual circuit switching WAN used between 1980
– 1990
 It operates at a higher speed (1.544Mbps, now
44.376Mbps)
 Operates in physical and datalink layer
 Allows bursty data with a frame size of 9000 bytes
 It is less expensive than other traditional WANs
 It has error detection mechanism at datalink layer. No
flow or error control schemes available.
 It is so designed to provide fast transmission
capability for more reliable media and for those
protocols that have flow and error control at the
higher layers
Frame Relay Architecture
 Frame relay network can be a part of Internet
 Frame relay uses both PVC and SVC. The virtual circuit
is identified by a number called Data Link Control
Identifier(DLCI is same as VCI)

 Frame Format
Frame format contd.
 DLCI: total 10 bit used as connection identifier
 Command/response (C/R): used by upper layers to
identify the frame as either a command or response
 Extended Address(EA): if 0 then another address byte
to follow; if 1 then current byte is the final byte
Frame format contd.
 FECN: can be set by any switch to indicate that the
traffic is congested in the direction of flow
 BECN: is set to indicate a congestion in the opposite
direction
 Discard eligibility(DE): this bit indicates the priority
level of the frame according to which the frame may
be discarded in case of congestion
Frame Relay Assembler/Dissembler (FRAD)
 This device is used to to handle frames coming from other
protocols
Other features
Voice Over Frame Relay (VOFR)
Used to send voice by digitizing the voice using PCM and
then sent in data frames
Local Management Information (LMI)
Is a protocol added to frame relay to provide more
management features, It provides
A keep alive mechanism to check if data are flowing
A multicast mechanism to allow a local end system to send
frames to more than one remote end system
A mechanism to allow an end system to check the status of
a switch (if switch is congested)
Congestion Control and Quality of Services are also
provided by frame relay
ATM Networks
Is a cell relay protocol designed by ATM forum and
adopted by ITU-T
A cell is a basic unit of data exchange. It is a small, fixed
sized block of information
Frames of different sizes and formats reach the cell network,
these frames are split into some cells of fixed length
Now cells are multiplexed with other cells and routed

frame of line 1 and lne 2 are splited into 3 cells each then
interleaved so that none suffers long delay
suitable for voice or real-time transmissions
ATM Networks Architecture
ATM uses asynchronous time division multiplexing

The user access devices,


called the end points are
connected to the switches
through a user-to-network
Interface(UNI)
Switches are connected with
each other through Network
to Network Interface (NNI)
ATM Architecture, Virtual Connection
Connection between two end points are accomplished through
transmission paths (TPs). i.e. TPs are physical connection
between endpoints via a set of switches and links
A TP is divided into several Virtual Paths (VPs). A VP provides a
connection or set of connections between two switches
All VP contains more than one Virtual circuits (VCs)
Virtual Connection
A virtual connections are identified by a pair of
parameters called The Virtual path identifier (VPI)
and virtual circuit identifier (VCI)
VPI defines the VP and VCI defines a particular VC
inside VP

In a UNI, the VPI is represented using


8bits and in NNI it represented using
12 bits.
VCI is represented using 16 bits in
both cases
Miscellaneous
Cell structure
A cell is of 53 bytes with 5 byte header and 48 byte payload
Switching
Uses both PVC and SVC
A switch routes the cell using both VPIs and VCIs
ATM Layers
Physical layer
Original design was based on
SONET as the physical layer
carrier
But it also can use other carriers
ATM Layer
Provides routing, traffic
management, switching,
and multiplexing services
It accepts 48 byte
segments from AAL and
adds 5byte header to form
a cell of 53 bytes
ATM Layer
It uses two different header formats for UNI and NNI

GFC: 4bit field provides flow control at UNI level


VPI: virtual path identifier (8bit for UNI, 12 bit for NNI
VCI: 16 bit for both UNI and NNI
PT: 3 bit field defines user data or management info
CLP: 1 bit field for congestion control
HEC: 8 bit CRC for header part only
Application Adaptation Layer
It is designed to accept any type of payload like
internet data or multimedia load
AAL defines a sub-layer called Segementation and
reassembly sub-layer to segment incoming data in to
48byte segments and at the destination these
segments are reassembled
The converge sub-layer is defined to provide integrity
of data
ATM defines 4 versions of AAL: AAL1, AAL2, AAL3/4,
AAL5
AAL1 is used for streaming audio and video
communication and AAL5 for data communication
AAL1
Supports applications that transfer information at constant bit
rates like video or voice
CS sub-layer divides bit stream into 47 byte segments and
passes them to SAR sub-layer
SAR adds 1 byte header to each segment. The header contains
Sequence number(SN): out of 4 bits, 3bits are used to define sequence
no to order the bits
Sequence number
protection(SNP):
second 4 bit
protects the first
field. First 3 bit
protects sequence #
and last bit is for
parity for all 7 bits
AAL5
It assumes that all cells belonging to a message travel
sequentially
CS sub-layer adds a trailer with following fields
User-to-user(UU): used by end users
Common part identifier (CPI): defines how the the
subsequent fields are to be interpreted
Length(L): 2-byte
L field indicates the
length of original
data
CRC: The last 4
bytes is for error
control in the entire
data unit
END of Module II
Data Link Layer:
Data Link Control
Outline
 Framing
 Byte vs. bit oriented protocols
 Data Link Control
 Flow control
 Error control
 Protocols

2
Framing
 Process of wrapping data with certain info before
sending out

 A frame typically consists of


 Flag: indication for start and end of a frame
 Header: source/destination addresses, as well as other
control information
 Data from the upper layer
 Trailer: error detection/correction code

3
Byte Stuffing
 Process of adding extra byte whenever there is
an escape or a flag character in the data

4
Bit Stuffing
 Process of adding extra bit to ensure flag
sequence does not appear in the data

01111110

5
Flow Control and Error Control
 Flow control
 A set of procedures that tells the sender how
much data can be sent before waiting for
acknowledgment
 Error control
 Includes both error detection and correction
 Allows receiver to inform sender of lost or
duplicate frames
 Mostly based on Automatic Repeat Request
(ARQ)

6
Data Link Protocols

7
"Simplest": Flow Diagram

8
Stop-and-Wait Mechanism
 Still noiseless channel
 Receiver has limited buffer
 Requires flow control
 Sender sends one frame at a time and
wait for an acknowledgment

9
Stop-and-Wait: Flow Diagram

10
Noisy Channel
 Realistic
 Error can and will happen
 Require error control
 Mechanisms:
 Stop-and-Wait ARQ
 Go-Back-N ARQ
 Selective Repeat ARQ

11
Stop-and-Wait ARQ
 Sender keeps a copy of sent frame until
successful delivery is ensured
 Receiver responds with an ack when it
successfully receives a frame
 Both data and ack frames must be
numbered
 When sender does not receive an ack
within certain time, it assumes frame is
lost, then retransmits the same frame.

12
Flow Diagram: Normal Operation
Sender Receiver

S=0 R=0
Deliver

S=1 R=1

Deliver
R=0

Time Time

13
 Thinking Corner
 Why data frames need to be numbered?

14
Flow Diagram: Lost Frame
Sender Receiver

S=0 R=0
Deliver

S=1 R=1

Timeout

Deliver
R=0

Time Time
15
Flow Diagram: Lost ACK
Sender Receiver

S=0 R=0
Deliver

S=1 R=1

Deliver

Timeout S=1
R=0
Frame 0 expected;
discard

R=0
S=0

Time Time
16
 Thinking Corner
 Why ACK frames need to be numbered?

17
Flow Diagram: Delayed ACK
Sender Receiver

S=0 R=0
Deliver

Timeout
R=1
Frame 0 expected;
discard
S=1
R=1
Timeout

Deliver
R=0
S=0
18
Bidirectional Transmission
 Data are transferred both ways
 ACK are "piggybacked" with data frames

19
Performance Analysis of Stop-Wait ARQ

Source Destination

Tf

Tprop

Tproc

Tprop

Tack

time

• Transmission of one frame:

• Tf: time to transmit frame


• Tprop: time for propagation of the frame
• Tproc: time for destination to process received frame – small delay
(usually ignored if not specified)
20
• After every frame, source must wait till acknowledgment  Hence
link propagation time is significant
• Total time to for one frame:
T_total = Tf + 2Tprop + Tproc + Tack
if we ignore Tproc and Tack (usually very small)
T_total = Tf + 2Tprop
• Link utilization, U is equal to
U = Tf/ (T_total), or
= 1 / (1+2(Tprop/Tf)) = 1 / (1 + 2 a)
where a = Tprop/Tf = length of link in bits
Efficiency or Utilization(U) = 1/(1+2a)

Throughput = Length of packet / Total time = L/(Tf + 2Tprop )


= L/BW *BW/((Tf + 2Tprop )
= L/BW/((Tf + 2Tprop ) *BW
= Tf /((Tf + 2Tprop ) *BW
= U*BW

Throughput = U * BW
21
Examples
Consider the bandwidth of the line is 1.2 Mbps, packet size is 1 KB and round-trip
time is 50 msec. What is the link utilization in stop and wait?​

given,
Bandwidth of line = 1.2 Mbps
packet size = 1 Kb
round trip time = 50 msec

transition delay =

propagation delay

a = 3.643

Link Utilization or Efficiency (U) = = = 0.1206


= 12.06%
22
Example
In a Stop-and-Wait ARQ system, the bandwidth of the line is 1 Mbps, and 1 bit
takes 20 ms to make a round trip. What is the bandwidth-delay product? If the
system data frames are 1000 bits in length, what is the utilization percentage of
the link?

The bandwidth-delay product is


1 × 106 × 20 × 10-3 = 20,000 bits

The system can send 20,000 bits during the time it takes for the data to
go from the sender to the receiver and then back again.

However, the system sends only 1000 bits. We can say that the link
utilization is only 1000/20,000, or 5%.

For this reason, for a link with high bandwidth or long delay, use of Stop-
and-Wait ARQ wastes the capacity of the link.

23
GATE | Gate IT 2005 | Question 72

A channel has a bit rate of 4 kbps and one-way propagation delay of 20 ms. The
channel uses stop and wait protocol. The transmission time of the
acknowledgement frame is negligible. To get a channel efficiency of at least
50%, what should be the minimum frame size.

Explanation:
Bit rate = 4 kbps
One-way propagation delay = 20 ms

Let the transmission time = x


Efficiency = Transmission time of packet/(Transmission time of packet + 2 *
Propagation delay)
0.5 = x/(x + 2 * 20 * 10-3)

x = 40 * 10-3
x= L/BW = L/4kbps  L = 40 * 10^-3 * 4 *10^3 = 160 bits.

24
Improving Link Utilization
 Previous example demonstrates major
disadvantage of Stop-and-Wait ARQ
 Prefer to send more frames before waiting
for ACK
 Example:
 Recalculate the link utilization if we allow up
to 15 frames to be sent before waiting for an
ACK

25
Go-Back-N ARQ

 Allows multiple frames to be sent before waiting for ACK


 These frames must be numbered differently

 Frame numbers are called Sequence numbers

 Frames must be received in the correct order

 If a frame is lost, the lost frame and all of the following


frames must be retransmitted

26
Sending Window
 Sending more than one frame at once requires
sender to buffer multiple frames
 Known as "sending window"
 Any of these frames in the window can be lost

27
"Sliding" Window
 Once the first frames in the window is ACKed
 ACKed frames are removed from the buffer
 More frames are transmitted
 Result: The window slides to the right

28
Receiving Window
 Receiver expects one frame at a time

29
Control Variables in Go-Back-N ARQ

In the Go-Back-N ARQ, sender’s control variables are S, SF, SL.


Receiver's variable is R. Slide window size is W.
S is the sequence number of latest sent frame.
SF is the sequence number of the first frame in the slide window.
SL is the sequence number of the last frame in the slide window.
 R is the sequence number of the excepted frame at receiver.
W=SL-SF+1=2m -1.
Only when R and sequence number of received frame are matched,
frame accept, otherwise discard it.

30
Send vs. Receive Windows

31
Go-Back-N: Window Sizes
 For m-bit sequence numbers
 Send window size: at most 2m-1
 Up to 2m-1 frames can be sent without ACK
 Receive window size: 1
 Frames must be received in order

32
Go-Back-N: Normal Operation

33
Go-Back-N: Lost Frame

Frame 0 & 1 send,


ACK 1 & 2 back to
sender. Frame 2 & 3
send, but frame 2 lost
in the transmission.
When frame 3
received out of order,
this frame 3 will be
discarded by receiver.
After time out, frame
2 resent, then
receiver send ACK 3
back and then frame
3 resent.

34
Lost ACK: Window Size < 2m

In figure, sender slide window


size is less than 2m. ACK 1,2,3
are lost. After frame 0 timeout,
frame 0, 1, 2 are resent. But
receiver is excepting frame 3
now, so when the first resent
data frame 0 arrived, there are
mismatched. So is could
discarded correctly.

35
Lost ACK: Window Size = 2m

In the figure, the


sender slide window
size is equal to 2m.
All ACK lost, after
timeout, the first
frame 0 resend. At
the same time,
receiver slide window
is point at the second
frame 0. So there are
“matched”, but
within different cycle,
the data will be
erroneously ccepted.

36
 Thinking Corner
 Stop-and-Wait is a special case of Go-
Back-N.
 What is the send window size in Stop-and-
Wait?

37
In reality, links usually noisy. Lost or damaged frame occurred very
often. This means lots of frames will be discard by receiver automatically,
even they are correct only with wrong order.
The sender has to send those “innocent” frames again and again.
Bandwidth has been used up, transmission speed slow down.
All of this, made Go-Back-N ARQ is still not very high efficiency.
 Therefore the advanced version protocol came out.
Not need to resend N frames.
Instead, only the lost or damaged frame resend, this mechanism is
called Selective Repeat ARQ.

38
Selective Repeat ARQ
 Go-Back-N always discards out-of-order
frames
 Losing one frame may result in retransmission
of multiple frames
 Very inefficient in noisy link
 Selective Repeat ARQ allows frames to be
received out of order
 Therefore, receive window > 1

39
Send and Receive Windows
Sender slide window

The control variables in Selective Repeat ARQ are same as in Go-Back-N ARQ:
SF , SL and S. But the slide window size changed into 2m-1.

Receiver slide window

Receiver has 2 control variables, RF and RL. The slide window size also changed
into 2m-1.

NAK
NAK means negative acknowledgment, it does only exist in Selective Repeat ARQ.
40
Negative ACK
 Used by receiver to indicate missing frame

41
Selective Repeat: Window Size

42
Medium Access
Protocols
Multiple Access
 Problem: When two or more nodes transmit at the same time, their
frames will collide and the link bandwidth is wasted during collision
 How to coordinate the access of multiple sending/receiving nodes
to the shared link???
 Solution: We need a protocol to coordinate the transmission of the
active nodes
 These protocols are called Medium or Multiple Access Control
(MAC) Protocols belong to a sublayer of the data link layer called
MAC (Medium Access Control)
 What is expected from Multiple Access Protocols:
 Main task is to minimize collisions in order to utilize the bandwidth by:
 Determining when a station can use the link (medium)
 what a station should do when the link is busy
 what the station should do when it is involved in collision
Taxonomy of multiple-access protocols discussed in this chapter

For wireless not


included with us
Random Access
 Random Access (or contention) Protocols:
 No station is superior to another station and none is assigned the control over another.
 A station with a frame to be transmitted can use the link directly based on a procedure defined by the
protocol to make a decision on whether or not to send.

 ALOHA Protocols
 Was designed for wireless LAN and can be used for any shared medium
 Pure ALOHA Protocol Description
 All frames from any station are of fixed length (L bits)
 Stations transmit at equal transmission time (all stations produce frames with equal frame lengths).
 A station that has data can transmit at any time
 After transmitting a frame, the sender waits for an acknowledgment for an amount of time (time out)
equal to the maximum round-trip propagation delay = 2* tprop(see next slide)

 If no ACK was received, sender assumes that the frame or ACK has been destroyed and resends that
frame after it waits for a random amount of time

 If station fails to receive an ACK after repeated transmissions, it gives up

 Channel utilization or efficiency or Throughput is the percentage of the transmitted frames that arrive
successfully (without collisions) or the percentage of the channel bandwidth that will be used for
transmitting frames without collisions

 ALOHA Maximum channel utilization is 18% (i.e, if the system produces F frames/s, then 0.18 * F frames
will arrive successfully on average without the need of retransmission).
Procedure for ALOHA protocol
Critical time for pure ALOHA protocol

Tfr= Frame
Transmission time

If the frame transmission time is T sec, then the vulnerable


time is = 2 T sec.
This means no station should send during the T-sec before this
station starts transmission and no station should start sending
during the T-sec period that the current station is sending.
Pure ALOHA

In pure ALOHA, frames are transmitted at completely arbitrary times.


Note

The throughput ( S) for pure ALOHA is


S = G × e −2G .
The maximum throughput
Smax = 0.184 when G= (1/2).

G = Average number of frames generated by the system (all stations) during one frame transmission time
Q1. 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.

The frame transmission time is 200/200 kbps or 1 ms.

If the system creates 1000 frames per second, this is 1


frame per millisecond.
The load is G=1.
S = G× e−2G
S = G× e-2 or S = 0 135 (13 5 percent)
This means throughput of the system = 0.135 X 1= (13.5 percent).
This means that the throughput is 1000 × 0.135 = 135 frames.
52
Medium Access
Protocols

McGraw-Hill ©The
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction McGraw-Hill Companies, Inc., 2004
or display.
Multiple Access
 Broadcast link used in LAN consists of multiple sending and
receiving nodes connected to or use a single shared link

Broadcast links Examples

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Data link layer divided into two functionality-oriented sublayers

Responsible for error


and flow control

Link Layer Control (LLC)

Control
MAC

Responsible framing
and MAC address and
Multiple Access Control

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Multiple Access
 Problem: When two or more nodes transmit at the same time, their
frames will collide and the link bandwidth is wasted during collision
 How to coordinate the access of multiple sending/receiving nodes
to the shared link???
 Solution: We need a protocol to coordinate the transmission of the
active nodes
 These protocols are called Medium or Multiple Access Control
(MAC) Protocols belong to a sublayer of the data link layer called
MAC (Medium Access Control)
 What is expected from Multiple Access Protocols:
 Main task is to minimize collisions in order to utilize the bandwidth by:
 Determining when a station can use the link (medium)
 what a station should do when the link is busy
 what the station should do when it is involved in collision

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Taxonomy of multiple-access protocols discussed in this chapter

For wireless not


included with us

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Random Access
 Random Access (or contention) Protocols:
 No station is superior to another station and none is assigned the control over another.
 A station with a frame to be transmitted can use the link directly based on a procedure defined by the
protocol to make a decision on whether or not to send.

ALOHA Protocols

 Was designed for wireless LAN and can be used for any shared medium
 Pure ALOHA Protocol Description
 All frames from any station are of fixed length (L bits)
 Stations transmit at equal transmission time of frame .
 A station that has data can transmit at any time
 After transmitting a frame, the sender waits for an acknowledgment for an amount of time
(time out) equal to the maximum round-trip propagation delay = 2* tprop

 If no ACK was received, sender assumes that the frame or ACK has been destroyed and
resends that frame after it waits for a random amount of time

 If station fails to receive an ACK after repeated transmissions, it gives up

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Procedure for ALOHA protocol

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Critical time or Vulnerable time for pure ALOHA protocol

Tfr= Frame
Transmission time

If the frame transmission time is Tfr sec, then the


vulnerable time is = 2 Tfr sec.
This means no station should send during the Tfr sec
before this station starts transmission and no station
should start sending during the Tfr-sec period that the
current station is sending.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Pure ALOHA

In pure ALOHA, frames are transmitted at completely arbitrary times.


McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Note

The throughput ( S) for pure ALOHA is


S = G × e −2G .
The maximum throughput
Smax = 0.184 when G= (1/2).

G = Average number of frames generated by the system (all stations) during one frame transmission time

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Random Access – Slotted ALOHA
 Time is divided into slots equal to a frame transmission
time (Tfr)
 A station can transmit at the beginning of a slot only
 If a station misses the beginning of a slot, it has to wait
until the beginning of the next time slot.
 A central clock or station informs all stations about the
start of a each slot
 Maximum channel utilization is 37%

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Vulnerable time for slotted ALOHA protocol

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Random Access – Slotted ALOHA

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Note

The throughput for slotted ALOHA is


S = G × e−G .
The maximum throughput
Smax = 0.368 when G = 1.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Q1. 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, 1000 frames per
second , 500 frames per second and 250 frames per second

The frame transmission time is 200/200 kbps or 1 ms.


If the system creates 1000 frames per second,
then 1 ms no of frames generate = 1ms * 1000 =1

so G=1.
S = G× e−2G
S = e-2 or S = 0.135 (13.5 percent)
This means throughput of the system = 0.135 X 100= (13.5 percent).
This means that the throughput is 1000 × 0.135 = 135 frames.

Q2. A group of N stations share 100 Kbps slotted ALOHA channel. Each station output a
500 bits frame on an average of 5000 ms . What is the required value of N?

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Throughput Of One Station-

Throughput of each station


= Number of bits sent per second
= 500 bits / 5000 ms
= 500 bits / (5000 x 10-3 sec)
= 100 bits/sec

Throughput Of Slotted Aloha-

Throughput of slotted aloha


= Efficiency x Bandwidth
= 0.368 x 100 Kbps
= 36.8 Kbps

Total Number Of Stations-

Throughput of slotted aloha = Total number of stations x Throughput of each station

36.8 Kbps = N x 100 bits/sec


∴ N = 368

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Pure Aloha Slotted Aloha

Any station can transmit the data at the beginning


Any station can transmit the data at any time.
of any time slot.

The time is continuous and not globally


The time is discrete and globally synchronized.
synchronized.

Vulnerable time in which collision may occur Vulnerable time in which collision may occur
= 2 x Tt = Tt

Probability of successful transmission of data packet Probability of successful transmission of data packet
= G x e-2G = G x e-G

Maximum efficiency = 18.4% Maximum efficiency = 36.8%


(Occurs at G = 1/2) ( Occurs at G = 1)

The main advantage of slotted aloha is that it


The main advantage of pure aloha is its simplicity in
reduces the number of collisions to half and
implementation.
doubles the efficiency of pure aloha.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Random Access – Carrier Sense Multiple Access (CSMA)

 Carrier Sense Multiple Access (CSMA) is a network protocol that listens to or senses network
signals on the carrier/medium before transmitting any data.

Carrier Sense Multiple Access(CSMA) ensures fewer collisions as the station is required to first sense
the medium (for idle or busy) before transmitting data.

If it is idle then it sends data, otherwise it waits till the channel becomes idle.

 However there is still chance of collision in CSMA due to propagation delay. For example, if station
A wants to send data, it will first sense the medium. If it finds the channel idle, it will start sending
data.

 However, by the time the first bit of data is transmitted (delayed due to propagation delay) from
station A, if station B requests to send data and senses the medium it will also find it idle and will also
send data.

 This will result in collision of data from station A and B.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Example-
Consider the following scenario-

At the current instance,

•If station A senses the carrier at its point of contact, then it will find the
carrier free.
•But the carrier is actually not free because station D is already
transmitting its data.
•If station A starts transmitting its data now, then it might lead to a
collision with the data transmitted by station D.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Types of CSMA Protocols

Different CSMA protocols that determine:


 What a station should do when the medium is idle?
 What a station should do when the medium is busy?

1. 0-Persistent CSMA
2. 1-Persistent CSMA
3. p-Persistent CSMA

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


0-persistent CSMA
 A station with frames to be sent, should sense the medium
1. If medium is idle, transmit; otherwise, go to 2
2. If medium is busy, (backoff) wait a random amount of time and repeat 1
 Performance:
 Random delays reduces probability of collisions because two stations with
data to be transmitted will wait for different amount of times.
 Bandwidth is wasted if waiting time (backoff) is large because medium will
remain idle following end of transmission even if one or more stations have
frames to send

Random Waiting
times

Wasted time

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


1-persistent CSMA
 To avoid idle channel time, 1-persistent protocol used
 Station wishing to transmit listens to the medium:
1. If medium idle, transmit immediately;
2. If medium busy, continuously listen until medium becomes idle; then
transmit immediately with probability 1
 Performance
 If two or more stations becomes ready at the same time, collision
guaranteed.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


p-persistent CSMA
 Time is divided to slots where each Time unit (slot) typically equals
maximum propagation delay
 Station wishing to transmit listens to the medium:
1. If medium idle,
 transmit with probability (p), OR
 wait one time unit (slot) with probability (1 – p), then repeat 1.
2. If medium busy, continuously listen until idle and repeat step 1
3. Performance
 Reduces the possibility of collisions like 0-persistent
 Reduces channel idle time like 1-persistent

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Flow diagram for three persistence methods

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


CSMA/CD (carrier sense multiple access with collision detection)

1. Data is transmitted in the form of packets.


2. Sense channel prior to actual packet transmission.
3. Transmit packet only if channel is sensed idle; else, defer the
transmission until channel becomes idle.
4. After packet transmission is started, the node monitors its own
transmission to see if the packet has experienced a collision.
5. If the packet is observed to be undergoing a collision, the
transmission is aborted and the packet is retransmitted after a
random interval of time using Exponential Back-off algorithm

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


CSMA/CD (Collision Detection)
CSMA/CD (Carrier Sense Multiple Access with Collision
Detection) overcomes this as follows:

 While transmitting, the sender is listening to medium for


collisions.
 Sender stops transmission if collision has occurred
reducing channel wastage .

CSMA/CD is Widely used for bus topology LANs (IEEE 802.3, Ethernet).

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


CSMA/CD Protocol
 Use one of the CSMA persistence algorithm
(non-persistent, 1-persistent, p-persistent) for
transmission
 If a collision is detected by a station during its transmission
then it should do the following:
 Abort transmission and
 Transmit a jam signal (48 bit) to notify other stations of collision
so that they will discard the transmitted frame also to make sure
that the collision signal will stay until detected by the furthest
station
 After sending the jam signal, wait for a random amount of time,
then Transmit the frame again

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Exponential Backoff Algorithm
 Ethernet uses the exponential backoff algorithms to determine the
best duration of the random waiting period after the collision
happens
 Algorithm:
 Set “slot time” equal to 2*maximum propagation delay + Jam
signal transmission time (= 51.2 micro-sec for Ethernet 10-Mbps
LAN)
 After Kth collision, select a random number (R) between 0 and
2k –1 and wait for a period equal to (R*slot time) then retransmit
when the medium is idle, for example:
 After first collision (K=1), select a number (R) between 0 and 21 –1
{0 ,1} and wait for a period equal to R*slot times (Wait for a period 0
micro-sec or 1x51.2 micro-sec) then retransmit when the medium is
idle
 Do not increase random number range, if K=10
  Maximum interval {0 – 1023}

 Give up after 16 unsuccessful attempts and report failure to higher


layers
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Flow diagram for the CSMA/CD

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Understanding the Condition To Detect Collision With Example

Consider at time 10:00 am, station A senses the carrier.


It finds the carrier free and starts transmitting its data packet to station D.
Let the propagation delay be 1 hour.
(We are considering station D for the worst case)

Let us consider the scenario at time 10:59:59:59 when the packet is about to reach the station D.
At this time, station D senses the carrier.
It finds the carrier free and starts transmitting its data packet.
Now, as soon as station D starts transmitting its data packet, a collision occurs with the data packet of
station A at time 11:00 am.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


After collision occurs, the collided signal starts travelling in the backward
direction.
The collided signal takes 1 hour to reach the station A after the collision
has occurred.
For station A to detect the collided signal, it must be still transmitting the
data.
So, transmission delay of station A must be >= 1 hour + 1 hour >= 2
hours to detect the collision.
That is why, for detecting the collision, condition is Tt >= 2Tp.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Q. A 2km long broadcast LAN has 107 bps bandwidth and uses CSMA / CD. The signal
travels along the wire at 2 x 108 m/sec. What is the minimum packet size that can be used
on this network?

Explanation: In CSMA/CD, the transmitting node is listening for collisions while it transmits it’s frame. Once it
has finished transmitting the final bit without hearing a collision, it assumes that the transmission was
successful. In this worst-case collision scenario, the time that it takes for a Node to detect that its frame has
been collided with is twice the propagation delay. Hence to confirm that the collision has not occurred the
condition for the minimum size of the packet is:

RTT = Transmission Time

Transmission Time = Length of packet / Bandwidth


RTT = 2 (d/v) = 2(2000/2×108)

Therefore to find minimum size of the packet,


RTT = Length of packet / Bandwidth
Length of packet = RTT x Bandwidth
= 2(2000/2×108) x 107 = 200bits = 25bytes

Therefore, minimum size of the packet = 25bytes

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


CSMA/CA

Algorithm of CSMA/CA :

When a frame is ready, the transmitting station checks whether the channel is
idle or busy.
If the channel is busy, the station waits until the channel becomes idle.
If the channel is idle, the station waits for an Inter-frame gap (IFG) amount of
time and then sends the frame.
After sending the frame, it sets a timer.
The station then waits for acknowledgement from the receiver. If it receives
the acknowledgement before expiry of timer, it marks a successful transmission.
Otherwise, it waits for a back-off time period and restarts the algorithm.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Flowchart of CSMA/CA

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Controlled Access or Scheduling

 Provides in order access to shared medium so that every


station has chance to transfer (fair protocol)

 Eliminates collision completely


 Three methods for controlled access:
 Reservation
 Polling
 Token Passing

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Reservation access method
 Stations take turns transmitting a single frame at a full rate
( R ) bps
 Transmissions are organized into variable length cycles
 Each cycle begins with a reservation interval that consists of (N)
mini-slots. One mini-slot for each of the N stations
When a station needs to send a data frame, it makes a
reservation in its own mini-slot.
By listening to the reservation interval, every station knows which
stations will transfer frames, and in which order.
The stations that made reservations can send their data frames
after the reservation frame.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Polling

 Stations take turns accessing the medium


 Two models: Centralized and distributed polling
 Centralized polling
 One device is assigned as primary station and the others as secondary
stations
 All data exchanges are done through the primary
 When the primary has a frame to send it sends a select frame that
includes the address of the intended secondary
 When the primary is ready to receive data it send a Poll frame for each
device to ask if it has data to send or not. If yes, data will be transmitted
otherwise NAK is sent.
 Polling can be done in order (Round-Robin) or based on predetermined
order
 Distributed polling
 No primary and secondary
 Stations have a known polling order list which is made based on some
protocol
 station with the highest priority will have the access right first, then it
passes the access right to the next station (it will send a pulling message
to the next station in the pulling list), which will passes the access right
to the following next station, …
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Select and poll functions in polling access method

Primary is sending to
Secondary Secondary is sending
to Primary

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


3- Token-Passing network
Implements Distributed
Polling System

bits are copied to the output bits with a one


bit delay Bits are inserted by the station

listen mode transmit mode


input 1 bit delay output
from to delay
ring ring
to station from station to station from station
Station Interface is in two states:
Listen state: Listen to the arriving bits and check the destination address to
see if it is its own address. If yes the frame is copied to the station otherwise
it is passed through the output port to the next station.
Transmit state: station captures a special frame called free token and
transmits its frames. Sending station is responsible for reinserting the free
token into the ring medium and for removing the transmitted frame from the
McGraw-Hill medium. ©The McGraw-Hill Companies, Inc., 2004
Token-passing procedure

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


CHANNELIZATION

Channelization is a multiple-access method in which the available bandwidth of a link


is shared in time, frequency, or through code, between different stations. Types of
channelization protocols:

1. Frequency-Division Multiple Access (FDMA)


2. Time-Division Multiple Access (TDMA)
3. Code-Division Multiple Access (CDMA)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


CHANNELIZATION - FDMA

 FDMA: Frequency Division Multiple Access:


 Transmission medium is divided into M separate frequency bands
 Each station transmits continuously on the assigned band at an average rate of
R/M
 A node is limited to an average rate equal R/M (where M is number of nodes)
even when it is the only node with frame to be sent

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Frequency-division multiple access (FDMA)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


12-3 CHANNELIZATION - TDMA

 TDMA: Time Division Multiple Access


 The entire bandwidth capacity is a single channel with its capacity shared in
time between M stations
 A node must always wait for its turn until its slot time arrives even when it is
the only node with frames to send
 A node is limited to an average rate equal R/M (where M is number of nodes)
even when it is the only node with frame to be sent

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Time-division multiple access (TDMA)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


12-3 CHANNELIZATION - CDMA

 CDMA: Code Division Multiple Access


 In CDMA, one channel carries all transmissions simultaneously
 Each station codes its data signal by a specific codes before transmission
 The stations receivers use these codes to recover the data for the desired
station

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Simple idea of communication with code

12.47
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Q. 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 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 10
Mbps × 51.2 μs = 512 bits or 64 bytes. This is actually the minimum
size of the frame for Standard Ethernet.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Local Area Networks: Ethernet

In 1985, the Institute of Electrical and Electronics Engineers(IEEE)


started a project, called Project 802, to set standards to enable
intercommunication among equipment from a variety of manufacturers.
It is a way of specifying functions of the physical layer and the data-link
layer of major LAN protocols.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Traditional Ethernet
 Designed to operate at 10Mbps
 Access method used is 1-persistent CSMA/CD
 Frame defined by 802.3, contains seven fields

 Preamble: 7bytes of alternating 0s and 1s that alert the receiving


system to the coming frame and enable it to synchronize
 Start Frame Delimiter: 1 byte (10101011) signals beginning of frame.
Last chance for synchronization.
 Destination and Source address: 6 bytes, contains the physical
address of source and destinations

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Traditional Ethernet

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


MAC Address

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

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Physical Address
 The 6-byte (48-bit) physical address is embedded into
NIC.
 The address is normally represented in two-digit
hexadecimal notation
 e.g. 12:34:56:78:9A:BC

The least significant bit of the first byte defines the type of address.
If the bit is 0, the address is unicast;otherwise, it is multicast.

The broadcast destination address is a special case of the multicast


address in which all bits are 1s.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004


Unicast and multicast addresses

13.54
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Note
The least significant bit of the first byte
defines the type of address.
If the bit is 0, the address is unicast;
otherwise, it is multicast.

The broadcast destination address is a special case of the multicast


address in which all bits are 1s.

13.55
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
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
from the left. If it is even, the address is unicast. If it is odd, the address is
multicast. If all digits are F’s, the address is broadcast. Therefore, we have the
following:
a. This is a unicast address because A in binary is 1010.
b. This is a multicast address because 7 in binary is 0111.
c. This is a broadcast address because all digits are F’s.

McGraw-Hill 13.56 ©The McGraw-Hill Companies, Inc., 2004


Network Layer:
Logical Addressing
Q.
An Ethernet MAC sublayer receives 42 bytes of data from the upper layer.
How many bytes of padding must be added to the data?

Q.
The address 43:7B:6C:DE:10:00 has been shown as the source address in an
Ethernet frame. The receiver has discarded the frame. Why?

Ans: The first byte in binary is 01000011. The least significant bit is 1. This means that the
pattern defines a multicast address. A multicast address can be a destination address, but not
a source address. Therefore, the receiver knows that there is an error, and discards the
packet.

Q. An Ethernet MAC sublayer receives 1510 bytes of data from the upper layer.
Can the data be encapsulated in one frame? If not, how many frames need to
be sent? What is the size of the data in each frame?

Ans: Data size for the first frame: 1500 bytes


Data size for the second frame: 46 bytes (with padding)
Q. The data rate of 10Base5 Ethernet is 10 Mbps. How long does it take to
create the smallest frame? Show your calculation.

Ans: The smallest frame is 64 bytes or 512 bits. With a data rate of 10 Mbps,
we have Tfr = (512 bits) / (10 Mbps) = 51.2 μs
This means that the time required to send the smallest frame is the same at
the maximum time required to detect the collision.

Q. Suppose the length of a lOBase5 cable is 2500 m. If the speed of


propagation in cable is 200,000,000 m/s, how long does it take for a bit to travel
from the beginning to the end of the network? Assume there are 10 μs delay in
the equipment.

19.3
IPv4 ADDRESSES

An IPv4 address is a 32-bit address that uniquely and universally defines the
connection of a device (for example, a computer or a router) to the Internet.

IP Address is short for Internet Protocol Address.


It is a unique address assigned to each computing device in an IP network.
ISP assigns IP Address to all the devices present on its network.
Computing devices use IP Address to identify and communicate with other
devices in the IP network.
 IP addresses are written in a dotted decimal notation and
also binary format.
 Each byte is identified by a decimal number in the range
[0..255]:

 Example:

10000000 10001111 10001001 10010000


st nd rd th
1 Byte 2 Byte 3 Byte 4 Byte
= 128 = 143 = 137 = 144

128.143.137.144

19.5
IP Address Format-

IP Address is a 32 bit binary address written as 4 numbers separated by dots.


The 4 numbers are called as octets where each octet has 8 bits.
The octets are divided into 2 components- Net ID and Host ID.

Network ID represents the IP Address of the network and is used to identify the network.
Host ID represents the IP Address of the host and is used to identify the host within the
network.
Note

The address space of IPv4 is


232 or 4,294,967,296.

19.7
Dotted-decimal notation and binary notation for an IPv4 address
Example

Change the following IPv4 addresses from binary


notation to dotted-decimal notation.

Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.
Example

Change the following IPv4 addresses from dotted-decimal


notation to binary notation.

Solution
We replace each decimal number with its binary
equivalent.
Example 19.3

Find the error, if any, in the following IPv4 addresses.

Solution
a. There must be no leading zero (045).
b. There can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.
19.12
Classful Addressing-

Class A

If the 32 bit binary address starts with a bit 0, then IP Address belongs to class A.

In class A IP Address,
The first 8 bits are used for the Network ID.
The remaining 24 bits are used for the Host ID.

19.13
Total number of IP Addresses available in class A = Numbers
31
possible due to remaining available 31 bits = 2
Total Number Of Networks-

Total number of networks available in class A = Numbers


possible due to remaining available 7 bits in the Net ID – 2
7
= 2 – 2 = 126

19.14
Total Number Of Hosts-

Total number of hosts that can be configured in class A


= Numbers possible due to available 24 bits in the Host ID – 2
24
=2 –2

Range Of 1st Octet-

We have-
Minimum value of 1st octet = 00000000 = 0
Maximum value of 1st octet = 01111111 = 127

From here,
Range of 1st octet = [0, 127]
But 2 networks are reserved and unused.
So, Range of 1st octet = [1, 126]

19.15
Finding the classes in binary and dotted-decimal notation
Example

Find the class of each address.


a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111

Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
Number of blocks and block size in Classful IPv4 addressing
Mask
The mask is used to find the netid and the hostid of an IP address.
The length of the netid and hostid (in bits) is predetermined in classful addressing.
It is a 32-bit number made of contiguous 1s followed by contiguous 0s. .

19.19
Finding a network address using the default mask:

Find the network address of the IP 201.24.67.32.

Since the class of the address is C, so apply the default mask for class C,
255.255.255.0 to find the network address. Net-id -201.24.67.0

19.20
An address in a block is given as 73.22.17.25. Find the number of addresses
in the block, the first address, and the last address.

32−8
1. The number of addresses in this block is =2 = 16,777,216.

2. To find the first address, we keep the leftmost 8 bits and set the rightmost 24 bits all
to 0s. The first address is 73.0.0.0.

3. To find the last address, we keep the leftmost 8 bits and set the rightmost 24 bits all
to 1s. The last address is 73.255.255.255.
Internet

An address in a block is given as 200.11.8.45. Find the number of


addresses in the block, the first address, and the last address.
For any given IP Address,

Direct Broadcast Address is obtained by setting all its Host ID part bits to 1.
For any given IP Address, limited Broadcast Address is obtained by setting all its bits to 1.
For any network, its limited broadcast address is always 255.255.255.255

Limited broadcast is a type of broadcast which is limited to the Local Area Network (LAN).
Network will not forward limited broadcast packets to outside the LAN because, these
broadcasts are not relevant to other networks and cause flooding everywhere in the Internet.
So, the scope of limited broadcasts is limited to the Local Area Network (LAN).

19.23
For the following IP Addresses-
1. 1.2.3.4
2. 10.15.20.60
3. 130.1.2.3
4. 150.0.150.150
5. 200.1.10.100
Identify the Class, Network IP Address, Direct broadcast address
and Limited broadcast address of each IP Address.

Given IP Address is-


1.2.3.4

IP Address belongs to class A


Network IP Address = 1.0.0.0
Direct Broadcast Address = 1.255.255.255
Limited Broadcast Address = 255.255.255.255
Subnetting
A network is divided large networks with each small network (or subnet)
having its sub-network address.

Subnets can be freely assigned within the organization


Internally, subnets are treated as separate networks
Subnet structure is not visible outside the organization

University Network

Engineering Medical
School School

Library
Advantages of Subnetting

 With subnetting, IP addresses use a 3-layer hierarchy:


 Network

 Subnet

 Host

 Improves efficiency of IP addresses by not consuming an entire


address space for each physical network.
 Reduces router complexity. Since external routers do not know about
subnetting, the complexity of routing tables at external routers is
reduced.

 Note: Length of the subnet mask need not be identical at all


subnetworks.
A company is granted the site address 201.70.64.0 . The company
needs six subnets. Design the subnets.

The number of 1s in the default mask is 24

The company needs six subnets.


3 This number 6 is not a power of 2. The next number
that is a power of 2 is 8 (2 ). We need 3 more 1s in the subnet mask. The total number of
1s in the subnet mask is 27 (24 + 3).

The total number of 0s is 5 (32 - 27). The mask is 255.255.255.224


5
The number of subnets is 8. The number of addresses in each subnet is 2 (5 is the number of 0s)
or 32.

19.27
19.28
A company is granted the site address 181.56.0.0 . The company needs
1000 subnets. Design the subnets.

It is class B address.

No of n/w bits=16 and No of host bits=16.

we need total of 1000 subnets=10 bits are required borrowed


from host portion.

First subnet id=181.56.0.0

First subnet first host=181.56.0.1

First subnet DBA=181.56.0.63

19.29
An organization has been assigned the network number 192.168.5.0 and it needs to
create a set of subnets that supports up to 20 hosts on each subnet.

Solution:

1.IP:192.168.5.0 , Class –C, N.N.N.H , N/W bit =24 , Host bit =8


2. Required Host bit = H = 5
3. Converted N/W bit = N= Total host bits – Required host bits = 8-5= 3 bits
4. Total no. of network bits = 24+ 3 = 27 bits
5. no. of subnets = 2N = 8 subnets
6.No.of hosts in each subnets = 2H = 32.

Address range:

Subnet #1:
Network address = 192.168.5.0
Broadcast Address = 192.168.5.31
Note

In classful addressing, a large part of the


available addresses were wasted.
Note

Classful addressing, which is almost


obsolete, is replaced with classless
addressing.
Classless Addressing-

Classless Addressing is an improved IP Addressing system.


It makes the allocation of IP Addresses more efficient.
It replaces the older classful addressing system based on classes.
It is also known as Classless Inter Domain Routing (CIDR).

CIDR Block-

When a user asks for specific number of IP Addresses,


CIDR dynamically assigns a block of IP Addresses based on certain rules.
This block contains the required number of IP Addresses as demanded by the user.
This block of IP Addresses is called as a CIDR block.

19.33
Rules For Creating CIDR Block-

A CIDR block is created based on the following 3 rules-

Rule-01:

All the IP Addresses in the CIDR block must be contiguous.

Rule-02:

The size of the block must be presentable as power of 2.


Size of the block is the total number of IP Addresses contained in the block.
1 2 3 4 5
Size of any CIDR block will always be in the form 2 , 2 , 2 , 2 , 2 and so on.

Rule-03:

First IP Address of the block must be divisible by the size of the block.
Note

In IPv4 addressing, a block of


addresses can be defined as
x.y.z.t /n
in which x.y.z.t defines one of the
addresses and the /n defines the mask.
Problem-01:

Given the CIDR representation 20.10.30.35 / 27. Find the range of IP Addresses in the CIDR
block.
Solution-

Given CIDR representation is 20.10.30.35 / 27.


It suggests 27 bits are used for the identification of network.
Remaining 5 bits are used for the identification of hosts in the network.

Given CIDR IP Address may be represented as-


00010100.00001010.00011110.00100011 / 27

So,
First IP Address = 00010100.00001010.00011110.00100000 = 20.10.30.32
Last IP Address = 00010100.00001010.00011110.00111111 = 20.10.30.63

Thus, Range of IP Addresses = [ 20.10.30.32 , 20.10.30.63]

19.36
Note

The first address in the block can be


found by setting the rightmost
32 − n bits to 0s.
Example

A block of addresses is granted to a small organization.


We know that one of the addresses is 205.16.37.39/28.
What is the first address in the block?

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or
205.16.37.32.
This is actually the block shown in Figure.
Note

The last address in the block can be


found by setting the rightmost
32 − n bits to 1s.
Example

Find the last address for the block in Example.

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47
This is actually the block shown in Figure.
Note

The number of addresses in the block


can be found by using the formula
232−n.
Example

Find the number of addresses in Example

Solution
The value of n is 28, which means that number
of addresses is 2 32−28 or 16.

19.42
Subnetting in Networking-

•The process of dividing a single network into multiple sub networks is called as subnetting.
•The sub networks so created are called as subnets.

Advantages-
The two main advantages of subnetting a network are-
•It improves the security.
•The maintenance and administration of subnets is easy.
19.43
Example-01:
We have a big single network having IP Address 200.1.2.0.
We want to do subnetting and divide this network into 2 subnets.

For creating two subnets and to represent their subnet IDs, we require 1 bit.
So,We borrow one bit from the Host ID part.
After borrowing one bit, Host ID part remains with only 7 bits.

19.44
If borrowed bit = 0, then it represents the first subnet.
If borrowed bit = 1, then it represents the second subnet.

IP Address of the two subnets are-


200.1.2.00000000 = 200.1.2.0
200.1.2.10000000 = 200.1.2.128

19.45
For 1st Subnet-

IP Address of the subnet = 200.1.2.0


7
Total number of IP Addresses = 2 = 128
Total number of hosts that can be configured = 128 – 2 = 126
Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0,
200.1.2.127]
Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
Limited Broadcast Address = 255.255.255.255

19.46
For 2nd Subnet-

IP Address of the subnet = 200.1.2.128


7
Total number of IP Addresses = 2 = 128
Total number of hosts that can be configured = 128 – 2 = 126
Range of IP Addresses = [200.1.2.10000000, 200.1.2.11111111] =
[200.1.2.128, 200.1.2.255]
Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
Limited Broadcast Address = 255.255.255.255

19.47
A small organization is given a block with the beginning
address 205.16.37.24/29 (in slash notation). What is the range
of the block?

The beginning address is 205.16.37.24. To find the last address we


keep the first 29 bits and change the last 3 bits to 1s.

First:11001111 00010000 00100101 00011000

Last :11001111 00010000 00100101 00011111

There are only 8 addresses in this block.

19.48
An organization is granted the block 130.34.12.64/26. The

The host bits is 6. This means the total number of addresses in


6
the block is 64 (2 ). If we create four subnets, each subnet will
have 16 addresses.

19.49
Let us first find the subnet mask. We need four subnets, which
means we need to add two more 1s to the net-id. The subnet bit
is then /28.

Subnet 1: 130.34.12.64/28 → 130.34.12.79/28.


Subnet 2 : 130.34.12.80/28 → 130.34.12.95/28.
Subnet 3: 130.34.12.96/28 → 130.34.12.111/28.
Subnet 4: 130.34.12.112/28 → 130.34.12.127/28.

19.50
19.51
An ISP is granted a block of addresses starting with 190.100.0.0/16. The ISP needs
to distribute these addresses to three groups of customers as follows:

1. The first group has 64 customers; each needs 256 addresses.


2. The second group has 128 customers; each needs 128 addresses.
3. The third group has 128 customers; each needs 64 addresses.

Design the subblocks and give the slash notation for each subblock. Find out how
many addresses are still available after these allocations.
256 Address
S1

190.100.0.0/18
S2
Gr-1 …

S64
Large Network
190.100.0.0/16
190.100.0.0/18 128 Address
S1

Gr-2

S2

190.100.0.0/19 Gr-3 S1
S128

S2

… 64 Address

S128

19.53
Solution:
Let us solve the problem in two steps. In the first step, we allocate a subblock of
addresses to each group. The total number of addresses allocated to each group
and the prefix length for each subblock can found as

Group-1 = 64 * 256 = 16384 address , host-bit =14,Group-1 mask = 190.100.0.0/18


Group-2 = 128 * 128 = 16384 address , host-bit=14, Group-2 mask = 190.100.0.0/18
Gropup-3 = 128 * 64 = 8192 address , host-bit= 13, Group-3 mask=190.100.0.0/19

19.54
19.55
Q. One of the addresses in a block is 110.23.120.14/20. Find the
number of addresses, the first address, and the last address in the
block.

Q. An organization is granted the block 130.34.12.64/26. The


organization needs four subnetworks, each with an equal number of
hosts. Design the subnetworks and find the information about each
network.

Solution 32 − 26
The number of addresses for the whole network can be found as N = 2 = 64. The first
address in the network is 130.34.12.64/26 and the last address is 130.34.12.127/26. We now
design the subnetworks:

1. We grant 16 addresses for each subnetwork to meet the first requirement (64/16 is a power
of 2).
2. The subnetwork mask for each subnetwork is:
19.57
An organization is granted a block of addresses with the beginning address
14.24.74.0/24. The organization needs to have 3 subblocks of addresses
to use in its three subnets as shown below:

a. One subblock of 120 addresses.


b. One subblock of 60 addresses.
c. One subblock of 10 addresses.

19.58
19.59
19.60
Q. An ISP is granted a block of addresses starting with 120.60.4.0/22. The ISP wants to
distribute these blocks to 100 organizations with each organization receiving just eight
addresses. Design the subblocks and give the slash notation for each subblock. Find out
how many addresses are still available after these allocations.
IPv6 ADDRESSES

The network layer protocol in the TCP/IP protocol suite is currently IPv4
(Internetworking Protocol, version 4).

IPv4 provides the host-to-host communication between systems in the Internet.

Although IPv4 is well designed, data communication has evolved since the
inception of IPv4 in the 1970s. IPv4 has some deficiencies (listed below) that make
it unsuitable for the fast-growing Internet.

1. Despite all short-term solutions, such as subnetting, classless addressing, address


depletion is still a long-term problem in the Internet.

2. The Internet must accommodate real-time audio and video transmission. This type of
transmission requires minimum delay strategies and reservation of resources not
provided in the IPv4 design.

3. The Internet must accommodate encryption and authentication of data for some
applications. No encryption or authentication is provided by IPv4.
An IPv6 address is 128 bits long.

Hexadecimal Colon Notation:

To make addresses more readable, IPv6 specifies hexadecimal colon notation.


In this notation,

128 bits is divided into eight sections, each 2 bytes in length. Two bytes in
hexadecimal notation requires four hexadecimal digits.

Therefore, the address consists of 32 hexadecimal digits, with every four digits
separated by a colon, as shown in Figure

19.63
IPv6 address in binary and hexadecimal colon notation

19.64
Abbreviated IPv6 addresses

19.65
Expand the address 0:15::1:12:1213 to its original.

Solution
We first need to align the left side of the double colon to
the left of the original pattern and the right side of the
double colon to the right of the original pattern to find
how many 0s we need to replace the double colon.

This means that the original address is.

19.66
Show the original (unabbreviated) form of the following addresses.

0: 1234::3
0::0

19.67
Datagram
Packets in the IPv4 layer are called datagram. Figure shows the IPv4 datagram format.

0 4 8 16 19 24 31

Ver HLen Service Type Total length

Identification Flag Fragment offset

TTL Protocol Header checksum

Source IP

Destination IP

IP Options if any
IP Header
 Ver: version of IP (4 or 6)
 HLen: total length of datagram header (20-60 bytes)
 Type of Service: how the datagram should be handled by
the router
0 4 7
Precedence D T R C

 Precedence: (3 bits) defines priorities in cases like congestion


 TOS bits: low delay, high throughput, high reliability, less cost. A hint to
router as a decision making factor for routing algorithms. Internet does not
guarantee to provide any particular type of service
IP Header (contd.)
 Total Length: defines total length of the datagram
in bytes.
 i.e. 216-1=65,535 bytes max. including header
 Length of data =total length - header length
IP Header (contd.)
 Identification: IP software keeps a global
counter and increments each time a new
datagram created.
 if the datagram is fragmented then the
identification is copied to each fragment of same
datagram
 Flags:
 3 bit field, D:do not fragment M: more fragment

U D M
IP Header (contd.)
 D=1: datagram must not be fragmented
 D=0: datagram can be fragmented
 M=1: It is not the last fragment
 M=0: It is the last or only fragment
 Fragmentation offset: It shows the relative position of the
fragment, w.r.t. whole datagram
IP Header (contd.)
 Time to Live: It specifies how long in seconds, the
datagram is allowed to remain in the internet system

 When a datagram arrives at a router, it records the time


and before sending forward it decrements the time to live
field.

 When it becomes zero, the datagram is discarded and an


error message is sent to the source
IP Header (contd.)
 Protocol: It defines the higher level protocol that uses the
IP layer service
 ICMP, IGMP, TCP, UDP etc.

 Header Checksum: Ensures the integrity of header values


 Divide the packet in to k section of 16 bits each

 All sections are added using ones complement method

 The final result is complemented to make checksum

 Follow the same method at receiver. If the result is


zero accept else discard the datagram
Example
An IPv4 packet has arrived with the first 8 bits as shown: 01000010 , The receiver
discards the packet. Why?

Example
In an IPv4 packet, the value of HLEN is 1000 in binary. How many bytes of options
are being carried by this packet?

Example
In an IPv4 packet, the value of HLEN is 5, and the value of the total length field
is Ox0028. How many bytes of data are being carried by this packet?
Example: 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 =O.

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.

19.76
Q. 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?

Ans: The first byte number is 100 x 8 = 800. The total length is 100 bytes, and
the header length is 20 bytes (5 x 4), which means that there are 80 bytes in
this datagram. If the first byte number is 800, the last byte number must be
879.

Q. Suppose a router receives an IP packet containing 600 data bytes and has to
forward the packet to a network with maximum transmission unit(MTU) of 200 bytes.
Assume that IP header is 20 bytes long. What are fragment offset values for divided
packets?
Solution-

Given-
MTU size of the destination network = 200 bytes
IP header length = 20 bytes

Now,
Maximum amount of data that can be sent in one fragment = 200 – 20 = 180 bytes.
Amount of data sent in a fragment must be a multiple of 8.
So, maximum data sent that can be in one fragment = 176 bytes.

Thus, 4 fragments are created-


1st fragment contains 176 bytes of data.
2nd fragment contains 176 bytes of data.
3rd fragment contains 176 bytes of data.
4th fragment contains 72 bytes of data

So,
Fragment offset value for 1st fragment = 0
Fragment offset value for 2nd fragment = 176 / 8 = 22
Fragment offset value for 3rd fragment = (176+176) / 8 = 44
Fragment offset value for 4th fragment = (176 + 176 + 176) / 8 = 66
Q. A datagram of 3000 bytes ( 20bytes IP header + 2980 bytes payload) reached at router
and must be forwarded to link with MTU of 500 bytes. How many fragments will be
generated and also write MF, offset , Total length value for all .

The original datagram was 3000 bytes, subtracting 20 bytes for header, that leaves 2980
bytes of data.

With an MTU of 500 bytes, 500 - 20 = 480 bytes of data may be transmitted in each packet
Therefore, ceiling(2980 / 480) = 7 packets are needed to carry the data.

Packet 1: ID=x, Total_len=500, MF=1, Frag_offset=0


Packet 2: ID=x, Total_len=500, MF=1, Frag_offset=60
Packet 3: ID=x, Total_len=500, MF=1, Frag_offset=120
Packet 4: ID=x, Total_len=500, MF=1, Frag_offset=180
Packet 5: ID=x, Total_len=500, MF=1, Frag_offset=240
Packet 6: ID=x, Total_len=500, MF=1, Frag_offset=300
Packet 7: ID=x, Total_len=120, MF=0, Frag_offset=360
Address Resolution Protocol (ARP)

Address Resolution Protocol (ARP) is one of the major protocol in the TCP/IP model
and the purpose of Address Resolution Protocol (ARP) is to map an IPv4 address (32
bit Logical Address) to the physical address (48 bit MAC Address).

Network Applications at the Application Layer use IPv4 Address to communicate with
another device. But at the Data link layer, the addressing is MAC address (48 bit
Physical Address), and this address is burned into the network card permanently.

The purpose of Address Resolution Protocol (ARP) is to find out the MAC address of a
device in your Local Area Network (LAN), for the corresponding IPv4 address, which
network application is trying to communicate.

80
ARP operation
ARP packet
The Format of ARP packet (cont’d)

 H/W Type: 16 bit field defines type of LAN e.g.


Ethernet=1
 Protocol Type: 16 bit field defining IP version e.g.
IPV4=0080016
 Hlen: 8 bit, length of hardware address e.g. Ethernet = 6
 Plen : 16 bit, length of logical address
 Operation : 8 bit, request=1, reply =2
Encapsulation of ARP packet
Reverse Address Resolution Protocol (RARP)

RARP finds the logical address for a machine that only knows its
physical address.

19.85
Note:

The RARP request packets are broadcast;

the RARP reply packets are unicast.

86
RARP operation
RARP packet
Internet Control Message Protocol (ICMP)

 The IP (Internet Protocol) relies on several


other protocols to perform necessary
control and routing functions:
 Control functions (ICMP)
 Multicast signaling (IGMP)
 Setting up routing tables (RIP, OSPF, BGP, PIM, …)

Routing
RIP OSPF BGP PIM

ICMP IGMP Control


Overview
 The Internet Control Message Protocol (ICMP) is a
helper protocol that supports IP with facility for
 Error reporting

 Simple queries

 ICMP messages are encapsulated as IP datagrams:

IP header ICMP message

IP payload

90
General format of ICMP messages

91
Note

ICMP always reports error messages to the original source.


Error-reporting messages

93
Destination-unreachable messages created only by the destination
host. Other destination-unreachable messages can be created only
by routers.

A source-quench message informs the source that a datagram has


been discarded due to congestion in a router or the destination host.
The source must slow down the sending of datagrams until the
congestion is relieved.

In a time-exceeded message, code 0 is used only by routers to


show that the value of the time-to-live field is zero.

19.94
Routing Protocols

1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
INTRODUCTION

An internet is a combination of networks connected by routers.


When a datagram goes from a source to a destination, it will
probably pass through many routers until it reaches the router
attached to the destination network.

2
INTER- AND INTRA-DOMAIN ROUTING

Today, an internet can be so large that one routing protocol cannot handle
the task of updating the routing tables of all routers. For this reason, an
internet is divided into autonomous systems.
An autonomous system (AS) is a group of networks and routers under the
authority of a single administration. Routing inside an autonomous system
is called intra-domain routing. Routing between autonomous systems is
called inter-domain routing

3
Autonomous systems

4
How does it work ?

Tx

• A certain “cost” or
“metric” is assigned
each network
• In figuring out the best
Rx route from Tx to Rx,
the set of networks
with the smallest sum
is chosen
• More generically, the
set of networks best
meeting the “metric’s”
objective is chosen

5
Popular routing protocols

• RIP – Routing Information Protocol – treats each network the same


(assigns the same cost for each network)
• OSPF – Open Shortest Path First protocol – assigns a cost for passing
through a network based on the type of service required – routes
through the network can have different cost – each router would have
several tables
• BGP – Border Gateway Protocol – is an exterior routing protocol that
uses a policy that defines what paths should be chosen

6
Routing Protocols vs. Algorithms

 Routing protocols allow routers to share info with one another


dynamically - as the Internet makes changes, the routing protocols allow
routers to inform other routers
 Routers communicate to their neighboring routers .
 Routing protocols implement the procedures for combining info
received from other routers

 Routing Algorithms – decision making analysis – the “brains” – using the


info provided

TCP/IP Protocol Suite 7


Routing Information Protocol(RIP)

 It is based on Distance Vector routing, which uses Bellman-Ford


algorithm for calculating the routing table
 Distance Vector Routing
 In this scheme, each router periodically (30s) shares
(broadcasts) its own routing information with its neighbours
 Every router keeps a routing table that has three columns in its

simplest form for each entry about a network

TCP/IP Protocol Suite 8


RIP Algorithm

Receive: a response RIP message


1. Add one hop to the hop count for each advertised
destination.
2. Repeat the following steps for each advertised destination:
1. If (destination not in the routing table)
1. Add the advertised information to the table.
2. Else
1. If (next-hop field is the same)
1. Replace entry in the table with the advertised one.
2. Else
1. If (advertised hop count smaller than one in the table)
1. Replace entry in the routing table.
3. Return.

9
Example
Initialization of Tables in Distance Vector Routing

10
Sharing Routing Table

 Idea of distance vector routing


 Sharing of information between neighbors
 In distance vector routing, each node shares its routing table with its
immediate neighbors periodically and when there is a change
 How much of the table must be shared ?
 Send the entire table but contains only the first two columns
 The third column must be changed

TCP/IP Protocol Suite 11


Updating in Distance Vector Routing

Reach A via C

12
RIP

The Routing Information Protocol (RIP) is an intra-domain (interior) routing


protocol used inside an autonomous system. It is a very simple protocol
based on distance vector routing. RIP implements distance vector routing
directly with some considerations.

13
Example of a domain using RIP

14
Q. Design a routing table for router Rl

TCP/IP Protocol Suite 15


TCP/IP Protocol Suite 16
Find the topology of the network if the given table is the routing table for router R1.

Routing table of R1

TCP/IP Protocol Suite 17


Note

RIP uses the services of UDP on well-


known port 520.

TCP/IP Protocol Suite 18


LINK STATE ROUTING

Link state routing has a different philosophy from that of distance vector routing. In
link state routing, if each node in the domain has the entire topology of the
domain—the list of nodes and links, how they are connected including the type,
cost (metric), and the condition of the links (up or down)—the node can use the
Dijkstra algorithm to build a routing table.

TCP/IP Protocol Suite 19


Formation of Shortest Path Tree: Dijkstra Algorithm

20
Concept of Link state routing

TCP/IP Protocol Suite 21


Link state knowledge

TCP/IP Protocol Suite 22


Example of formation of shortest path tree

23
Forming shortest path three for router A in a graph

TCP/IP Protocol Suite 24


Continued

TCP/IP Protocol Suite 25


Figure 11.19 Continued

TCP/IP Protocol Suite 26


Example
Display shortest path tree for each node

TCP/IP Protocol Suite 27


Example

TCP/IP Protocol Suite 28


OSPF

The Open Shortest Path First (OSPF) protocol is an intra-


domain routing protocol based on link state routing. Its
domain is also an autonomous system.

TCP/IP Protocol Suite 29


Areas in an autonomous system

• Divide autonomous system (AS) into areas


• Routers with in an area floods the area with routing info – router sends to all it’s
neighbors and each neighbor sends to all it’s neighbors and etc..
• At the border of an area, special routers called area border routers are used to (1)
summarize info about an area and (2) send info amongst areas
• A special area called the backbone is used to tie together all of the areas – backbone is
primary area and all other areas are secondary areas – backbone area uses backbone
routers. Each area has an ID (backbone’s Id is 0)

TCP/IP Protocol Suite 30


OSPF: Open Shortest Path First
 The OSPF is similar to RIP however, it allows the admin the ability to
assign a cost or metric to each route.

 The metric can be based on a type of service (ie . Min delay, max
throughput, etc..)

 Unlike RIP, sharing or updating is done when there is a change (not


periodically)

 For OSPF, the objective is for the routers to contain the full picture or
topology of the Internet – by having this, the router can figure out the
“shortest path” or “least cost” route between itself and each network

 To do this, the Internet is represented by a graph – set of edges and nodes

TCP/IP Protocol Suite 31


Types of links

TCP/IP Protocol Suite 32


Defining edges or connections/links

Point-to-point link
Virtual link

Direct connection between


two routers, no IP address When link between two routers are
needed broken, admin creates a new route
across multiple routers
Bi-directional Edge

Transient link
Stub link

Represents
the Connects to only one router –
network packets enter and leave through this
same router

TCP/IP Protocol Suite 33


Figure 11.26 Example of an AS and its graphical representation in OSPF

TCP/IP Protocol Suite 34


Building Routing Table

1. Create the initial state of the links of each node.

2. Disseminate the link state package (LSP) to every other


router, called flooding.

3. Construct a shortest path tree for each node (Dijkstra


Algorithm).

4. Calculate a routing table based on the shortest path tree.

TCP/IP Protocol Suite 35


Routing Table based on Shortest Path Tree

TCP/IP Protocol Suite 36


Figure 11.50 Reachability

TCP/IP Protocol Suite 37


Figure 11.51 Stabilized table for three autonomous system

TCP/IP Protocol Suite 38


Figure 11.52 Routing tables after aggregation

TCP/IP Protocol Suite 39


BGP

Border Gateway Protocol (BGP) is an interdomain


routing protocol using path vector routing. It first
appeared in 1989 and has gone through four
versions.

TCP/IP Protocol Suite 40


Note

BGP uses the services of TCP


on port 179.

TCP/IP Protocol Suite 41


Summaries:

 To introduce the idea of autonomous systems (ASs) that divide the Internet into smaller
administrative regions.
 To discuss the idea of distance vector routing and the RIP that is used to implement the
idea.
 To discuss the idea of link state routing as the second intra-AS routing method and
OSPF that is used to implement the idea.
 To discuss the idea of path vector routing as the dominant inter-AS routing method and
BGP that is used to implement the idea.

TCP/IP Protocol Suite 42


TCP/IP Protocol Suite 43
TRANSPORT LAYER
Transport Layer

The Transport layer is responsible for the delivery of a message


from one process to another.
Process to process means:
It is not just a source to destination delivery i.e from one computer to
another.
It is a delivery from a specific process on one computer to a specific
process on the other.
What a Network layer actually does?

It oversees source-to-destination delivery of individual


packets , it does not recognize any relationship
between those packets.
It treats each one independently , as though each
piece belongs to a separate message.
How transport layer differ from
network layer?

The transport layer , ensures that the whole message


arrives intact and in order , overseeing both error control
and flow control at the source –to-destination level.
Transport
Layer
Transport layer protocol
• A transport layer protocol can be
either connectionless or connection-
oriented.
• UDP-Connectionless protocol-Simple
• TCP-Connection oriented protocol-Complex
• SCTP-Connection oriented protocol-Designed for
Multimedia application
• (Stream control transport protocol)
SEGMENT
• In the Transport layer a message is normally
divided into transmittable segment.
• UDP treats each segment separately
• TCP creates a relationship between the
segments using sequence numbers.
Connectionless transport layer
• A connectionless transport layer treats each
segment as an independent packet and
delivers it to the transport layer at the
destination machine.
• The packets are not numbered ; they may be
delayed or lost or may arrive out of sequence.
• There is no acknowledgement either.
• UDP is connectionless…
Connection –oriented transport layer
• A connection oriented transport layer makes a
connection with the transport layer at the
destination machine first before delivering the
packets.
• After all the data is transferred , the
connection is terminated.
• TCP and SCTP are Connection oriented…
Reliable versus unreliable
Transport layer service can be reliable or unreliable
• If the application layer program needs reliability,
TCP &SCTP protocol will implement flow and
error control at the transport layer . But it is
slower and more complex service.
• If the application layer program does not need
reliability, it means most real-time application
does not demand flow and error control,but it
demand fast service. So unreliable protocol UDP
is used.
Question arises?
• If the data link layer is reliable and has
flow and error control , do we need this
at transport layer too?
Answer
YES
• Reliability at the data link layer is between two nodes.
• we need reliability between two ends .
• Because the network layer in the internet is unreliable.
• So we need to implement reliability at the transport layer.
Types of data delivery

The transport layer is responsible for


process-to-process delivery.
Addressing
• At the Data link layer, we need a MAC address
to choose ONE node among SEVERAL node.
• At the Network layer we need an IP address to
choose one Host among Millions.
• At the Transport layer we need a transport
layer address called a PORT NUMBER ,to
choose among multiple processes running on
the destination host.
• Destination port number for delivery; source port no for the reply
Port number
• Port number for a client host program
defines itself randomly by the transport
layer, this is called ephemeral port number
ranging from 49,152 to 65,535
• Port number for servers are universally
assigned by (internet assigned
number authority) called well-known
port number ranging from 0 to 1023
Socket address
• Process to process delivery needs two
identifiers , IP address and port number at
each end to make a connection.
• The combination of IP address and a Port
number is called a socket address
• Client socket address defines the client process uniquely.
• Server socket address defines the server process uniquely
Socket address
 It is a 48 bit address .
It is a combination of both IP Address and port number.
UDP
• The User Datagram Protocol (UDP) is called a
connectionless , unreliable transport protocol.
• UDP is so powerless , it perform process to
process communication with very limited
error checking.
• If a process wants to send a small message
and does not care much about reliability , it
can use UDP
User datagram format
• UDP packets , called User datagrams , have a
fixed-size header of 8 byte.
Source Port Number
• This is the Port number used by the process
running on the machine
• It is 16 bit long ,means port number can range from
0 to 65,535.
• If the source host is client an ephemeral port number
is chosen by the UDP for that particular process
requested.
• If the source host is server the port number is a well-
known port number.
Destination Port Number
• This port number used by the process
running on the destination host.
• It is also 16 bit long
• If the destination host is a server(client sending a
request)the port number ,is a well known port
number most case.
• If the destination host is the client(a server
sending a response),the port number is an
ephemeral port number most case.
3.LENGTH :
• This is a 16 bit field that defines the
total length of the user datagram ,
Header plus Data.
4.CHECKSUM
• This field is used to detect errors over
the entire user datagram(header plus
data)
A client has a packet of 68,000 bytes. Show how this packet can be transferred
by using only one UDP user datagram.

A client uses UDP to send data to a server. The data are 16 bytes. Calculate the
efficiency of this transmission at the UDP level (ratio of useful bytes to total bytes).

The following is a dump of a UDP header in hexadecimal format.


0632000DOO lCE217

a. What is the source port number?


b. What is the destination port number?
c. What is the total length of the user datagram?
d. What is the length of the data?
e. Is the packet directed from a client to a server or vice versa?
UDP Checksum
UDP checksum includes three sections:
• A pseudo header
• UDP header
• Data coming from application layer.
Pseudo Header:
• It is a part of the IP packet header in which
user datagram is encapsulated.
• The reason for including Pseudo Header in
checksum is to save IP header from corrupt.
Protocol :
• The protocol field is added to ensure that the
packet belongs to UDP , not to other transport
layer protocol . value of UDP is 17.
• If this value changes during transmission , the
checksum calculation at the receiver will detect it
and UDP drops the packet . It is not delivered to
the wrong protocol.
Checksum calculation of a simple UDP user datagram
TRANSMISSION CONTROL PROTOCOL(TCP)
Introduction to TCP
 TCP is called a connection oriented , reliable transport protocol. It creates
a virtual connection between two TCPs to send data.

It is a process to process protocol. It uses port numbers. In addition, TCP


uses flow and error control mechanism at the transport level.

It adds connection-oriented and reliability features to the services of IP.


Services provided by the TCP as follows:

1. Process-to-Process Communication :
2. Stream oriented
3. Full duplex service
4. Connection oriented service
5. Reliability
6. Multiplexing
TCP Segment format
Source port address: This is a 16-bit field that defines the port number of the
application program in the host that is sending the segment.

Destination port address: This is a 16-bit field that defines the port number of the
application program in the host that is receiving the segment.

Sequence number: This 32-bit field defines the number assigned to the first byte of data
contained in this segment. During connection establishment, each party uses a random
number generator to create an initial sequence number (ISN), which is usually different
in each direction.

Acknowledgment number: This 32-bit field defines the byte number that the receiver of the
segment is expecting to receive from the other party. If the receiver of the segment has
successfully received byte number x from the other party, it defines x + I as the
acknowledgment number.

Header length: This 4-bit field indicates the number of 4-byte words in the TCP header.
The length of the header can be between 20 and 60 bytes. Therefore, the value of this
field can be between 5 (5 x 4 =20) and 15 (15 x 4 =60).
Reserved: This is a 6-bit field reserved for future use.
Control: This field defines 6 different control bits or flags as shown in below. One or more
of these bits can be set at a time.

Window size: This field defines the size of the window, in bytes, that the other party must
maintain. The maximum size of the window is 65,535 bytes. This value is normally
referred to as the receiving window (rwnd) and is determined by the receiver.

Checksum: This 16-bit field contains the checksum. The calculation of the checksum for
TCP follows the same procedure as the one described for UDP.
Urgent pointer: This l6-bit field, which is valid only if the urgent flag is set, is used when
the segment contains urgent data. It defines the number that must be added to the
sequence number to obtain the number of the last urgent byte in the data section of the
segment.
Options: There can be up to 40 bytes of optional information in the TCP header.

Suppose a TCP connection is transferring a file of 5000 bytes. The first byte is numbered
1O,00l. What are the sequence numbers for each segment if data are sent in five
segments, each carrying 1000 bytes?
Solution:
The following shows the sequence number for each segment:

Segment 1 Sequence Number: 10,001 (range: 10,001 to 11,(00)


Segment 2 Sequence Number: 11,001 (range: 11,001 to 12,000)
Segment 3 Sequence Number: 12,001 (range: 12,001 to 13,000)
Segment 4 Sequence Number: 13,001 (range: 13,001 to 14,000)
Segment 5 Sequence Number: 14,001 (range: 14,001 to 15,000)
TCP Connection Management

TCP connection oriented transmission requires three phases:


• Connection Establishment
• Data Transfer
• Connection termination
Connection Establishment

TCP transmits data in full-Duplex mode .When two TCP’s in two machines are connected ,
they are able to send segment to each other simultaneously.
So each party must initialize communication and get approval from other party before
any data are transferred. The connection establishment in TCP is called Three way
handshaking
Connection establishment using three-way handshake

48
1.The client sends the first segment , a SYN segment, in which only the
SYN flag is set . This segment is for synchronization of sequence
numbers.
2.The server sends the second segment , a SYN+ACK segment , with 2 flag bits
set: SYN & ACK . This segment has dual purpose.
I ) Synchronization of sequence number in the other direction.
II) Acknowledgment for the client SYN segment

3.The client sends the third segment . this is just an ACK segment . It
acknowledges the receipt of the second segment with the ACK flag and
Acknowledgment number.
Data Transfer

TCP/IP Protocol Suite 50


Connection termination using three-way handshake

51
Connection termination

Any of the two parties involved in exchanging data (client or server) can close the
connection , but usually initiated by client.
1. If the client process wants to stop it send a close command to the client TCP , after
receiving a close command from the client process, TCP sends a FIN segment in which
the FIN flag is set . The FIN segment can include last chunk of data sent by the client.
2. The server TCP ,after receiving the FIN segment informs its process about the
situation and sends the second FIN segment ,a FIN +ACK segment, to confirm
the receipt of FIN segment from the client and at the same time to announce
the closing of the connection in other direction. This segment can also contain
the last chunk of data from the server.

3. The client TCP sends the last segment , an ACK segment , to confirm the
receipt of the FIN segment from the TCP server . this segment contains the
acknowledgment number , which is 1 plus the sequence number received in
the FIN segment from the server.
TCP-FLOW CONTROL
• TCP uses sliding window to handle the flow control.
• TCP sliding window looks like the Go-Back-N protocol because it
does not use NAKs ; it looks like selective repeat because the
receiver holds the out of order segment until the missing one
arrives.
Difference between TCP-sliding window and data
link layer sliding window
TCP-SLIDING WINDOW DATA LINK LAYER-SLIDING
WINDOW
Sliding window of TCP is byte oriented Sliding window of data link layer is
frame oriented
TCP sliding window is variable size Data link layer sliding window is fixed
size
• The bytes inside the window are the bytes that can be
transit ; they can be sent without worrying about
acknowledgment
• The window has two wall : one left and one right
• The window is opened , closed or shrunk . this activities are
in the control of receiver , not the sender . The sender should
obey.
……
• Opening a window means… moving the right wall to
the right . This allows more new bytes in the buffer
that are eligible for sending.
• Closing the window means moving the left wall to
the right . This means that some bytes have
been acknowledged and the sender need not
worry about them anymore.
• Shrinking the window means moving the right
wall to the left . this means revoking the
eligibility of some bytes for sending.
• Receiver window( rwnd) : It is the number of bytes
the other end can accept before its buffer
overflow
• Congestion window: The value in congestion
window is determined by the network to avoid
congestion.
Example of sliding
window
Error control
• Error control includes mechanism for:
Detecting corrupted segment , Lost segment , out-
of-order segments and duplicate segment
. Error control also includes a mechanism for
correcting errors after they are detected.
Error detection and correction in TCP is
achieved through three simple tools:
Checksum , acknowledgment , Time out.
Checksum
• TCP use 16-bit checksum that is mandatory in
every segment.
• The checksum field in a segment is used to
check the corrupted segment . If the segment is
corrupted , it is discarded by the destination
TCP.
Acknowledgment
• TCP uses acknowledgment to confirm
the receipt of data segment.
• Control segment that carry no data but
only the sequence no also
acknowledged.
• ACK segment are never acknowledged.
Retransmission

• The heart of the error control mechanism is retransmission of the


segment . when a segment is corrupted , lost, or delayed , it is
retransmitted.
In recent TCP implementation ,retransmission is occurs ,when a
retransmission timer expires or when the sender receives three duplicate
ACKs,
Retransmission after RTO
• Recent implementation TCP maintains one
retransmission time-out(RTO) timer for all
outstanding(sent , but not acknowledged)
segments.
• When the timer expires , the earliest outstanding
segment is retransmitted even though lack of ACK is due
to delayed segment , a delayed ACK , or a lost ACK,
• RTO timer will never set for a segment that
carries only an acknowledgment.
Retransmission after three duplicate
ACK segments
• TCP was originally designed to discard all out –of- order
segments , resulting in retransmission of the missing
segment and then following segment.
• But in today’s implementation out-of-order segments
are not discarded instead they store them temporarily
until the missing arrives , but if the buffer exceeds
problem arise.
• To alleviate this situation , today’s implement follows
three-duplicate-ACK rule and retransmit the missing
segment immediately . This is called Fast
retransmission.
Domain Name System (DNS)

1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
DNS

It is a Internet Directory Service.


A client-server application that maps hostnames into their corresponding IP addresses.
Mapping hostnames into their corresponding IP addresses is called name resolution or name
translation or name mapping or Address Resolution.

To identify an entity, TCP/IP protocols use the IP address, which uniquely identifies the connection of
a host to the Internet. However, people prefer to use names instead of numeric addresses.
Therefore, we need a system that can map a name to an address or an address to a name.

TCP/IP Protocol Suite 2


TCP/IP Protocol Suite 3
TCP/IP Protocol Suite 4
TCP/IP Protocol Suite 5
TCP/IP Protocol Suite 6
TCP/IP Protocol Suite 7
Domain names and labels

TCP/IP Protocol Suite 8


TCP/IP Protocol Suite 9
TCP/IP Protocol Suite 10
FQDN and PQDN

TCP/IP Protocol Suite 11


Domains

TCP/IP Protocol Suite 12


Hierarchy of name servers

TCP/IP Protocol Suite 13


DNS used in the Internet

TCP/IP Protocol Suite 14


Generic domains

It defines the registered hosts according to their generic behavior.


Each node in a tree defines the domain name, which is an index to the DNS database.
It uses three-character labels, and these labels describe the organization type.

15
TCP/IP Protocol Suite 16
Country domains

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

TCP/IP Protocol Suite 17


Inverse domain

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

TCP/IP Protocol Suite 18


RESOLUTION

Mapping a name to an address or an address to a name is called name-address


resolution.

Recursive Resolution:
The resolver asks for a recursive answer from a DNS server.
The server must respond with the complete answer.
If it does not know the answer the server itself asks a parent server in the hierarchy.
If the parent does not know, the parent asks a higher level server in the hierarchy.
Eventually the resolver will be told the answer by the first DNS server the resolver
contacted.

Iterative Resolution:
If client does not specify a recursive answer, client will get an iterative answer.
This means if the first server contacted does not know the answer, the server returns
the IP address of what the server thinks is a smarter server.
This continues until the answer is found.

19
Recursive queries root DNS server

2 3

7 6
TLD DNS server

local DNS server


dns.poly.edu 5 4

1 8

authoritative DNS server


dns.cs.umass.edu
requesting host
cis.poly.edu

gaia.cs.umass.edu
Iterative Queries root DNS server

2
3
TLD DNS server
4

local DNS server


dns.poly.edu
7 6
1 8

authoritative DNS server


dns.cs.umass.edu
requesting host
cis.poly.edu

gaia.cs.umass.edu
Socket Programming

Data types and structures for writing client-


server programs
Client/Server Model
How 2 application programs make contact
Server Client
•Starts first •Starts second
•Passively waits for •Actively contacts a
contact from a client server with a request
at a prearranged
•Waits for response
location
from server
•Responds to
requests
• Client-server paradigm: form of communication used
by all network applications
Characteristics of a Client
• Arbitrary application program
• Becomes client temporarily
• Can also perform other computations
• Invoked directly by user
• Runs locally on user’s computer
• Actively initiates contact with a server
• Contacts one server at a time
Characteristics of a Server
• Special-purpose, privileged program
• Dedicated to providing one service
• Can handle multiple remote clients simultaneously
• Invoked automatically when system boots
• Executes forever
• Needs powerful computer and operating system
• Waits passively for client contact
• Accepts requests from arbitrary clients
Direction of Data Flow
• Data can flow
– from client to server only
– from server to client only
– in both directions
• Application protocol determines flow
• Typical scenario
– Client sends request(s)
– Server sends responses(s)
Server and clients

TCP Server
socket()

bind()

TCP Client listen()

socket() accept()
connection establishment
connect()
data request read()
write()

data reply write()


read()
read()
close() end-of-file notification
6
close()
Some definitions
• Data types
int8_t signed 8-bit integer
int16_t signed 16-bit integer
int32_t signed 32-bit integer
uint8_t unsigned 8-bit integer
uint16_t unsigned 16-bit integer
uint32_t unsigned 32-bit integer
More Definitions
• Internet Address Structure
Socket address structure
Socket Structure
Socket Creation in C

• int s = socket(domain, type, protocol);


– s: socket descriptor, an integer (like a file-handle)
– domain: integer, communication domain
• e.g., PF_INET (IPv4 protocol) – typically used
– type: communication type
• SOCK_STREAM: reliable, 2-way, connection-based service
• SOCK_DGRAM: unreliable, connectionless,
• other values: need root permission, rarely used, or obsolete
– protocol: specifies protocol (see file /etc/protocols for a
list of options) - usually set to 0

NOTE: socket call does not specify where data will be coming from, nor
where it will be going to - it just creates the interface.
11
The bind function

• The bind function associates and (can exclusively)


reserves a port for use by the socket
• int status = bind(sockid, &addrport, size);
– status: error status, = -1 if bind failed
– sockid: integer, socket descriptor
– addrport: struct sockaddr, the (IP) address and port of the
machine (address usually set to INADDR_ANY – chooses
a local address)
– size: the size (in bytes) of the addrport structure

12
Server Socket: listen & accept

Called on server side:


• int status = listen(sock, queuelen);
– status: 0 if listening, -1 if error
– sock: integer, socket descriptor
– queuelen: integer, # of active participants that can “wait” for
a connection
– listen is non-blocking: returns immediately

• int s = accept(sock, &addr, &addrlen);


– s: integer, the new socket (used for data-transfer)
– sock: integer, the orig. socket (being listened on)
– addr: struct sockaddr, address of the active participant
– addrlen: sizeof(addr): value/result parameter
• must be set appropriately before call
• adjusted by OS upon return
13
connect
• int status = connect(sock, &addr, addrlen);
– status: 0 if successful connect, -1 otherwise
– sock: integer, socket to be used in connection
– addr: struct sockaddr: address of passive participant
– addrlen: integer, sizeof(addr)

14
Socket programming with UDP
UDP: no “explicit connection”
between client and server
• no handshaking
• sender explicitly attaches IP
address and port of destination
to each packet application viewpoint
• server must extract IP address, UDP provides unreliable transfer
port of sender from received of groups of bytes (“datagrams”)
packet between client and server
UDP: transmitted data may be
received out of order, or lost

15
Client/server socket interaction: UDP

Server Client

Socket() Socket()

sendto()
bind()
recvfrom()
recvfrom()
close()
sendto()

close()
16
CN-Lab-5th Dec-2020

Q. Write the program to transfer the content of a text file from


client to server using UDP socket.
Client Program
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

void error(char *msg)


{
perror(msg);
exit(0);
}

int main(int argc, char *argv[])


{
int sockfd, portno, n;
struct sockaddr_in serv_addr;
int n1,n2,res;

char buffer[256];
if (argc < 3) {
fprintf(stderr,"usage %s hostname port\n", argv[0]);
exit(0);
}
portno = atoi(argv[2]);
Contd…..
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0)
error("ERROR opening socket");

bzero((char *) &serv_addr, sizeof(serv_addr));


serv_addr.sin_family = AF_INET;

serv_addr.sin_port = htons(portno);

// if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0)
// error("ERROR connecting");

printf("Please enter the message: ");


bzero(buffer,256);
fgets(buffer,255,stdin);
n = sendto(sockfd,buffer,strlen(buffer),0,(struct sockaddr_in *)&serv_addr,sizeof(serv_addr)
if(n<0)
error(“ Error in writing to socket);

|return 0
}
Server Program
#include <stdio.h>
#include<string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

void error(char *msg)


{
perror(msg);
exit(1);
}

int main(int argc, char *argv[])


{
int sockfd, newsockfd, portno, clilen;
char buffer[256];
struct sockaddr_in serv_addr, cli_addr;
int n;
if (argc < 2) {
fprintf(stderr,"ERROR, no port provided\n");
exit(1);
}
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
bzero((char *) &serv_addr, sizeof(serv_addr));
portno = atoi(argv[1]);
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(portno);
if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
error("ERROR on binding");

// listen(sockfd,5);

clilen = sizeof(cli_addr);

bzero(buffer,256);

n = recvfrom(sockfd,buffer,255,0,(struct sockaddr_in *)&cli_addr,&clilen);

if (n < 0) error("ERROR reading from socket");


printf("Here is the message: %s\n",buffer);

close(sockfd);

return 0;

}
Wireless LANS
 Defined by IEEE 802.11 & Bluetooth
 The standard 802.11 defines two kinds of services
 Basic Service Set(BSS): the basic building block of WLan
 Extended Service Set(ESS): communicating among BSSs
 Basic Service Set
 Is made of stationary or mobile wireless stations and an optional
central base station known as Access Point (AP)
Service Sets
 The BSS without AP is a stand alone network and can’t send data
to other BSSs
 It is called an Ad hoc Network or Infrastructure Less Network
 An BSS with an AP is called Infrastructure based network
 Extended Service Sets

 Is made up of two or more BSSs


with Aps
 Communication between two
stations in two different BSSs
usually occurs via two Aps
 APs are connected via
distribution System
Station types
• Three types of stations are defined based on
their mobility
– No-transition
• is either stationary or moving only inside a BSS
– BSS-transition
• can move from one BSS to another, but the movement
is confined to one ESS
– ESS-transition
• can move from one ESS to another. But standard does
not guarantee the continuity in communication
MAC sub-layers in IEEE
802.11
 Defines two MACs and is called as Distributed Foundation Wireless
Medium Access Control (DFWMAC)

 Distributed coordination function(DCF)

 The CSMA/CD access method of ethernet fails in


wireless medium
 so it uses the basic method CSMA/CA and an optional
method avoiding hidden terminal problem

 Point coordination function (PCF)


 uses contention free polling method by AP for time
bounded service
Motivation for CSMA/CA
• WLANs cannot implement CSMA/CD because
– It requires that the station must be able to send data
and receive collision at the same time. (i.e. two paths
and increased BW!)
– Collision may not be detected due to hidden terminal
problem
– Signal fading could prevent a station at one end from
hearing a collision from other end called Exposed
terminal problem
Hidden and Exposed terminals
• Hidden terminals
– A sends to B, C cannot receive A
– C wants to send to B, C senses a “free” medium (CS fails)
– collision at B, A cannot receive the collision (CD fails)
– A is “hidden” for C

 Exposed terminals A B C

 B sends to A, C wants to send to another terminal (not A


or B)
 C has to wait, CS signals a medium in use

 but A is outside the radio range of C, therefore waiting is


not necessary
MACA – Multiple Access Collision Avoidance
• Use of additional signaling packets
– Sender asks receiver whether it is able to receive a
transmission - Request to Send (RTS)
– Receiver agrees, sends out a Clear to Send (CTS)
– Sender sends, receiver Acknowledgements (ACKs) B
A
C

A RTS 3 DATA

CTS
1 2
B 4 ACK

time
Detect
Collision
Find Transmission
Complete
Exposed Terminal Problem
The sender mistakenly think the
medium is in use, so that it
unnecessarily defers the
transmission.

S1 S2
R1 R2

R1 CTS

1 2 3
S1 RTS DATA

S2 Find medium in use

R2 Wait until medium is clear


time
MACA – continued
• When a node hears an RTS from a
neighboring node, but not the
corresponding CTS, that node can
deduce that it is an exposed terminal S1 S2
and is permitted to transmit to other
R1 R2
neighboring nodes.

R1 2 CTS

1 5
S1 RTS DATA

Exposed
Terminal S2 RTS

3 4
R2 CTS 6 DATA

time
Inter-frame spacing times
• 802.11 MAC uses three different parameters for waiting
time that define the priorities of medium access
– Short inter-frame spacing(SIFS): shortest waiting time and
hence highest priority is defined for control messages like
ACK ,it is 28s
– PCF inter-frame spacing(PIFS): A medium priority waiting time
used. Defined as SIFS plus one slot time
– DCF inter-frame spacing(DIFS): longest waiting time and has
the lowest priority for medium access. Used for data service
within a contention period Defined as SIFS plus two slot times
– Slot time is 50s.
Process CSMA with CTS and RTS
 Before sending a frame source senses the medium
 Channel uses a persistent strategy with back-off

until the channel is idle

 Station now waits for a period of time called


the Inter-Frame Space; then sends a control
frame called RTS (request to send)

• After receiving the RTS and waiting a short period of


time called short inter-frame space, the destination
station sends a control frame called CTS(clear to Send)

 Source sends data after waiting an amount of time equal


to SIFS
 Destination waits for SIFS before sending ACK
CSMA/CA flowchart
Process Collision Avoidance
• When station sends RTS frame, it includes the
duration of the time that it needs to occupy
the channel
• The stations that are affected by this
transmission create a timer called NAV.
• Each other station first checks NAV before
sensing the channel

 If two or more stations try to send RTS at the same time and
there is a collision, then sender tries again if it does not receive
CTS
 As the wireless medium is noisy, It is more efficient to replace a
large frame with some smaller frames.
Bluetooth

• Is a wireless LAN technology designed to connect devices of different


functions such as telephones, notebooks, computers, cameras, printers,
coffee makers, and so on
• A Bluetooth LAN can be connected to Internet if one of the gadgets has this
capability
• It can not be large
• This technology can be used to connect peripheral devices to computer,
monitoring devices can be connected to sensors etc.
• Today the Bluetooth technology is the implementation of a protocol defined
by 802.15 and is called WPAN that is operable in a small area with small
number of devices
Bluetooth

• A Bluetooth network is called a piconet and needs no infrastructure, this type


of WPANS may be used in various scenarios
– Connection of peripheral devices to a desktop
– Support of ad-hoc networking
• e.g. teacher distributing data to students PDAs inside the class
– Bridging of networks
• Using piconets, a mobile phone can be connected to a PDA or laptop.
The mobile phone can now act as a bridge between local piconet and
GSM
• Bluetooth is designed to provide local wireless access at very low cost with a
limited BW and without any extra infrastructure
Bluetooth Architecture
• Operates on 79 channels in 2.4GHz band with 1MHz carrier spacing
• Each device performs frequency hopping with 1600 hops/sec in a pseudo
random fashion
• A piconet is a collection of Bluetooth devices which are synchronized to the
same hopping sequence with following properties

 Can have up-to eight stations, one of


which is called the Master, rest are slaves
 Master determines hopping pattern
 Communication may be on-to-one, or
one-to-many

 An additional eighth slave may be in parked state, i.e. cant participate actively in
piconet
 The limit is eight because the address field contains 3 bits and any parked device can
be active if one of the seven slaves goes to parked state
Bluetooth Architecture
• A group of piconets is combined to form a scatternet and can accommodate
more devices.
• Different piconets in a scatternet use different hopping sequences
• One device may participate in more than one piconet one at a time

 A master of one piconet can


act as a slave in other piconet
but one cant be master in two
piconets

 communication between different piconets takes place by devices


jumping back and forth between these nets
 however scatternets are not yet supported by all devices
Multiplexing
• It is not practical to have a separate line for each other device
we want to communicate
• Therefore, it is better to share communication medium
• The technique used to share a link by more than one device is
called multiplexing
• Multiplexing needs that the BW of the link should be greater
than the total individual BW of the devices connected.
• In a multiplexed system one link may contain more than one
channel
Categories of multiplexing
Frequency Division Multiplexing
• FDM is an analog
multiplexing technique
that combines signals
• Signals generated by
each device modulate
different carrier
frequencies
• These modulated
signals are combined
to form a composite
signal
• Demultiplexer uses a
series of filters to
decompose the signal
into its component
signals
FDM
f

t
• Carrier frequencies are separated by sufficient BW to
accommodate modulated signal
•These BW ranges are channels through which the
various signal travel
• Channels must be separated by strips of unused BWs
(called Guard Bands) to prevent signals from
overlapping
• Carrier frequencies must not interfere with the
original signals
Time division Multiplexing
• Each shared connection occupies a portion of time
but uses full BW f

 The data flow of each connection


is divided into units
 For n input connections, a frame t
is organised into a minimum of n

units
Each slot
carrying one
unit from
each section
 Data rate of
the link has to
be n times
the data rate
of one unit
Time division Multiplexing contd.
• If the data rate of a link is 3 times the data rate of a
connection
• then the duration of a unit on a connection will be 3
times that of a time slot
Switching
• To connect multiple devices over a distance we
adopt a method called switching
• Switches are hardware and/or software devices
capable of creating temporary connections as
per requirements
• A switched network consists of a series of
interlinked switches
• Switching Methods
– Circuit switching
– Packet switching
Circuit Switching
• It creates a direct physical connection between two
devices i.e. it establishes a physical circuit before
transmission
 It uses a device
with n I/P s
and m O/Ps

 Circuit Switching Techniques


 Space Division Switches

 Crossbar switch, multistage switch

 Time division switches

 Time Slot Interchange, TDM Bus


Crossbar switch
• It connects n I/Ps and m O/Ps in a grid
• Each cross point consists of a electronic switch

• The order of switch required is huge O(nm)


• It is impractical because of the size of the crossbar
• It is also inefficient because in practice 25% of the
switches are used at a given time
Packet Switching
• Circuit switching are best suited for voice
communication, as data communication are bursty in
nature i.e. data transmitted in blocks with gaps between
them
• A circuit switched link assumes a single data rate for both
devices
• In Circuit switching all transmissions are equal, priority
base communication is not allowed
• In Packet switching data transmitted in discrete units
called packets
• There are two approaches for packet switching
– Datagram approach, and Virtual Circuit approach
Datagram Approach

 In this approach each packet treated independently called


datagrams
 Each datagram contains appropriate information about the
destinations and the network carries the datagrams
towards destination
 Datagrams may reach at destination out of order
 The links joining each pair of nodes may contain multiple
channels. Each of these channels is capable of carrying
datagrams from several sources or from a single source
Virtual Circuit Approach
• In this approach the relationship between all packets belonging
to a message is preserved
• A single route is chosen between sender and receiver at the
beginning of session
• All packets now travel one after another along the same route
• It is implemented in two formats
– Switched Virtual Circuit (SVC), and Permanent Virtual Circuit (PVC)
• Switched Virtual Circuit
– A Virtual Circuit is created whenever it is needed (e.g. TCP’s three way
handshake) and exists for the duration of the specific exchange
– Each time a device makes a connection to another device, the route may
be same or may differ in response to varying network conditions
• Permanent Virtual Circuit
– The same virtual circuit is provided between two users on a contineous
basis. The circuit is dedicated to specific users without making a
connection establishment or release
A Comparison for data traffic
• A circuit switch connection creates a physical path between two
points where as a virtual circuit creates a route between two
points
• The Network resources (link and switches) that make a path are
dedicated but that make a route can be shared by other
connections
• The line efficiency is greater in Packet switching as a single link
can be shared by many packets over time
• A packet switching network can perform data-rate conversion.
i.e. two stations having different data rates can exchange
packets but it is not possible in circuit switching
• In a typical user/host data connection, much of the time line is
idle thus making circuit switching inefficient
• When traffic becomes heavy on a circuit switching network,
some calls are blocked, but in packet switching network
Electronic Mail:
SMTP, POP
IMAP, and MIME

1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ARCHITECTURE

To explain the architecture of e-mail, we give four scenarios. We begin with the
simplest situation and add complexity as we proceed. The fourth scenario is the
most common in the exchange of e-mail.

2
Mail Servers and User Agents

user
user
agent
agent

mail server mail server


user user
agent agent

 Mail servers
 Always on and always accessible

 Transferring e-mail to and from other servers

 User agents
 Sometimes on and sometimes accessible

 Intuitive interface for the user

3
First scenario

2
1

TCP/IP Protocol Suite 4


Note

When the sender and the receiver of an


e-mail are on the same mail server,
we need only two user agents.

TCP/IP Protocol Suite 5


Second scenario

A message transfer agent (MTA) is a software application, responsible for transferring


and routing an electronic mail message from the sender’s computer to the recipient’s
computer. The basic platform for an MTA is an exchange system with client/server
architecture.

5
1

2 3 4

TCP/IP Protocol Suite 6


Note

When the sender and the receiver of an


e-mail are on different mail servers,
we need two UAs and a pair of MTAs
(client and server).

TCP/IP Protocol Suite 7


Third scenario

3
7

5
4 6

TCP/IP Protocol Suite 8


Note

When the sender is connected to the


mail server via a LAN or a WAN, we
need two UAs and two pairs of MTAs
(client and server).

TCP/IP Protocol Suite 9


Fourth scenario

1 9

2
8

5
4 6

TCP/IP Protocol Suite 10


Note

When both sender and receiver are


connected to the mail server via a LAN
or a WAN, we need two UAs, two pairs of
MTAs (client and server), and a pair of
MAAs (client and server). This is the
most common situation today.

TCP/IP Protocol Suite 11


USER AGENT

The first component of an electronic mail system is the user agent (UA). It
provides service to the user to make the process of sending and receiving a
message easier.

TCP/IP Protocol Suite 12


MESSAGE TRANSFER AGENT

The actual mail transfer is done through message transfer agents (MTAs). To send
mail, a system must have the client MTA, and to receive mail, a system must have
a server MTA. The formal protocol that defines the MTA client and server in the
Internet is called Simple Mail Transfer Protocol (SMTP). As we said before, two
pairs of MTA client-server programs are used in the most common situation
(fourth scenario).

TCP/IP Protocol Suite 13


MESSAGE ACCESS AGENT

The first and the second stages of mail delivery use SMTP. However, SMTP is not involved
in the third stage because SMTP is a push protocol; it pushes the message from the client
to the server. In other words, the direction of the bulk data (messages) is from the client to
the server. On the other hand, the third stage needs a pull protocol; the client must pull
messages from the server. The direction of the bulk data are from the server to the client.
The third stage uses a message access agent.

TCP/IP Protocol Suite 14


POP3 and MIME

Post Office Protocol (POP3) is a type of computer networking and Internet standard protocol that
extracts and retrieves email from a remote mail server for access by the host machine.

POP is an application layer protocol in the OSI model that provides end users the ability to fetch and
receive email.

The MIME stands for Multi-Purpose Internet Mail Extensions. As the name indicates, it is an extension
to the Internet email protocol that allows it’s users to exchange different kinds of data files over the
Internet such as images, audio, and video. The MIME is required if text in character sets other than
ASCII.

TCP/IP Protocol Suite 15


Pop3 and IMAP4

TCP/IP Protocol Suite 16


MIME
Electronic mail has a simple structure. It can send messages only in NVT 7-bit ASCII format. In
other words, it has some limitations. Multipurpose Internet Mail Extensions (MIME) is a
supplementary protocol that allows non-ASCII data to be sent through e-mail. MIME
transforms non-ASCII data at the sender site to NVT ASCII data and delivers it to the client MTA
to be sent through the Internet. The message at the receiving site is transformed back to the
original data.

TCP/IP Protocol Suite 17


Figure 23.15 MIME

TCP/IP Protocol Suite 18


WEB-BASED MAIL

E-mail is such a common application that some websites today


provide this service to anyone who accesses the site. Three
common sites are Hotmail, Yahoo, and Google. The idea is very
simple. Let us go through two cases:

TCP/IP Protocol Suite 19


Web-based e-mail, case 1

1
HTTP
transactions
3
2 4

TCP/IP Protocol Suite 20


Web-based e-mail, case 2

HTTP HTTP
transactions transactions

1 2 3

TCP/IP Protocol Suite 21


IMAP
IMAP is an Internet Message Access Protocol.
It is a method of accessing electronic mail messages that are kept on a possibly
shared mail server.
In other words, it permits a "client" email program to access remote message
stores as if they were local.
For example, email stored on an IMAP server can be manipulated from a desktop
computer at home, a workstation at the office, and a notebook computer while
travelling, without the need to transfer messages or files back and forth between
these computers. IMAP uses TCP/IP port 143.
POP

 Post Office Protocol, a protocol used to retrieve e-mail from a mail server.
Most e-mail applications (sometimes called an e-mail client) use the POP protocol,
although some can use the newer IMAP (Internet Message Access Protocol).

 There are two versions of POP. The first, called POP2, became a standard in the
mid-80's and requires SMTP to send messages.
The newer version, POP3, can be used with or without SMTP. POP3 uses TCP/IP
port 110.
POP Vs IMAP-

Post Office Protocol Internet Message Access Protocol

IMAP allows you to check the mail content before


POP allows you to read the mail only after downloading it. downloading. So, with IMAP you can choose to download your
messages or just delete them.

The email message is downloaded to the local computer and


The email message is stored on the mail server itself.
the copy at the server is deleted.
The user can not organize mails in the mail box of the mail
The user can organize mails on the server.
server.
Mails can be accessed from multiple devices which is the
Mails can only be accessed from a single device.
biggest advantage.
In POP, the mail server and client’s mail account are not
In IMAP, the mail server and the client’s mail account are
synced. So, changes made in the client’s mail account are not
synced. So, changes made in the client’s mail account are
visible on the web mail inbox.
instantly visible on the web mail inbox.
Example-
Example-
If you are using POP and marks a mail as read, it does not get
If you are using IMAP and marks a mail as read, it gets marked
marked as read in the web mail inbox because the mails are
as read in the web mail inbox too because the changes are
downloaded to the computer and so the changes won’t be
taking place on the server.
visible on the server.
POP is a stateful protocol until the mail is downloaded as well IMAP is a stateful protocol because the IMAP server has to
as stateless across sessions. maintain a folder hierarchy for each of its users.
POP is a better choice for those who hardly checks their mail IMAP is a better choice for those who frequently check their
on any other computer. mails on other computers.

TCP/IP Protocol Suite 24


File Transfer Protocol (FTP)
File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP for copying a file from one host to another.
FTP differs from other client/server applications in that it establishes two connections between the hosts. One
connection is used for data transfer, the other for control information (commands and responses).

The control connection uses very simple rules of communication. We need to transfer only a line of command or a line
of response at a time. The data connection, on the other hand, needs more complex rules due to the variety of data
types transferred.
Anonymous FTP

To use FfP, a user needs an account (user name) and a password on the remote server. Some sites have a set of files
available for public access, to enable anonymous FTP. To access these files, a user does not need to have an account
or password. Instead, the user can use anonymous as the user name and guest as the password. User access to the
system is very limited. Some sites allow anonymous users only a subset of commands. For example, most sites allow
the user to copy some files, but do not allow navigation through the directories.
Example of anonymous FTP
We assume that some public data are available at intemic.net.
$ ftp intemic.net
Connected to internic.net

Name: anonymous
Password: guest
ftp>

25

You might also like