Data Link Layer
Data Link Layer
The data link layer prepares network data for the physical layer.
Additional:
LLC adds layer 2 control information to IPv4 or IPv6 frames to help deliver data.
MAC controls NIC and other hardware responsible for sending or receiving data on LAN,
WAN and wireless connections
At each hop along the path, a router performs the following Layer 2 functions:
Data link layer sees only the logical topology when controlling data access to the media.
WAN topologies:
Point to point, the simplest one, just one router connected to another
Hub and spoke, more routers connected to one router in “hub” (in the middle)
Mesh, more routers, every connected to each other
PPP – Point to Point Protocol, node puts frames on one end and second node takes these frames,
when between nodes there are more intermediary devices, the topology does not change, it will be
still point to point
LAN topologies:
Star topology – all devices connected to one switch
Extended star – similar to star, more switches
Types of communications:
Half duplex communication – while two or more hosts cannot send demands to server at the
same time, because there is only one data enter
Full duplex communication – both devices can simultaneously transmit and receive on
shared media
It is important that two interconnected interfaces, such as a host NIC and an interface on an Ethernet
switch, operate using the same duplex mode. Otherwise, there will be a duplex mismatch creating
inefficiency and latency on the link.
Contention-based access
Control access
Carrier sense multiple access with collision detection (CSMA/CD) used on legacy bus-topology Ethernet
LANs. When there is a collision, two end devices will see the it and resend the frame. If frame is sent,
third host that want to send a frame, must wait because it is receiving the frame and I must wait until
channel is clear, then it recognises that frame is not for the third host, it is just ignoring it.
Carrier sense multiple access with collision avoidance (CSMA/CA) used on Wireless LANs. Works like, end
devices can see the frame of another end device so it is waiting until the channel is clear to avoid the
collision.
Control access:
Inefficient because end devices must wait for their turn to gain access, examples:
Frames:
Each frame has 3 basic parts:
Header
Data
Trailer
Data link layer protocols add trailer at the end for error detection because of interference or
distortion.
Layer 2 addressing:
Data link layer provides also addressing.
In the header it puts NIC for quicker determine for node whether it is for him or no.
The frame header may also contain source layer 2 address.
Physical addresses do not determine its network, but they are unique.
Even if a device moves into different network it will stay with the same layer 2 address.
Layer 2 addresses have no meaning beyond the local network.
For a further communication between the networks, we need an intermediary device such
as router. It de-encapsulates the frame, removes layer 2 information and finds the shortest
path to get data to destination network, which it knows because of layer 3 addresses.
This layer 2 protocols now have been replaced in the WAN by Ethernet.
In TCP/IP network, OSI layer 2 protocols work with IP in OSI layer 3.
Each protocol performs media access control in the layer 2 that means almost every device can be
a node while having NIC.
LAN uses high bandwidth technology, which is cost effective in relatively small area. Using this
technology in WAN would be not cost effective because of lower bandwidth capacity.