Chapitre 4
Chapter 04: Routage
Chapter 04: Routage
Chapter 04: Routage
1. Routing Fundamentals
1.1 What is Routing?
Routing is the process of selecting paths across a network to deliver packets. A router examines the destination IP address and consults its routing table to determine the next hop.
Diagramme en cours de génération...
Routing table entry: destination_network next_hop interface metric
1.2 Static vs Dynamic Routing
| Aspect | Static Routing | Dynamic Routing |
|---|---|---|
| Configuration | Manual | Automatic |
| Scalability | Small networks | Large networks |
| Adaptability | None | Reacts to changes |
| Security | High | Lower |
| CPU/Memory | None | Uses resources |
| Use case | Stub networks, defaults | Core, distribution |
1.3 Static Route Configuration
# Cisco IOS
ip route 192.168.2.0 255.255.255.0 10.0.0.2
ip route 0.0.0.0 0.0.0.0 10.0.0.1 # default route
ip route 0.0.0.0 0.0.0.0 10.0.0.1 10 # floating static (AD=10)
1.4 Dynamic Routing Protocol Classes
Diagramme en cours de génération...
2. OSPF (Open Shortest Path First)
2.1 OSPF Overview
OSPF is a link-state IGP that uses the SPF (Dijkstra) algorithm to compute shortest paths.
Key features:
- Classless (supports VLSM/CIDR)
- Fast convergence
- Loop-free (SPF ensures no loops)
- Hierarchical (areas)
- Authentication support
- Equal-cost multipath (ECMP)
2.2 OSPFv2 vs OSPFv3
| Feature | OSPFv2 | OSPFv3 |
|---|---|---|
| Protocol | IPv4 | IPv6 |
| Address families | IPv4 only | IPv6 (can carry IPv4 in AF) |
| Router ID | 32-bit | 32-bit (still needs IPv4) |
| Authentication | Plain/MD5 | IPsec AH |
| Instance ID | No | Yes |
| LSA format | Address-dependent | Address-independent |
2.3 OSPF Areas
Diagramme en cours de génération...
| Area Type | Description |
|---|---|
| Backbone (0) | Must be contiguous, connects all areas |
| Standard | Full LSDB, all LSA types |
| Stub | No external routes (Type 5 blocked) |
| Totally Stubby | No external or inter-area routes (Type 3,4,5 blocked) |
| NSSA | Like stub but allows limited external routes (Type 7) |
| Totally NSSA | NSSA + no inter-area summaries |
2.4 OSPF Router Types
Diagramme en cours de génération...
2.5 OSPF LSA Types
| Type | Name | Description |
|---|---|---|
| 1 | Router LSA | Each router's links and costs |
| 2 | Network LSA | DR (Designated Router) on broadcast segments |
| 3 | Summary LSA | Inter-area routes (ABR advertises) |
| 4 | ASBR Summary LSA | Route to ASBR |
| 5 | External LSA | External routes redistributed |
| 6 | Group Membership LSA | MOSPF (obsolete) |
| 7 | NSSA External LSA | External routes in NSSA |
| 8 | External Attributes LSA | BGP attributes |
| 9-11 | Opaque LSAs | Extensibility (TE, Graceful Restart) |
2.6 OSPF Network Types
| Network Type | DR/BDR | Hello | Adjacency |
|---|---|---|---|
| Broadcast | Yes | 10s | Automatic |
| Non-Broadcast | Yes | 30s | Manual |
| Point-to-Point | No | 10s | Automatic |
| Point-to-Multipoint | No | 30s | Automatic |
2.7 OSPF Configuration
! OSPFv2 Configuration
router ospf 1
router-id 1.1.1.1
auto-cost reference-bandwidth 100000 ! 100 Gbps reference
network 10.0.0.0 0.255.255.255 area 0
!
interface GigabitEthernet0/0
ip ospf cost 10
ip ospf priority 100
ip ospf hello-interval 5
ip ospf dead-interval 20
2.8 OSPF Path Selection
Diagramme en cours de génération...
OSPF Metrics:
- Cost = reference_bandwidth / interface_bandwidth
- Default reference: 100 Mbps (100 / 100 = cost 1 for FastEthernet)
- Modern reference: 100 Gbps (100000 / bandwidth in Mbps)
3. BGP (Border Gateway Protocol)
3.1 BGP Overview
BGP is an EGP path-vector protocol that routes between autonomous systems (AS). It is the routing protocol of the Internet.
Key features:
- Policy-based routing
- AS-path loop prevention
- CIDR support
- Route aggregation
- Communities for policy tags
- TCP port 179
3.2 eBGP vs iBGP
| Feature | eBGP | iBGP |
|---|---|---|
| Peers | Different AS | Same AS |
| TTL | 1 (default) | 255 |
| Next-hop | Changes | Preserved |
| AD | 20 | 200 |
| Full mesh | No requirement | Required (or route-reflector) |
Diagramme en cours de génération...
3.3 BGP Path Attributes
| Attribute | Type | Description |
|---|---|---|
| WEIGHT | Cisco proprietary | Local preference (higher is better) |
| LOCAL_PREF | Well-known | Best path selection (higher is better) |
| AS_PATH | Well-known mandatory | Loop prevention and path length |
| ORIGIN | Well-known mandatory | IGP, EGP, Incomplete |
| MED | Optional non-transitive | Multi-Exit Discriminator (lower is better) |
| NEXT_HOP | Well-known mandatory | Next-hop IP |
| COMMUNITY | Optional transitive | Policy tagging |
| AGGREGATOR | Optional transitive | Route aggregation info |
3.4 BGP Best Path Selection
Diagramme en cours de génération...
3.5 BGP Configuration
! Basic eBGP Configuration
router bgp 65001
bgp log-neighbor-changes
bgp router-id 1.1.1.1
!
neighbor 203.0.113.2 remote-as 65002
neighbor 203.0.113.2 description eBGP-Peer
neighbor 203.0.113.2 update-source Loopback0
neighbor 203.0.113.2 ebgp-multihop 2
neighbor 203.0.113.2 password MySecret
!
address-family ipv4
network 192.168.1.0 mask 255.255.255.0
neighbor 203.0.113.2 activate
neighbor 203.0.113.2 route-map INBOUND in
neighbor 203.0.113.2 route-map OUTBOUND out
neighbor 203.0.113.2 prefix-list FILTER-IN in
exit-address-family
3.6 BGP Communities
Well-known communities:
- NO_EXPORT (0xFFFFFF01): Don't advertise outside confederation
- NO_ADVERTISE (0xFFFFFF02): Don't advertise to any peer
- NO_EXPORT_SUBCONFED (0xFFFFFF03): Don't advertise outside AS
- LOCAL_AS (0xFFFFFF03): Don't advertise to iBGP peers
3.7 Route Reflectors and Confederations
Diagramme en cours de génération...
4. IS-IS (Intermediate System to Intermediate System)
4.1 IS-IS Overview
IS-IS is a link-state IGP originally designed for OSI (CLNS) but extended for IP.
Key features:
- Same algorithm as OSPF (SPF)
- CLNS native (NET addresses)
- True "dual stack" from the start
- Common in Service Provider networks
- Uses TLVs for extensibility
4.2 IS-IS Terminology vs OSPF
| IS-IS | OSPF |
|---|---|
| IS (Router) | Router |
| ES (Host) | Host |
| DIS (Designated IS) | DR |
| LSP (Link State PDU) | LSA |
| Level 1 | Intra-area |
| Level 2 | Backbone |
| L1/L2 | ABR-like |
| NET (Network Entity Title) | Router ID |
4.3 IS-IS Configuration
! IS-IS Configuration
router isis
net 49.0001.0000.0000.0001.00
is-type level-2-only
metric-style wide
!
interface GigabitEthernet0/0
ip router isis
isis metric 10
isis circuit-type level-2
5. BFD (Bidirectional Forwarding Detection)
BFD provides fast failure detection for routing protocols.
Diagramme en cours de génération...
BFD Configuration:
interface GigabitEthernet0/0
bfd interval 50 min_rx 50 multiplier 3
!
router ospf 1
bfd all-interfaces
6. VRF (Virtual Routing and Forwarding)
VRF allows multiple routing tables on a single router.
Diagramme en cours de génération...
VRF Configuration:
ip vrf CUSTOMER-A
rd 65001:100
route-target export 65001:100
route-target import 65001:100
!
interface GigabitEthernet0/0.100
encapsulation dot1Q 100
ip vrf forwarding CUSTOMER-A
ip address 192.168.1.1 255.255.255.0
7. Route Maps and Prefix Lists
7.1 Prefix Lists
! Match 10.0.0.0/8 with le 24 prefix length
ip prefix-list EXAMPLE seq 5 permit 10.0.0.0/8 le 24
ip prefix-list BLOCK seq 10 deny 192.168.0.0/16
ip prefix-list BLOCK seq 20 permit 0.0.0.0/0 le 32
7.2 Route Maps
route-map SET-LOCAL-PREF permit 10
match ip address prefix-list IMPORTANT
set local-preference 200
!
route-map SET-LOCAL-PREF permit 20
set local-preference 100
8. MPLS (Multi-Protocol Label Switching)
8.1 MPLS Concepts
MPLS sits between Layer 2 and Layer 3, using labels for forwarding.
Diagramme en cours de génération...
8.2 MPLS Header
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Label | TC | S | TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Label: 20 bits (forwarding value)
- TC: Traffic Class (3 bits, former EXP)
- S: Bottom of Stack (1 bit)
- TTL: Time to Live (8 bits)
8.3 LDP (Label Distribution Protocol)
Diagramme en cours de génération...
9. Summary
| Protocol | Type | Algorithm | Metric | Use Case |
|---|---|---|---|---|
| OSPF | IGP | SPF | Cost | Enterprise, DC |
| IS-IS | IGP | SPF | Metric | SP, large networks |
| BGP | EGP | Path vector | Policies | Internet, MPLS VPN |
| BFD | Detection | Echo/Hello | N/A | Fast convergence |
10. Exercises
Exercise 1: OSPF Cost Calculation
Calculate OSPF cost for:
- 1 Gbps interface (reference 100 Gbps)
- 10 Gbps interface (reference 100 Gbps)
- 100 Mbps interface (reference 100 Mbps)
Exercise 2: BGP Path Selection
Which path is chosen given:
- Path A: LOCAL_PREF=200, AS_PATH=65001 65002, MED=50
- Path B: LOCAL_PREF=200, AS_PATH=65001, MED=100
- Path C: LOCAL_PREF=100, AS_PATH=65001 65002 65003, MED=10
Exercise 3: Route Summarization
Summarize: 10.1.0.0/24, 10.1.1.0/24, 10.1.2.0/24, 10.1.3.0/24
Exercise 4: MPLS Label Stack
Draw the MPLS label stack for a VPNv4 packet with 2 labels (VPN label + transport label).