You are on page 1of 61

MODULE-2

DATA LINK LAYER


NODES & LINKS
• Communication at the datalink layer is node to node
• Data unit from one point in the internet needs to pass through
many networks(LAN & WAN) to reach another point
• LAN & WAN are connected by routers
• Routers are nodes & network in b/w are links
Services
 Framing
 Flow control
 Error control
 Congestion control

Categories of links
1.point to point link-link dedicated to 2 devices
2.broadcast link-link shared b/w several pair of devices
Sublayers
• data link layer divided into 2 sublayers
 Data link control(DLC)
 Media access control(MAC)
Link layer addressing
 3 links,2 routers,2 hosts
 At each host 2 addresses are there:IP address(N),link
layer address(L)
 Router has many pairs of addresses bcoz number of
links are connected to routers
 Frame carries same src & dst addresses(N1 & N8),but
link layer address changes from link to link
 In IP address,src address comes first then dst address
 In link layer address,dst address comes first then src
address
Types of addresses
Link layer protocols defines 3 types of addresses
1.Unicast address: one to one communication
2.Multicast address: one to many communication
3.Broadcast address: one to all communication
Address resolution protocol(ARP)

• Helps to find link layer address if IP address is known


• Auxiliary protocol defined in the network layer

• ARP accepts IP address from IP & passes to data link


layer
ARP operation
ARP packet format
 Hardware type field defines types of link layer protocol
 Protocol type defines network layer protocol
 Src hardware & src protocol address are variable length field
defines link layer & IP address of the sender
 dst hardware & dst protocol address defines link layer & IP
address of the receiver
Data link control services
Framing
 Frames can be fixed or variable size
 Fixed size framing: no need for defining boundaries
for the frame
 Variable size framing: need to define begin & end of
the frame
• E.x:character oriented framing & bit oriented framing
Character oriented framing
Bit oriented framing
Flow control

Error control
preventing delivery of corrupted packet to the network layer
1.If frame corrupted, it is discarded, if not delivered to network
layer
2.If frame corrupted, it is discarded, if not an acknowledgment
sent to sender
Data link layer protocols
protocol deals with flow & error control
 Simple
 Stop & wait
 Go back N
 Selective repeat
Finite state machine(FSM):machine with finite
number of states
Simple protocol
FSM

Flow diagram
Stop & wait protocol

 Provides both flow & error control


 Sender sends one frame & waits for an
acknowledgement before sending next frame
 To detect corrupted frame, CRC added to each data
frame
 When frame arrived at receiever, CRC will be
checked if it is corrupted frame will be discarded.
 After sending one frame sender starts the timer.
 Sender keeps the copy of sended frame untill
acknowledgement arrived
FSM
FLOW DIAGRAM
Sequence & acknowledgement numbers
• Sequence numbers are 0,1,0,1
• Ack numbers are 1,0,1,0(defines sequence number of next expected frame)
Media access control
Random access(contention method)-No station is
superior than other & no station have control on another

1.ALOHA
 Earliest random access method
 In which medium is shared by number of stations.when station
sends the data,another station also may attempt to send the
data.so data from 2 stations collides

(a)Pure ALOHA
 Original ALOHA protocol called pure ALOHA
 Basic principle-each station sends a frame whenever they had
a frame to send. but there is only one channel, so there is a
chance of collision
vulnerable time-defined as ,the length of time at which collision taken place
(b)Slottted ALOHA

 Invented to improve efficiency of pure ALOHA


 Time is divided into slots & station should send only
at the beginning of time slot
Vulnerable time
2.CSMA
• To minimize the collision & to increase performance
• Sense before transmit-station has to sense the
medium before transmit the data
• Reduce possibility of collision but cannot eliminated
completely
• Collision occur due to propagation delay
Vulnerable time
Persistence methods:defines what station has to do
if the channel is idle or busy
1.1-persistent
• When station finds medium is idle,immediately send
the data
• Chance of collision is more bcoz if 2 or more station
finds line is idle collision takes place
2.Non-persistent method
• If medium is busy station will wait for random
amount of time
• Reduces collision
• Reduces efficiency bcoz station has to wait for
random amount of time even if the medium is idle
3.p-persistent
• Used if the channel has time slots with slot duration
equal or grtr than the maximum propagation time
• Reduces collision & improves efficiency
• If the medium is idle station follows the following
steps
1.With probability p station sends its frame
2.With probability q=1-p,station waits for beginning of
next time slot & checks the line again
(a) If line is idle,it goes to step 1
(b) If line is busy,that indicates collision occured
CSMA/CD

