Professional Documents
Culture Documents
CNS Model Answers Unit 2
CNS Model Answers Unit 2
CNS Model Answers Unit 2
Unit 2
What are the services provided by DLL to network layer ? OR what are the functions of
data link layer?
The data link layer is responsible for moving frames from one node to the next node.
the functions of data link layer:
• Framing : puts packets received from NL into frames
• Physical addressing: in case of multipoint, receiver’s address is added by sender in
frame
• Flow control: if Receiver speed is less than SENDER , Sender is told to slow down
• Error control : by adding error detection & correction ( for damaged, duplicate or
lost frames)
• Access control: in case of common link between many devices, access to link can be
given to only one device at a time. So DLL in each node implements multiple access
protocols
At sender side’s DLL accepts packets from network layer, adds header & trailer and makes a
frame. Then it Sends frame to physical layer.
Header contains sender’s & receiver’s MAC ( physical address) . Trailer contains error
checking code used by receiver for checking error in a frame.
Receiver side DLL gets frame from physical layer. Checks if destination address matches
with its own MAC address , and also checks for error in the frame using trailer part. If Ok
then , removes header & trailer and passes data ( packet ) to network layer.
Bit oriented
It is not multiple of Bytes.
Flag byte 01111110 is used as delimiter.
Flag is a special byte , which alarms the other stations that a frame is coming on the media
Header : contains the MAC address of sender & intended receiver .
Trailer : contains error detection code such as CRC , which the receiver uses to detect if there
is error in the received frame. If it detects error , then it does not send ACK to the sender &
sender has to resend the same frame again.
even parity : In this a single bit ( called parity bit ) is appended to dataword to make a code
word, such that total number of 1’s in codeword including parity bit even.
Eg if data word is 1011 which has 3 1’s so parity bit is set to 1( to make number of 1’s even)
So code word is 10111
Odd parity : In this a single bit ( called parity bit ) is appended to dataword to make a code
word, such that total number of 1’s in codeword including parity bit odd.
Eg if data word is 1011 which has 3 1’s so parity bit is set to 0( to make number of 1’s odd)
So code word is 10110
Advantage :
It is the best code that adds only a single bit
It can be generated by using only a number of XOR gates
Disadvantage :
In a noisy transmission medium , every time a bit may change , so Sender has to send
same frame again & again ,so a successful transmission could take a long time, or
even never occur.
Syndrome is output of checker which is single bit. It is 0 , if no. of 1’s received is even.
Hence no error ,so decision logic accepts the codeword & if syndrome is 1, it discards
codeword
Parity code detects only one bit error .
To check for more number of errors The two-dimensional parity is used
It check can detect up to three errors that occur anywhere in the table .
In this parity bits are added for a group of data words . both row wise & column wise .
Arrows show error detected.
For a given data word 1000111 find codeword if even parity code is used
Find if there is any error in the received codeword 1001001 . if it was sent by using odd
parity code
In odd parity code the number of 1’s should be odd .
In given codeword 1001001has 3 1’s which is odd, So there is NO error in the received
codeword
Original Hamming code was C(7,4) where code word was 7 bit & dataword was 4 bit.
Next is C (11,7) where code word was 11 bit & dataword was 7 bit
Eg :
If dataword to be transmitted is 1011001, the bits of data word will be placed as follows:
Parity bit 1 is calculated by bit positions which have the least significant bit set: bit 3, 5, 7, 9,
& 11. i.e. P1 = bit3 ⊕ bit5 ⊕ bit7 ⊕ bit9 ⊕ bit11
i.e. P1 is set to 1 if total no. of 1s in these bit positions is odd else set to 0.
Parity bit 2 covers all bit positions which have the second least significant bit set: bit 3, 6, 7,
10 & 11. i.e P2= bit3 ⊕ bit6 ⊕ bit7 ⊕ bit10 ⊕ bit11
i.e. P2 is set to 1 if total no. of 1s in these bit positions is odd else set to 0.
Parity bit 4 covers all bit positions which have the third least significant bit set: bits 5, 6 &7
P4= bit5 ⊕ bit6 ⊕ bit7
i.e. P4 is set to 1 if total no. of 1s in these bit positions is odd else set to 0.
Parity bit 8 covers all bit positions which have the fourth least significant bit set: bits 9,10 &
11. P8 = bit9 ⊕ bit10 ⊕ bit 11
i.e. P8 is set to 1 if total no. of 1s in these bit positions is odd else set to 0.
Example :
Part 1: Given a data word 1011001. Determining the Parity bits for generating
code word
determine P1
To find the redundant bit R1, we check for even parity. Since the total number of 1’s
in all the bit positions corresponding to R1 is an even number, the value of R1 (parity
bit’s value) is = 0
P1 = bit3 ⊕ bit5 ⊕ bit7 ⊕ bit9 ⊕ bit11
= 1 ⊕ 0⊕ 1 ⊕ 1 ⊕ 1
=0
determine P2
determine P4
determine P8
Advantage: Hamming code is simple to calculate by Hardware ( using only XOR gates ).
Applications : communication by modem , embedded processors , computer memory check (
ECC RAM)
For a given data word 1000111 find codeword if Hamming code is used.
At sender :
A k-bit dataword is divided by some predetermined number ( called the generator ). the
remainder of the division ( r bits) are appended to original k-bit dataword to create code word
of n bits ( where n = k+r). The sender sends this codeword to receiver.
At receiver :
The receiver then divides the incoming codeword by the same number (generator) used by
sender and, if remainder is 0, then there is no error and receiver accepts codeword & extracts
data word from it & if remainder is non zero, then there is error, so receiver discards the
received codeword.
The receiver does not send ACK. So the sender which is waiting for ACK sends the same
frame again. ( i.e. ARQ)
Example:
Sender side :
Receiver side:
Case 1: codeword received without error Case 2: codeword received with error
Advantage :it can detect all single bit errors, all double bit errors, any odd number of errors,
and most burst errors.
For a given data word 1000 find codeword if CRC code is used, ( generator is 1011)
Explain simplex flow control with the help of flow diagram & pseudo code
It error & flow control technique used by protocols at data link layer.
It is for noiseless channel where there can be no error. So it does not have error checking at
receiver
Also it is assumed that receiver is fast enough to accept all frames sent by receiver, so there is
no flow control required.
As soon as the sender’s DLL gets packets from network layer it will put it in frame & sends
to receiver . It does not wait for ACK as there is no need of it , because channel is noiseless (
i.e.no errors
Explain stop & wait flow control with the help of flow diagram
Requires bidirectional link so frame goes from sender to receiver & ACK goes from receiver
to sender.
Explain stop & wait ARQ flow control
It is error & flow control technique used by protocols at data link layer.
It is for noisy channel where there can be errors.
For errors to be detected by Rx, the Tx sends codewords ( i.e.datawords appended with
redundant bits ) using parity code or CRC code etc.
Sender give the sequence numbers to frames as 0,1,0,1,0 ,1 & so on.
When Tx sends a frame ,it keeps a copy of the sent frame and also starts a timer. ( It is set to
the time required for a frame to go from sender and ACK to come from receiver back to
sender ) . If timer expires and still there is no ACK from Rx, then the Tx resends theframe,(
copy is still kept )and timer is again started. This is tried for certain number of attempts
,thentransmission is aborted.
Various cases
Case 0 : successful transmission :
frame 0 sent , timer started & Rx sends acknowledgement as ACK “1” which means Rx
expects next frame with no.1
This is a flow & error control method used in data link layer.
It is a sliding window protocol.
Sender does not wait for ACK to come from receiver after each frame sent, rather, in this
N frames are sent without waiting for ACKs.
If any frame is lost or any ACK is lost or delayed , all the outstanding frames ( whose ACK
has not been received yet) are resent by SENDER.
Summary Points:
Principle Sends multiple frames ( max 2m) at a time then checks
for ACKs from Receiver.
Frame numbering Frames are numbered 0,1 till (2m -1 )
Sender window size SENDER window size is at the most (2m -1 )
Receiver window size Receiver window size is 1 frame.
frame receiving policy of Receiver accepts frame only if it is the expected frame.
Receiver Else it discards the frame.
Number of timers One timer is required
required
Sender Policy if sent If any frame is lost or any ACK is lost or delayed , all the
frame is lost/damaged or outstanding frames ( whose ACK has not been received)
ACK is lost are resent by SENDER.
Link utilization link utilization better than stop n wait
algorithm Complex than SAWARQ
Flow diagram
This is a flow & error control method used in data link layer.
It is a sliding window protocol.
Sender does not wait for ACK to come from receiver after each frame sent, rather, in this
N frames are sent without waiting for ACKs.
Summary points :
Flow diagram :
Frame format:
I-frames are used to transport data and control information relating to data
S-frames are used only to transport control information.
V-frames arereserved for system management ,for managing the link itself.
HDLC PPP
High-level Data Link Control Point-to-Point Protocol
(HDLC)
It is one of the protocol at data link layer It is one of the protocol at data link layer
It is a bit-oriented protocol byte-oriented protocol.
It can be used over both point-to-point Originally used for point-to-point
and multipoint links. communication . but later modified for
multipoint
Can be used in LAN Internet users who need to connect their
home computers to the server of an
Internet service provider ( ISP) over
landline telephone connection
It has two modes normal response
mode (NRM) for client server and
asynchronous balanced mode (ABM)(
peer to peer).
Three types of frames Single frame type
I-frames are used to transport data and Same frame can carry various types of
control information relating to data packets for various purpose eg. Making
S-frames are used only to transport connection with server, authentication by
control information. password etc .
V-frames arereserved for system
management ,for managing the link itself.
ALOHA
It is a type of multiple access protocol used at data link layer.
It is a subtype of random access protocol , where any station can send its frame on the
common link at any time , without checking if any other station is already sending its frame
or not.
It has two sub types: pure & slotted
Pure ALOHA
ALOHA, the earliest random access method, was developed at the University of Hawaii
in early 1970. It was designed for a radio (wireless) LAN, but it can also be used on any
wired medium also.
where any station can send its frame on the common link at any time.
Thus there can be collision ( shown by gray boxes) as shown & the frames which are
collided , are need to be sent by senders again.
After sending a frame , sender waits for time equal to round trip time ( 2 * propagation time) .
If it receives ACK within this time , the frame is successfully sent. If ACK is not received ,
next attempt is made, (only if maximum set number of attempts is not reached, else sending is
aborted). It waits for back off time before sending the frame again . The back off time is
random after every unsuccessful attempt.
The throughput for pure ALOHA isS = G × e−2G
where G is the average number of frames requested per frame-time
The maximum throughput Smax = 0.184 when G= 1/2 . i.e 184 frames in every 1000 frames.
Slotted ALOHA
where any station can send its frame on the common link in any slot which are at fixed times.
It has less chances of collision as compared to pure ALOHA , still there can be collision (
shown by gray boxes) as shown & the frames which are collided , are need to be sent by
senders again.
The throughput for Slotted ALOHA isS = G × e−G
where G is the average number of frames requested per frame-time
The maximum throughput Smax = 0.368 when G= 1 i.e. 368 frames out of 1000 frames.
persistence methods
CSMA uses persistence methods to reduce the chances of collisions
There are three types of persistence methods
• 1- persistence
• Non persistence
• P- persistence
1- persistence
• In this station senses the link continuously and as soon as it finds that link is idle , it
sends its frame immediately( i.e. with probability 1).
• This method has highest chance of collisions, because all stations may find the link to
be idle and send their frames immediately.
• Ethernet uses this method.
Non persistence
• A station finds the line idle , it sends its frame immediately as in previous method.
• But if line is busy, it does not keep on checking the link continuously ,rather it waits
for a random time before sensing the link again ( less greedy than 1persistent)
P- persistence
• Here link is divided into time slots ( slot period is equal to or greater than max
propagation time)
• P- persistence combines advantages 1 & non persistent. It reduces chance of collision
and improves efficiency.
• It uses following rule , when it finds that link is idle in any time slot
• Algo:
• 1) It may send frame with probability p
• 2) or it may refrain from sending with probability q = 1-p and waits for next time slot
,where it checks the link again
• a) if link is idle it goes to step 1
• b) if link is busy , it acts as if collision has occurred and uses back off procedure
CSMA/CD
CSMA/CD is used in wired network , but can’t be used for wireless network.
In wirednetwork ,the received signal has almost same energy as the sent signal( due wires
and repeaters). So in collisions , the energy of signal is almost double , which can be easily
detected.
But in case of wireless . Much of the sent energy is lost in transmission in air & the
received signal has very less energy . So collision may add only 5 to 10%. So the difference
between normal frame energy & collision energy is very small, thus collision detection is
very difficult .
Contention window:
• It is amount of time divided into slots . After IFS ,a station has to wait a random no.
of slots.. The number slots in this contention window change according to binary
exponential back off .
• i.e. for first time it is 1 time slot , then it doubles each time the station cannot detect
idle link after IFS time.
ACK :
• Even with all these precautions , there may still be collisions . So ACK by receiver
and time out timer at sender can guarantee that ,the Rx receives the frame.
Binary Exponential Backoff ( BEB ) is an algorithm to determine how long entities should
backoff ( wait) before they retry for retransmission of a frame. After every unsuccessful
attempt, the maximum backoff interval is doubled.
This is used to reduce the chances of collisions in CSMA/CA
In 1985, IEEE started a project, called Project 802, to set standards for communication
among devices from different manufacturers. Project 802 specifies functions of the
physical layer and the data link layer of major LAN protocols. One of the standard is
IEEE 802.3 ( Ethernet )
The original Ethernet was created in 1976 at Xerox, Since then, it has evolved through
four generations.( Standard , fast , gigabit, ten gigabit) .
Standard Ethernet
Frame format
• Preamble: is 56 bits of alternating 0s and 1s(101010…) ,used for giving alert to Rx
,and helping it synchronize with Tx. It is not added by MAC but by physical layer.
• SFD : ( start of frame delimiter) it is last byte(10101011) before actual MAC frame
(this also is added by physical layer.)
• DA: destination MAC address ( 6 byte)
• SA: source MAC address ( 6 byte)
• Data : max 1500 bytes and min 46 bytes ; if data is less than 46 , padding is done to
make it 46 bytes,
• CRC : it uses crc-32 for error detection.
• Minimum length of frame ( 64 bytes or 512 bits) which is required for correct
operation of CSMA/CD. So minimum data size is 64-18 =46
• Maximum length of frame is 1518 bytes,so max data size is 1518-18=1500
1. 10base 5
• Also called thick ethernet or thicknet , because cable used is very thick
• Uses co-axial cable and used in bus topology
• Uses external transreceiver
• Max segment length 500mtr and can use 5 segments of 500mtrs connected by
repeaters .
• Works only in Half duplex mode.
2. 10base2
• Also called thin ethernet, cheapernet because cable is much thinner than 10base5
• This also uses co-axial cable, and bus topology
• Trans-receiver is inside the computer in NIC
• Cheaper than 10base5 , uses only T connectors ,but length is 185 mtr
• half duplex
3. 10 base T
• Cable used is twisted cable
• Topology is physical star.
• All stations connected to central hub via two pairs of twisted cable.(one for sending
and another for receiving)
• Collisions happen in hub
• Max length = 100mtr ( between hub and station)
• full duplex
4. 10base F
• Cable used is fiber optic
• Topology : physical star.
• Distance covered : 2Km
• Requires two FOCs per station
• full duplex
Summary
10base5 10base2 10baseT 10baseF
media Thick co axial Thin co axial UTP Fiber optic cable
Max segment 185 mtr ~ 200
500 mtr 100 mtr 2Km
length mtr
Operation Half duplex Half duplex Full duplex Full duplex
topology Bus Bus Star Star
2. An extended service set (ESS) is made up of two or more BSSs with APs. In this
case, the BSSs are connected through a distribution system, which is usually a wired
LAN. The distribution system connects the APs in the BSSs
Communication between two stations in two different BSSs occurs via two APs to which
they part of.
Station Types
IEEE 802.11 defines three types of stations based on their mobility in a wireless LAN:
1. no-transition: a station is either stationary (not moving) or moving only inside a BSS
2. BSS –transition: A station can move from one BSS to another, but the movement is limited
to only one ESS
3. ESS-transition mobility.: A station with ESS-transition mobility can move from one ESS
to another
MAC Sublayer
IEEE 802.11 defines two MAC sublayers:
1. the distributed coordination function (DCF)
2. point coordination function (PCF).
Figure the relationship between the two MAC sublayers, the LLC sublayer, and the physical
layer.
FC (Frame control) : defines the type of frame and some control information.
D( duration). In all frame types, this field defines the duration of the transmission that is used
to set the value of NAV
Addresses. There are four address fields, each 6 bytes long ( they can be source station
address , destination station address, receiving AP, sending AP , BSS ID )
SC (Sequence control). defines the sequence number of the frame ( required for flow control)
Frame body. contains information based on the type and the subtype defined in the FC field.
FCS ( Frame check sequence ) :contains a CRC-32 error detection sequence. ( required for
flow control)
Frame Types
802.11 has three categories of frames:
1. Management frames,
2. control frames, and
3. data frames.
1. Management frames are used for the initial communication between stations and access
points
2. Control Frames are used for accessing the channel and acknowledging frames.
3. Data Frames are used for carrying data and control information.
Control Frames
After the channel is found idle .the source station waits for a period of time called the
distributed interframe space (DIFS); then the station sends a control frame called the request
to send (RTS).
when destination gets RTS, it waits for a period of time called the short interframe space
(SIFS), the destination station sends a control frame, called the clear to send (CTS), to the
source station. This control frame indicates that the destination station is ready to receive
data.
The source station sends data after waiting an amount of time equal to SIFS.
The destination station, after waiting an amount of time equal to SIFS, sends an
acknowledgment to show that the frame has been received
Addressing mechanism:
Solution
When C hears an RTS from B, but not the corresponding CTS , then C can conclude that it is
(C) an exposed node and C is permitted to transmit to other neighboring nodes such as D.
These are different versions of 802.11 with different implementation of physical layer
frequency-hopping spread spectrum (FHSS)
direct sequence spread spectrum (DSSS)
pulse position modulation (PPM)
frequency shift keying (FSK )
Phase shift keying (PSK )
Orthogonal frequency-division multiplexing (OFDM)
IEEE 802.15
A piconet can have a maximum of seven active secondaries, an additional eight secondaries
can be in the parked state. A secondary in a parked state cannot take part in communication
until it is moved from the parked state to active state.
Scatternet
Piconets can be combined to form what is called a scatternet. A secondary station in
one piconet can be the primary in another piconet.
IEEE 802.16,
also known as WiMAX (Worldwide Interoperability for Microwave Access), is a set of
standards developed by the Institute of Electrical and Electronics Engineers (IEEE) for
wireless broadband communication. It is designed to provide high-speed wireless access over
long distances and can cover areas ranging from a few square kilometers to several tens of
kilometers.
WiMAX operates in various frequency bands, including licensed and unlicensed spectrums,
making it suitable for both fixed and mobile broadband wireless networks. It was initially
developed to provide an alternative to traditional wired broadband solutions, especially in
areas where deploying physical cables is challenging or economically unfeasible.
Two types of user stations are there −
Subscriber stations − They are stationary in some fixed location. For example, broadband
Internet for homes and offices.
Mobile stations − They receive service while they are in motion within the range of
WiMAX. For example, a WiMAX equipped vehicle.
1. Range WiMAX has a longer range compared to traditional Wi-Fi networks, making it
suitable for covering large areas with a single base station.
2. Data Rates: It supports high data rates, suitable for the delivery of broadband-level
services including internet access, VoIP, and multimedia streaming.
3. Quality of Service (QoS):WiMAX provides various QoS mechanisms, enabling network
operators to prioritize different types of traffic based on their requirements. This is essential
for supporting applications with differing demands, such as voice and video.
It's important to note that while WiMAX had significant potential and was initially positioned
as a competitor to cellular technologies like 3G and 4G, it faced challenges in terms of
adoption, deployment costs, and competition from evolving cellular technologies like LTE
and later 5G.
802.16 802.11
For encryption it uses Data For security it uses WEP (Wired Equivalent
10.
Encryption Standard (DES) Privacy), WPA (Wi-Fi Protected Access)