You are on page 1of 20

 Unit-5:

Looping
Link Layer & Local Area Networks
Outline
• Introduction to Link layer services
• Error Detection and Correction Techniques
• Multiple Access Protocols
• Addressing
• Ethernet, Switches & VLAN
Introduction (Link Layer )
 bridge between devices.
 It uses links (connections) to move information (wires or without wires).
 Data in form of frames.
 responsibility of transferring data from one node to physically adjacent node over a link.
 divided into two sub-layers: Logical Link Control (LLC) and Media Access Control /
Medium Access Control (MAC).
 The link layer is implemented in every device.
 It's also in the network adapter (or network interface card - NIC) that connects to your device.
 Hardware Implementation:
 Most of the link layer work happens in the hardware (network adapter)
 Software Implementation:
 When data is received, the software responds to interrupts, deals with errors, and passes the data up to the
network layer.
Link Layer Services (MAC layer)
 Framing(variable length or fixed length): Wraps up data in a frame, add header.
 Link Access : “MAC” addresses used to identify source and destination.
 Reliable Delivery : If it promises reliable delivery, it ensures data reaches the other side without
mistakes, using acknowledgments.
 Flow Control : regulate data flow between sender and receiver.
 Error Detection & Correction : It spots and fixes mistakes.
 Receiver identifies and corrects bit error(s).
 Bit Rate: number of bits transmitted per unit of time, usually measured in bits per second (bps).
 Example: A communication channel with a bit rate of 1000 bps can transmit 1000 bits in one second.
 Baud Rate: symbol rate or modulation rate, refers to the number of signal transmit (symbols or
events) per unit of time. symbols per second. It is the number of distinct symbol changes
 Example: In a communication system with a baud rate of 1000 symbols per second, each symbol can
represent multiple bits
Error Detection & Correction Technique

 Error Detection: Identifying the presence of errors in data.


 Correction Technique : Identifying and fixing data. (hamming code)
 Techniques for error detection
 Parity Check
 Checksum Method
 Cyclic Redundancy Check (CRC)

Parity Check
 One extra bit is sent along with the original bits to make number of 1s either even in case of even parity,
or odd in case of odd parity.
 Helps detect single-bit errors.
 Two-Dimensional Parity:
 Arrange data in a table and calculate parities for rows and columns.
 Parity Checking (Even Parity): Count 1s in a frame. If count is even, frame is fine. If count is odd, something
might be wrong.
 Hard for the receiver to figure out if more than one bit is wrong.
1 0 0 1 0 0 1 1 0 0 1 0 0 1 1
 Two-Dimensional Parity:
 Arrange data in a table and calculate parities for rows and columns.

Checksum 10010111 1

 Data is split into k segments, each m bits long.


 Add segments to get a sum. (if carry then add)
 Complement the sum to get the checksum.
 Send data segments along with the checksum.
 Add received segments to get a sum.
 Complement the sum.
 If the result is zero, received data is accepted;
Cyclic Redundancy Check

 most powerful and easy to implement technique. based on binary division.


 At the destination, the incoming data unit is divided by the same number.
 If at this step there is no remainder, the data unit is assumed to be correct and is therefore accepted.

Same 0
Differ 1

Here 1001 is 4 bit no.


So add 4-1 = 3 bit at last
Multiple Access Links - MAL
 There are two types of network links:
 point-to-point link Connects one sender to one receiver.
 broadcast link multiple nodes share a single channel.
 collisions occur when multiple nodes transmit simultaneously.
 ensure that the broadcast channel performs useful work when multiple nodes are active, it is
necessary to coordinate the transmissions of the active nodes.
 This coordination job is the responsibility of the multiple access protocol.
Multiple Access Protocols
Categories of Multiple Access Protocol:
1. Channel Partitioning Protocols
 Divide channel into smaller “pieces” (time slots, frequency, code)
 TDMA: Time Division Multiple Access
 FDMA: Frequency Division Multiple Access
 CDMA: Code Division Multiple Access
2. Random Access Protocols
 Channel is not divided and allow collisions.
 “Recover” from collisions
 Pure ALOHA
 Slotted ALOHA
 CSMA, CSMA/CD, CSMA/CA
3. Taking-turns protocols
 Nodes take turns but nodes with more to send can take longer turns.
 Polling
 Token passing
TDMA: Time Division Multiple Access
 Assigned specific time slot to each node for transmission.
 When a node has data to send, it transmits during its allocated time
slot.
 each node takes turns, avoiding collisions.
 Waiting Time: A node must wait for its turn in the sequence, even
if it's the only one with data to send.

FDMA: Frequency Division Multiple Access


 Channel is divided into different frequencies.
 Each node is allocated a specific frequency for
transmission.
 Fair Bandwidth Division: Distributes bandwidth fairly
among N nodes.
CDMA: Code Division Multiple Access
 CDMA assigns a unique code to each node.
 Each node uses its assigned code to encode data bits for transmission.
 allow simultaneous transmissions
 Widely used in military systems
Pure Aloha Protocol
 Users send data whenever they want, without waiting for a specific time.
 After sending, check if there's a collision.
 If collision, wait a bit, then try again.
 When two frames attempt to use the channel simultaneously, a collision happens.
 If the first bit of a new frame overlaps with the last bit of a frame almost finished, both
frames will be totally destroyed and both will have to be retransmitted later.
 Receiver send acknowledgement if proper transfer occur.
Slotted Aloha
 Shared channel divided into slots (according to time).
 The stations can send a frame only at the beginning of the slot & only one frame is sent
in each slot. All frame of same size.
 If a station misses a slot, it waits until the next one to transmit.
 Each node independently detects collisions and decides when to retransmit
 When multiple nodes are active, slots will have collisions, leading to wastage.