• Station monitors the medium after sending the frame


to check whether the transmission has successful or
not,if not it sends frame again.
Energy level:station needs to monitor energy level to
determine whether channel is busy,idle or in collision mode
CSMA/CA
• Uses 3 strategies
 Interframe space
 Contention window
 Acknowledgement
Frame exchange timeline
CHAPTER 3:WIRED & WIRELESS LANs

Ethernet protocol
• LAN is a computer that is designed for a limited
geographic area
• Provide higher data rate

Ieee project 802


• Started in 1985,to set standards to enable
intercommunication b/w devices
• It specifies function of the physical & data link layer
• IEEE subdivided the data link layer into 2 sublayers
 LLC-logical link control
• flow & error control,framing
• Framing handled by both LLC & MAC
• Provide interconnectivity b/w different LANs

 MAC-media access control


• Defines specific access method
• framing
Ethernet evolution
Standard ethernet
Characteristics
1.Connectionless & unreliable service
• It doesn’t establish & terminate connection
• Doesn’t provide flow control
2.Frame format
1.Preamble-alert receiver about coming frame & added at
physical layer
2.SFD(flag)
 Indicates beginning of frame
 Last 2 bits (11) alert receiver that the next field is the
destination address
 Added at the physical layer
3.Destination address-contain link layer address of the
destination
4.Source address-contain link layer address of the sender
5.Type-defines upper layer protocol
6.Data
 Contain data & minimum & maximum is 46 &
1500bytes
 If data is more than 1500 bytes,data needs to be
fragmented & if it is less than 46,it needs to be
padded with extra zeros

7.CRC-error detection information


3.Frame length
 Minimum length-512 or 64 bytes
 Maximum length-1518 bytes

Addressing
Ethernet address is 6 bytes, which is denoted in hexadecimal
notation with colon b/w the bytes

Transmission of address bits


• The way the address are sent online is different from the way
they are written in hexadecimal notation.
• Transmission is left to right & byte by byte
• In each byte LSB sent 1st & then MSB
• 1st Bit arrived at receiver ,defines the type of address
Unicast,multicast & broadcast address
 Source address is always a unicast address bcoz the
frame comes from only one station
 Destination address can be Unicast,multicast &
broadcast
 If LSB bit of 1st byte in destination address is ‘0’,the
address is unicast otherwise it is multicast
 Broadcast destination address is 48 1’s
Efficiency of standard ethernet

• Defined as the ratio of time used by a station to send


data to the time the medium is occupied by this
station

a=number of frames that can fit on the medium


a=propagation delay/transmission delay
• If ‘a’ decreases efficiency increases
Implementation
• 10base X
 10-data rate(10Mbps)
 Base –baseband signal
 X-maximum size or type of cable
 Example:5-500 meter,2-185 meter,T-unshielded twisted pair
cable, F-fibre optic
1.10 Base 5
• Thick ethernet-cable is rough & too stiff to bend
• Uses bus topology
• Uses external transeiver
• Transeiver does transmission ,receiving & collision detection
• Transeiver connected to station via Transeiver cable & provide
separate path for sending & receiving
• Collision occur in cable only
• Cable length should not excced 500m,if it is more cables
connected using repeaters.
2.10 Base 2(thin ethernet or cheapernet)
• Uses bus topology
• thin ethernet or cheapernet-cable is thin & more flexible,easy
to bent
• Transceiver installed inside the station
• Collision occur in cable only
• Less expensive than 10base5 & tee connection are cheaper
than taps
• Installtion is simple bcoz cable is flexible
• Length should not exceed 185m
3.10 Base-T(twisted pair ethernet)
• Uses star topology
• Stations connected to hub via 2 pairs of twisted cable
• 2 pair cable create 2 paths,one for sending & one for receiving
• Collision occur in hub
• Maximum length of cable is 100m
4.10 Base-F(fiber ethernet)
• Uses a star topology
• Stations are connected to hub using 2 fiber optic
cables
Wireless LANs

Architectural comparison
1.Medium-wired & wireless
2.Hosts-not physically connected to network
3.Isolated LANs
4.Connection to other networks
Characteristics

• Attenuation
• Interference
• Multipath propagation
• Error –based on SNR
Access control
• Wireless LANs doesnot uses CSMA/CD,they uses
CSMA/CA bcoz
1.To detect collision,host needs to send & receive at the
same time,but it is not possible in wireless hosts
2.Distance b/w hosts is more-collision information
could not be shared
3.Hidden station problem

You might also like