Tech Notes

Networking: Layer 2 Switching

CAM Table Vs FIB table:

CAM table contains MAC address, egress port and vlan. Whereas, FIB table contains IP address, next-hop IP address, next-hop MAC address, Egress port.

We use FIB and CAM Table in conjuction in multi-layer hardware based switching. Hardware based switching is always fast.

Exceptions: Packets like ARP, IP packets which needs a response from the router, Routing protocol updates, NAT etc must be “punted” to the CPU for standard process switching

VLAN:

  • 802.1Q Protocol: The IEEE 802.1Q protocol can carry VLAN associations over trunk links.
  • 802.1Q embeds its tagging information within the Layer 2 frame:
    • original ethernet frame: destination mac address + source mac address + type/length + FCS(18 bytes)
    • with vlan tagging: destination mac address + source address + do1q tag + type/length + FCS(18+4 = 22 bytes)
  • 802.1Q adds a 4-byte tag just after the source Address field
  • Because Ethernet frames cannot exceed 1518 bytes, the additional VLAN tagging information can cause the frame to become too large. Frames that barely exceed the MTU size are called baby giant frames. Switches usually report these frames as Ethernet errors or oversize frames.
#show interfaces Et1 switchport
Name: Et1
Switchport: Enabled
Administrative Mode: static access
Operational Mode: static access
MAC Address Learning: enabled
Dot1q ethertype/TPID: 0x8100 (active)
Dot1q VLAN Tag: Allowed
Access Mode VLAN: 1000 (VLAN1000)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: disabled
Trunking VLANs Enabled: ALL
Static Trunk Groups:
Dynamic Trunk Groups:
Source interface filtering: enabled
VLAN forwarding mode: allowedVlansOnly
MAC-based VLAN assignment: disabled

show vlan 1000
VLAN  Name                             Status    Ports
----- -------------------------------- --------- -------------------------------
1000  VLAN1000                         active    Cpu, Et1,..

Ether-channel/802.3ad Link Aggregation/LACP:

Although an EtherChannel link is seen as a single logical link, the link doesn’t necessarily have an inherent total bandwidth equal to the sum of its component physical links.

Instead, traffic is distributed across the individual links within the EtherChannel. Each of these links operates at its inherent speed (200 Mbps full duplex for FE) but carries only the frames placed on it by the EtherChannel hardware. If one link within the bundle is favored by the load-distribution algorithm, that link will carry a disproportionate amount of traffic.

Generally, all bundled ports first must belong to the same VLAN. If used as a trunk, bundled ports must be in trunking mode, have the same native VLAN, and pass the same set of VLANs. Each of the ports should have the same speed and duplex settings before being bundled.

LACP packets are exchanged between switches over EtherChannel-capable ports.

The switch with the lowest system priority (a 2-byte priority value followed by a 6-byte switch MAC address) is allowed to make decisions about what ports actively are participating in the EtherChannel at a given time.

Ports are selected and become active according to their port priority value (a 2-byte priority followed by a 2-byte port number), where a low value indicates a higher priority. A set of up to 16 potential links can be defined for each EtherChannel. Through LACP, a switch selects up to eight of these having the lowest port priorities as active EtherChannel

links at any given time. The other links are placed in a standby state and will be enabled in the EtherChannel if one of the active links goes down.

#show port-channel brief
Port Channel Port-Channel10:
  Active Ports:  Ethernet3/45/1 Ethernet3/46/1 Ethernet4/45/1
                 Ethernet4/46/1 Ethernet5/45/1 Ethernet5/46/1
                 Ethernet6/45/1 Ethernet6/46/1

#show port-channel 117 detailed
Port Channel Port-Channel117 (Fallback State: Unconfigured):
Minimum links: unconfigured
Minimum speed: unconfigured
Current weight/Max weight: 2/16
  Active Ports:
       Port                 Time Became Active       Protocol       Mode      Weight
    -------------------- ------------------------ -------------- ------------ ------
       Ethernet3/13/1       13:11:31                 LACP           Active      1
       Ethernet4/13/1       13:11:31                 LACP           Active      1

show port-channel 117 load-balance
ChanId Port Rx-Ucst Tx-Ucst Rx-Mcst Tx-Mcst Rx-Bcst Tx-Bcst


117 Et3/13/1 50.03% 50.00% 50.00% 50.00% 33.33% 25.93%
117 Et4/13/1 49.97% 50.00% 50.00% 50.00% 66.67% 74.07%

Spanning Tree Protocol

STP operates as switches communicate with one another. Data messages are exchanged in the form of bridge protocol data units (BPDU). A switch sends a BPDU frame out a port, using the unique MAC address of the port itself as a source address. The switch is un-aware of the other switches around it, so BPDU frames are sent with a destination address of the well-known STP multicast address 01-80-c2-00-00-00.

Two types of BPDU exist:

  • Configuration BPDU, used for spanning-tree computation
  • Topology Change Notification (TCN) BPDU, used to announce changes in the net- work topology

Electing a Root Bridge:

An election process among all connected switches chooses the root bridge. Each switch has a unique bridge ID that identifies it to other switches. The bridge ID is an 8-byte value consisting of the following fields:

  • Bridge Priority (2 bytes)—The priority or weight of a switch in relation to all other switches. The Priority field can have a value of 0 to 65,535 and defaults to 32,768
    (or 0x8000) on every Catalyst switch.
  • MAC Address (6 bytes)—

The election process then proceeds as follows: Every switch begins by sending out BPDUs with a root bridge ID equal to its own bridge ID and a sender bridge ID that is its own bridge ID. The sender bridge ID simply tells other switches who is the actual sender of the BPDU message. (After a root bridge is decided on, configuration BPDUs are sent only by the root bridge. All other bridges must forward or relay the BPDUs, adding their own sender bridge IDs to the message.)

A root bridge is considered better if the root bridge ID value is lower than another.

if a new switch with a lower bridge priority powers up, it begins advertising itself as the root bridge.

Electing Root Ports:

The root port always points toward the current root bridge.

the lower cost tells the switch that the path to the root bridge must be better using this port than it was on other ports. The switch has now determined which of its ports has the best path to the root: the root port.

Electing Designated Ports:

Inter-vlan routing:


Posted

in

by

Tags: