MFormations
Modern Network Engineering

Chapitre 5

Chapter 05: Switchs et VLAN

Chapter 05: Switchs et VLAN

Chapter 05: Switchs et VLAN

1. Ethernet Switching Fundamentals

1.1 MAC Learning

A switch learns MAC addresses by examining source MAC addresses in received frames.

Diagramme en cours de génération...

CAM Table:

MAC Address    Port    VLAN
AA:AA:AA:AA:AA:AA  Gi0/1   10
BB:BB:BB:BB:BB:BB  Gi0/2   10
CC:CC:CC:CC:CC:CC  Gi0/3   20

1.2 Switching Decisions

Frame TypeAction
Known unicastForward to specific port
Unknown unicastFlood all ports (except source)
Broadcast (FF:FF:FF:FF:FF:FF)Flood all ports
MulticastFlood or forward if IGMP snooping

1.3 Switch Forwarding Methods

MethodDescriptionLatency
Store-and-forwardReceive entire frame, check CRC, then forwardHighest
Cut-throughForward as soon as dest MAC readLowest
Fragment-freeForward after first 64 bytesMedium

2. Spanning Tree Protocol (STP)

2.1 STP Overview (802.1D)

STP prevents loops in redundant Ethernet topologies.

Diagramme en cours de génération...

2.2 Bridge ID and Root Election

Bridge ID = Priority (16-bit) + MAC Address (48-bit)

Bridge Priority: 32768 (default)
Extended System ID: VLAN ID (12 bits)
Old format: Priority (2 bytes) + MAC (6 bytes)
New format: Priority (4 bits) + Extended ID (12 bits) + MAC (6 bytes)

Root Bridge Election:

  1. Lowest Bridge ID (Priority + MAC)
  2. Lowest Path Cost to Root
  3. Lowest Sender Bridge ID
  4. Lowest Sender Port ID

2.3 Port Roles and States

Diagramme en cours de génération...

STP Port States:

StateForwarding MACLearning MACPurpose
BlockingNoNoNo BPDU received yet
ListeningNoNoTransition after block
LearningNoYesBuilding MAC table
ForwardingYesYesNormal operation
DisabledNoNoAdministratively down

Timers:

  • Hello Time: 2 seconds
  • Forward Delay: 15 seconds (listening + learning)
  • Max Age: 20 seconds

2.4 RSTP (Rapid Spanning Tree - 802.1w)

FeatureSTP (802.1D)RSTP (802.1w)
Convergence30-50 seconds<10 seconds
Port rolesRoot, Designated, BlockedRoot, Designated, Alternate, Backup
Port states5 states3 states (Discarding, Learning, Forwarding)
Edge portsNoYes (portfast)
Link typeNo distinctionShared vs Point-to-point

RSTP Port Roles:

  • Root Port: Best path to root bridge
  • Designated Port: Best path from segment
  • Alternate Port: Alternative path to root (replaces blocked)
  • Backup Port: Redundant connection to same segment

2.5 MSTP (Multiple Spanning Tree - 802.1s)

MSTP maps multiple VLANs to fewer STP instances.

Diagramme en cours de génération...

Configuration:

spanning-tree mode mst
spanning-tree mst configuration
 instance 1 vlan 1-100
 instance 2 vlan 101-200
 name MY-REGION
 revision 1
!
interface GigabitEthernet0/1
 spanning-tree mst 1 port-priority 128
 spanning-tree mst 2 cost 1000

3. VLANs (Virtual LANs - 802.1Q)

3.1 VLAN Concepts

VLANs divide a switch into multiple logical broadcast domains.

Diagramme en cours de génération...

3.2 802.1Q Tagging

Diagramme en cours de génération...

TCI (Tag Control Information):

  • Priority (3 bits): 802.1p CoS
  • DEI (1 bit): Drop Eligible Indicator
  • VID (12 bits): VLAN ID (1-4094)

3.3 Access and Trunk Ports