CSMA (Carrier Sense Multiple Access) Protocols:
 Station senses the channel before sending.
 Various types include:
 1-persistent CSMA
 Non-persistent CSMA
 P-persistent CSMA
 CSMA/CD (CSMA with Collision Detection)
 1-persistent CSMA:
 Station transmits with a probability of 1 when the channel is idle.
 Non-persistent CSMA:
 Station senses the channel before sending.
 If idle, it starts transmission; if busy, it waits a random time and re-tries.
 P-persistent CSMA:
 When a station is ready to send, it senses the channel.
 Not all station are allowed to transmit immediately.
 If the channel is idle, it transmits with a probability p or wait with probability q=1−p.
CSMA/CD (Carrier sensor multiple access with Collision Detection)
 If two stations sense the channel to be idle and begin transmitting simultaneously, they will both
detect the collision.
 Rather than finish transmitting, they should stop transmitting as soon as the collision is detected.
 Quickly terminating damaged frames, saves time and bandwidth.
 After collision detection, the station aborts its transmission, waits for a random period, and then
attempts again.
 CSMA/CD States:
 Contention: Stations are access the channel, Multiple stations may attempt to transmit
simultaneously.
 Transmission: A station is actively transmitting its frame.
 Idle: No stations are actively transmitting.
 CSMA/CA Carrier Sense Multiple Access(Collision Avoidance)
 avoid collisions by listen to the channel before transmitting data
 If the channel is clear, the device sends its data; if not, it waits for a random period before trying again
to avoid simultaneous transmissions and collisions.
Polling

 One node is assigned as the master node.


 Master node polls each node in a round-robin fashion.
 Sends a message to each node, allowing it to transmit.
 Master detects end of transmission
 Eliminates collisions and empty slots.
 master node polling each of the nodes in a cyclic manner.

Token Passing
 No designated master node.
 Nodes pass a special frame called a token.
 Token moves in a fixed order
 (e.g., Node 1 → Node 2 → ... → Node N → Node 1).
 A node keeps the token only if it has frames to transmit.
 If no frames, it passes the token to the next node.
Ethernet : connecting devices in a wired local area network (LAN) or wide area network.
 widely used local area network (LAN) technology.
 IEEE standard - Institute of Electrical and Electronics Engineers
1. Switched Ethernet / Standard Ethernet
 It gives dedicated 10 Mbps bandwidth on each of its ports.
 Recognizes destination addresses and forwards frames accordingly.
 Use star topology
2. Fast Ethernet
 Developed by IEEE Committee. Low cost, full duplex, no collision, connect two or more
station together
 data transfer rate of 100 Mbps.
3. Gigabit Ethernet
 Fiber optic-based technology but can use twisted or coaxial cables for shorter distances.
 Support both half and full duplex, no collision
 data rate to 1 Gbps.
4. Ten-gigabit Ethernet (10 Gbps)
Virtual LANs (VLANs)
 creating virtual groups for computers in a network based on tasks, ignoring where they physically are.
 Features:
 Easy to moves, adds, and changes end stations.
 manage traffic in specified groups, limiting broadcast, unicast, and multicast.
 Enhances security by segmenting into distinct broadcast domains.
 Components:
 Switches: Logically segment connected end stations.
 Routers: Facilitate VLAN communications between workgroups.
 Transport Protocols: Carry VLAN traffic.
Ethernet Frame Structure:
• Preamble (8 bytes): A friendly "Hello!" , before sending the actual data. Also helps with timing.
• Destination Address (6 bytes): Tells the network where to send the info.
• Source Address (6 bytes)
• Type Field (2 bytes): Tells the network what kind of data it is (e.g., a video or a document).
• Data Field (46 to 1,500 bytes): Carries the actual data, like an email or a webpage.
• CRC (4 bytes): contains error detection information.
Bit Stuffing

 Bit-oriented protocols use a bit pattern (01111110) as flags at the beginning and end of
each frame.
 Bit stuffing solve the issue of flag patterns appearing in data.
 If a 0 and five successive 1 bits are encountered, an extra 0 is added.
 The receiver node removes the extra-added zero.
 Original Bit Stream (without bit stuffing):0111111001111100101111110
 After Bit Stuffing:01111110011111000101111110
Byte Stuffing
 each frame starts and ends with special bytes, known as flag bytes.
 Two consecutive flag bytes indicate the end of one frame and the start of the next.
 An issue arises if the flag byte's bit pattern appears in the actual data
 To address this problem, the sender inserts a special escape byte (ESC)
 disadvantage is that byte stuffing use of 8-bit characters, limiting its compatibility with
character codes that use different sizes
Byte Stuffing - Example

Self-Learning of Link Layer Switches:


 build their tables automatically and dynamically
 For each incoming frame:
 Records sender's MAC address.
 Notes arrival interface.
 current time.
 Frame arrives at 9:39 from MAC 01-12-23-34-45-56 on interface
2.
 If address not in table, a new entry is added.
 If no frames with 62-FE-F7-11-89-A3 arrive by 10:32, that
address is removed.
ARP (Address Resolution Protocol)
 Maps IP addresses to physical MAC addresses.
 Example:
 IP address (IPv4): 32 bits
 MAC address (Ethernet): 48 bits
 ARP cache, is used to maintain a correlation between each MAC address and its corresponding
IP address.
 When packet arrived , ARP finds the corresponding MAC address in the cache.
 If not found, ARP broadcasts a request to all machines on the LAN.
 The machine with the matching IP address responds.
 ARP updates its cache and sends the packet to the MAC address that replied.

You might also like