Computer Network Module 2
Computer Network Module 2
(BCSE 3306)
Lecture Notes
Module II
Ajit K Nayak
[email protected]
Department of Computer Science Engineering &
Application
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
Computer Networking / Module II / AKN / 2
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
Computer Networking / Module II / AKN / 3
The Link layer
Burst error: two or more bits in the data unit have changed
Detection Methods
Parity Check
Cyclic Redundancy
Check (CRC)
Checksum
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 Computer Networking / Module II / AKN / 11
Binary Division in CRC: An Example
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).
Computer Networking / Module II / AKN / 14
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 Computer Networking / Module II / AKN / 15
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.
Computer Networking / Module II / AKN / 16
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.
Computer Networking / Module II / AKN / 17
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
Computer Networking / Module II / AKN / 18
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 Computer Networking / Module II / AKN / 19
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,…
ACK 2
size = 3 frames?
Other wise there
will be problem
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
Computer Networking / Module II / AKN / 36
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. Computer Networking / Module II / AKN / 37
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
Computer Networking / Module II / AKN / 38
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
01 Configure-request
02 Configure-ack
03 Configure-nak
04 Configure-reject
05 Terminate-request
06 Terminate-ack
07 Code-reject
Computer Networking / Module II / AKN / 58
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)
Computer Networking / Module II / AKN / 59
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 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
Computer Networking / Module II / AKN / 65
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. Computer Networking / Module II / AKN / 66
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
Disadvantages:
waste of bandwidth
if the traffic is
distributed unevenly
inflexible t
guard spaces
Advantages: c
Disadvantages:
precise
synchronization
necessary
Computer Networking / Module II / AKN / 72
FTMA
Combination of both methods
A channel gets a certain frequency band for a certain amount of
time
Example: GSM
Advantages:
better protection against tapping
k1 k2 k3 k4 k5 k6
protection against frequency
selective interference c
higher data rates compared to f
code multiplex
but precise coordination
required
t
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
Computer Networking / Module II / AKN / 76
Codes in CDMA
¾ What is a good code for CDMA?
¾ A code for one user should have a good autocorrelation and should be
orthogonal to other codes
¾ If inner product of two vectors is zero then two vectors are said to be
Orthogonal
¾ (2,5,0) × (0,0,17) = 0 + 0 + 0 = 0
¾ It has a similar meaning in code space also
¾ If the inner product of a code with itself is very large and drops when
shifted by one chip. It stays at that low value until the code matches itself
again perfectly
¾ Example Barker code
+ - + + - + + + - - - Original
+ + - + + - + + + - - Shifted once
+ - - + - - + + - + + sop
¾Thus Barker code has a good autocorrelation and this property helps
receiver to reconstruct the original data precisely
Computer Networking / Module II / AKN / 77
Sequence Generation
Walsh table is used to generate the sequence.
It is a two-dimensional having equal number of rows
and columns
Each row is a sequence of chips
Port 3
Port 1 SWITCH
Port 2
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!
Computer Networking / Module II / AKN / 113
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
Computer Networking / Module II / AKN / 114
Basic DFWMAC-DCF without RTS/CTS
t0 t1 t2 t3 t4 t5 t6 t t8 t9 t
7 10
5 stations competes for sta1
sending at arrow marks
At first sta3 accesses the sta21
medium at t1
sta3
Sta1, sta2, sta5 waits till
the carrier is free (t2)then sta4
waits for DIFS then start
there back-off timer sta5
within the contention
window
sta4 wants to send between t4 and t5, all three starts their timer at t6.
Accidentally timers of sta4 and sta5 finishes same time(t7). Thus there is a
collision and sta5 stops its timer.
finally sta5 gets the medium at t10
Computer Networking / Module II / AKN / 115
Basic DFWMAC-DCF Unicasting
station has to wait
for DIFS before
sending data
contention
receivers acknowledge at once (after waiting for SIFS)
if the packet was received correctly (CRC)
no other station can transmit because DIFS is greater
than SIFS, hence no chance of collision
If no ACK is received sender automatically retransmits
the frame
but the sender has to wait again and compete for the
access right to retransmit
Computer Networking / Module II / AKN / 116
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 Format
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
Computer Networking / Module II / AKN / 150
ATM Networks Architecture
ATM uses asynchronous time division multiplexing