Port TypeVLAN HandlingUse
AccessSingle untagged VLANEnd device (PC, printer)
TrunkMultiple tagged VLANsSwitch-to-switch, router
HybridMix of tagged/untaggedVoIP phones, some APs
! Access port
interface GigabitEthernet0/1
 switchport mode access
 switchport access vlan 10
 spanning-tree portfast

! Trunk port
interface GigabitEthernet0/24
 switchport mode trunk
 switchport trunk native vlan 990
 switchport trunk allowed vlan 10,20,30,100-200
 switchport nonegotiate

! Router-on-a-stick
interface GigabitEthernet0/0.10
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0
!
interface GigabitEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.20.1 255.255.255.0

4. VXLAN (Virtual Extensible LAN)

4.1 VXLAN Overview

VXLAN extends Layer 2 over Layer 3 networks using MAC-in-UDP encapsulation.

Diagramme en cours de génération...

4.2 VXLAN Header

Outer MAC | Outer IP | UDP (4789) | VXLAN (24-bit VNI) | Inner MAC | Payload

Advantages over VLAN:

  • 16 million VNIs (vs 4094 VLANs)
  • Span Layer 3 boundaries
  • ECMP load balancing (UDP)

4.3 VXLAN with BGP EVPN

Diagramme en cours de génération...

5. Link Aggregation (LACP - 802.3ad/802.1AX)

5.1 LACP Concepts

Combine multiple physical links into one logical link.

Diagramme en cours de génération...

Benefits:

  • Increased bandwidth (up to 8 links)
  • Load balancing (per-flow)
  • Redundancy (link failure)

5.2 LACP Modes

ModeDescription
ActiveSends and receives LACP PDUs
PassiveReceives and responds to LACP PDUs
OnStatic (no LACP negotiation)
interface Port-channel1
 description Link to SW2
 switchport mode trunk
!
interface range GigabitEthernet0/1-4
 channel-group 1 mode active
 channel-protocol lacp
!
show etherchannel summary
show lacp neighbor

6. MLAG / VPC

Multi-chassis Link Aggregation allows a server to connect to two switches as one logical switch.

Diagramme en cours de génération...

7. Stacking vs Chassis

AspectStackingChassis
Form factorMultiple switchesSingle large chassis
ManagementSingle IPSingle IP
Control planeDistributed/Active-StandbyCentralized (line cards)
BandwidthStack ring (40-160 Gbps)Backplane (Tbps)
ModularityAdd/remove flexiblyLine cards
ExampleCisco 3750 StackWiseCisco 9500, NCS 5500

8. QoS (Quality of Service)

8.1 CoS and DSCP

Diagramme en cours de génération...

DSCP PHB (Per-Hop Behavior):

ClassDSCP ValueUse
CS00Best effort
AF4134Video streaming
EF46Voice (strict priority)
CS756Network control

8.2 Queuing

Diagramme en cours de génération...

8.3 Shaping vs Policing

FeatureShapingPolicing
ActionBuffers excess trafficDrops/re-marks excess
Traffic patternSmooth (buffered)Conforms or drops
LocationEgressIngress or egress
Re-markNo (unless exceed)Yes (conform/exceed)

9. Summary

TechnologyStandardPurpose
STP802.1DLoop prevention
RSTP802.1wFast convergence
MSTP802.1sMultiple VLANs per instance
VLAN802.1QBroadcast domain segmentation
VXLANRFC 7348L2 over L3 extension
LACP802.1AXLink aggregation

10. Exercises

Exercise 1: STP Root Election

Four switches: SW1 (MAC 00:11:11:11:11:11, priority 32768), SW2 (MAC 00:22:22:22:22:22, priority 4096), SW3 (MAC 00:33:33:33:33:33, priority 32768), SW4 (MAC 00:44:44:44:44:44, priority 32768). Who is root?

Exercise 2: VLAN Design

Design VLANs for: Management (50 hosts), Voice (200 phones), Data (1000 users), Guest (100 users), Servers (50 servers). Assign appropriate subnets and VLAN IDs.

Exercise 3: LACP Configuration

Write the configuration for a LACP port channel with 4 ports (Gi0/1-4) in active mode.

Exercise 4: VXLAN vs VLAN

List 3 advantages of VXLAN over VLAN.