Saturday, 22 February 2020

Forwarding - layer 2 review


Data link layer (Layer 2 of OSI model) is responsible for transfer data between network nodes within the same LAN or adjacent nodes in WAN.  


Data link layer has two sub layers:

-          MAC – media access control, control who is allowed to access the media (ie. CSMA/CD & CSMA/CA) and provides physical addressing

-          LLC – logical link control provides flow control and multiplexing for the logical link


Frame forwarding is based on MAC addresses, MAC address table contain MAC address, port and vlan. Switch learns MAC addresses of the connected devices dynamically by listening to incoming frames.


Unknown unicast flooding happens when switch receives frame with unknown destination MAC address then forwards this frame to all ports except for the port that received that frame.


Frames that contain destination broadcast or destination multicast addresses are also flooded.


In Layer 2 we can find devices such as switches and bridges. Switches separate collision domain per port with each frame received on the switch port being checked for errors. Depends on the features broadcast traffic can be limited and other types filtering or forwarding can be possible. 

As an example Layer 2 Cisco Catalyst switch will maintain following tables:

-          L2 Forwarding Table - Content Addressable Memory (CAM)

-          Ternary Content Addressable Memory (TCAM) which is an extension on CAM and contains ACLs in a compiled form (security ACL and QoS policy)



TCAM table has two components:


-Feature Manager (FM) – compiles ACL into entries

- Switching Database Manager (SDM) – configures or tunes TCAM

After CAM and TCAM lookups are complete the frame is action accordingly.


Examples of Layer 2 protocols:


-          Spanning Tree Protocol

-          Virtual LANs –VLANs – IEEE 802.1q

-          Quality of Service – QoS control

-          Ethernet Ring Protection Switching - ERPS

-          Point-to-Point Protocol – PPP

-          High-Level Data Link Control - HDLC

-          Link Layer Discovery Protocol - LLDP

-          Cisco Discovery Protocol - CDP

-          Frame Relay

-          Fibre Distributed Data Interface - FDDI

-          Unidirectional Link Detection – UDLD

-          IEEE 802.11 – Wireless LAN



Differences between switches and bridges:


-bridges are software based, switches hardware-based (use ASICs when making forwarding decisions)

-switches perform error checking

-switches have buffers for each link

-most bridges have only 2 or 4 ports

-switch has one broadcast domain per vlan

-bridge can run only one instance of spanning tree, switch can have multiple spanning tree instances

Forwarding - layer 1 review

Physical Layer or Layer 1 of the OSI model, what we got here is a media type and connector or in other words hardware and transmission. Layer 1 provides procedural interface for transmission which means it is responsible for sending (signalling) of raw bits of data.
Layer 1 hardware: NICs, Hubs, Repeaters, Cables, Fibre optics, Radio waves
Examples of what is happening at layer 1:


  • Autonegotiation
  • Carrier sense and collision detection (used by Layer 2)
  • Modulation
  • Circuit switching
  • Bit-by-bit or symbol-by-symbol delivery
  • Multiplexing
  • Forward error correction 

Plumbing... QoS

Rule no 1. QoS does not help in situations where there is no enough bandwidth but helps optimize performance by prioritization of the traffi...