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 Type | Action |
|---|---|
| Known unicast | Forward to specific port |
| Unknown unicast | Flood all ports (except source) |
| Broadcast (FF:FF:FF:FF:FF:FF) | Flood all ports |
| Multicast | Flood or forward if IGMP snooping |
1.3 Switch Forwarding Methods
| Method | Description | Latency |
|---|---|---|
| Store-and-forward | Receive entire frame, check CRC, then forward | Highest |
| Cut-through | Forward as soon as dest MAC read | Lowest |
| Fragment-free | Forward after first 64 bytes | Medium |
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:
- Lowest Bridge ID (Priority + MAC)
- Lowest Path Cost to Root
- Lowest Sender Bridge ID
- Lowest Sender Port ID
2.3 Port Roles and States
Diagramme en cours de génération...
STP Port States:
| State | Forwarding MAC | Learning MAC | Purpose |
|---|---|---|---|
| Blocking | No | No | No BPDU received yet |
| Listening | No | No | Transition after block |
| Learning | No | Yes | Building MAC table |
| Forwarding | Yes | Yes | Normal operation |
| Disabled | No | No | Administratively down |
Timers:
- Hello Time: 2 seconds
- Forward Delay: 15 seconds (listening + learning)
- Max Age: 20 seconds
2.4 RSTP (Rapid Spanning Tree - 802.1w)
| Feature | STP (802.1D) | RSTP (802.1w) |
|---|---|---|
| Convergence | 30-50 seconds | <10 seconds |
| Port roles | Root, Designated, Blocked | Root, Designated, Alternate, Backup |
| Port states | 5 states | 3 states (Discarding, Learning, Forwarding) |
| Edge ports | No | Yes (portfast) |
| Link type | No distinction | Shared 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 Type | VLAN Handling | Use |
|---|---|---|
| Access | Single untagged VLAN | End device (PC, printer) |
| Trunk | Multiple tagged VLANs | Switch-to-switch, router |
| Hybrid | Mix of tagged/untagged | VoIP 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
| Mode | Description |
|---|---|
| Active | Sends and receives LACP PDUs |
| Passive | Receives and responds to LACP PDUs |
| On | Static (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
| Aspect | Stacking | Chassis |
|---|---|---|
| Form factor | Multiple switches | Single large chassis |
| Management | Single IP | Single IP |
| Control plane | Distributed/Active-Standby | Centralized (line cards) |
| Bandwidth | Stack ring (40-160 Gbps) | Backplane (Tbps) |
| Modularity | Add/remove flexibly | Line cards |
| Example | Cisco 3750 StackWise | Cisco 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):
| Class | DSCP Value | Use |
|---|---|---|
| CS0 | 0 | Best effort |
| AF41 | 34 | Video streaming |
| EF | 46 | Voice (strict priority) |
| CS7 | 56 | Network control |
8.2 Queuing
Diagramme en cours de génération...
8.3 Shaping vs Policing
| Feature | Shaping | Policing |
|---|---|---|
| Action | Buffers excess traffic | Drops/re-marks excess |
| Traffic pattern | Smooth (buffered) | Conforms or drops |
| Location | Egress | Ingress or egress |
| Re-mark | No (unless exceed) | Yes (conform/exceed) |
9. Summary
| Technology | Standard | Purpose |
|---|---|---|
| STP | 802.1D | Loop prevention |
| RSTP | 802.1w | Fast convergence |
| MSTP | 802.1s | Multiple VLANs per instance |
| VLAN | 802.1Q | Broadcast domain segmentation |
| VXLAN | RFC 7348 | L2 over L3 extension |
| LACP | 802.1AX | Link 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.