CN Complete
CN Complete
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)
Data
Data Flow
Data
Data Flow
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
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
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
• 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
Aperiodic Signal
Periodic Signal
Analog Signals
The sine wave is the most fundamental form of
a periodic signal
Represented as s(t)=Asin(2ft+)
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
1.Bandwidth of channel.
2.Signal levels
3.Channel quality (level of noise)
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)
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
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?
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
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
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
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
Solution
At 1 Kbps:
1000 bits sent 1001 bits received1 extra bps
At 1 Mbps:
1,000,000 bits sent 1,001,000 bits received1000 extra bps
Line Coding Schemes
UniPolar Encoding
Note:
Note:
Note:
Note:
Note:
Note:
Note:
Note:
-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
Note:
Note:
Solution
The human voice normally contains frequencies from 0 to
4000 Hz.
Sampling rate = 4000 x 2 = 8000 samples/s
More speed
Cost is high restricted to short distance
Serial Transmission
One bit follows another using same line
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
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
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
Note:
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
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
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
Solution
Synchronization
• 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
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
Light weight
Tapping is difficult
Disadvantages
Installation and Maintenance
Cost
Unguided Media
It transports electromagnetic waves without using a
physical conductor called Wireless Communication
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
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
10101010
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
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
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
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
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
10.24
Example 10.5
Solution
We first find all Hamming distances.
Solution
We first find all the Hamming distances.
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
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
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
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.
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
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
Disadvantages:
precise
synchronization
necessary
CDMA
Each channel has a unique code
k1 k2 k3 k4 k5 k6
Advantages:
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
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
Exposed terminals A B C
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 10s and for FHSS
it is 28s
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 50s for FHSS and 20s 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
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
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
2
Framing
Process of wrapping data with certain info before
sending out
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
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
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
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
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
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
34
Lost ACK: Window Size < 2m
35
Lost ACK: Window Size = 2m
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 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
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
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
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
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
Control
MAC
Responsible framing
and MAC address and
Multiple Access Control
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
Tfr= Frame
Transmission time
G = Average number of frames generated by the system (all stations) during one frame transmission time
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?
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
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.
•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.
1. 0-Persistent CSMA
2. 1-Persistent CSMA
3. p-Persistent CSMA
Random Waiting
times
Wasted time
CSMA/CD is Widely used for bus topology LANs (IEEE 802.3, Ethernet).
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.
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:
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.
Primary is sending to
Secondary Secondary is sending
to Primary
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.
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.
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.
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.
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: 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.
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.
Example:
128.143.137.144
19.5
IP Address Format-
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
19.7
Dotted-decimal notation and binary notation for an IPv4 address
Example
Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.
Example
Solution
We replace each decimal number with its binary
equivalent.
Example 19.3
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-
19.14
Total Number Of Hosts-
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
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:
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
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.
University Network
Engineering Medical
School School
Library
Advantages of Subnetting
Subnet
Host
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.
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:
Address range:
Subnet #1:
Network address = 192.168.5.0
Broadcast Address = 192.168.5.31
Note
CIDR Block-
19.33
Rules For Creating CIDR Block-
Rule-01:
Rule-02:
Rule-03:
First IP Address of the block must be divisible by the size of the block.
Note
Given the CIDR representation 20.10.30.35 / 27. Find the range of IP Addresses in the CIDR
block.
Solution-
So,
First IP Address = 00010100.00001010.00011110.00100000 = 20.10.30.32
Last IP Address = 00010100.00001010.00011110.00111111 = 20.10.30.63
19.36
Note
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
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
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.
19.45
For 1st Subnet-
19.46
For 2nd Subnet-
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?
19.48
An organization is granted the block 130.34.12.64/26. The
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.
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:
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
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.
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:
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).
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.
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.
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.
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
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
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
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 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.
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.
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)
RARP finds the logical address for a machine that only knows its
physical address.
19.85
Note:
86
RARP operation
RARP packet
Internet Control Message Protocol (ICMP)
Routing
RIP OSPF BGP PIM
Simple queries
IP payload
90
General format of ICMP messages
91
Note
93
Destination-unreachable messages created only by the destination
host. Other destination-unreachable messages can be created only
by routers.
19.94
Routing Protocols
1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
INTRODUCTION
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
6
Routing Protocols vs. Algorithms
9
Example
Initialization of Tables in Distance Vector Routing
10
Sharing Routing Table
Reach A via C
12
RIP
13
Example of a domain using RIP
14
Q. Design a routing table for router Rl
Routing table of R1
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.
20
Concept of Link state routing
23
Forming shortest path three for router A in a graph
The metric can be based on a type of service (ie . Min delay, max
throughput, etc..)
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
Point-to-point link
Virtual link
Transient link
Stub link
Represents
the Connects to only one router –
network packets enter and leave through this
same router
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.
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).
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:
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
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
1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
DNS
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.
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.
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.
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
1 8
gaia.cs.umass.edu
Iterative Queries root DNS server
2
3
TLD DNS server
4
gaia.cs.umass.edu
Socket Programming
TCP Server
socket()
bind()
socket() accept()
connection establishment
connect()
data request read()
write()
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
12
Server Socket: listen & accept
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
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");
serv_addr.sin_port = htons(portno);
// if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0)
// error("ERROR connecting");
|return 0
}
Server Program
#include <stdio.h>
#include<string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
// listen(sockfd,5);
clilen = sizeof(cli_addr);
bzero(buffer,256);
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
Exposed terminals A B 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
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 28s
– 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 50s.
Process CSMA with CTS and RTS
Before sending a frame source senses the medium
Channel uses a persistent strategy with back-off
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
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
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
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 servers
Always on and always accessible
User agents
Sometimes on and sometimes accessible
3
First scenario
2
1
5
1
2 3 4
3
7
5
4 6
1 9
2
8
5
4 6
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.
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).
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.
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.
1
HTTP
transactions
3
2 4
HTTP HTTP
transactions transactions
1 2 3
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-
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