MFormations
Modern Network Engineering

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

AspectStatic RoutingDynamic Routing
ConfigurationManualAutomatic
ScalabilitySmall networksLarge networks
AdaptabilityNoneReacts to changes
SecurityHighLower
CPU/MemoryNoneUses resources
Use caseStub networks, defaultsCore, 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

FeatureOSPFv2OSPFv3
ProtocolIPv4IPv6
Address familiesIPv4 onlyIPv6 (can carry IPv4 in AF)
Router ID32-bit32-bit (still needs IPv4)
AuthenticationPlain/MD5IPsec AH
Instance IDNoYes
LSA formatAddress-dependentAddress-independent

2.3 OSPF Areas

Diagramme en cours de génération...
Area TypeDescription
Backbone (0)Must be contiguous, connects all areas
StandardFull LSDB, all LSA types
StubNo external routes (Type 5 blocked)
Totally StubbyNo external or inter-area routes (Type 3,4,5 blocked)
NSSALike stub but allows limited external routes (Type 7)
Totally NSSANSSA + no inter-area summaries

2.4 OSPF Router Types

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

2.5 OSPF LSA Types

TypeNameDescription
1Router LSAEach router's links and costs
2Network LSADR (Designated Router) on broadcast segments
3Summary LSAInter-area routes (ABR advertises)
4ASBR Summary LSARoute to ASBR
5External LSAExternal routes redistributed
6Group Membership LSAMOSPF (obsolete)
7NSSA External LSAExternal routes in NSSA
8External Attributes LSABGP attributes
9-11Opaque LSAsExtensibility (TE, Graceful Restart)

2.6 OSPF Network Types

Network TypeDR/BDRHelloAdjacency
BroadcastYes10sAutomatic
Non-BroadcastYes30sManual
Point-to-PointNo10sAutomatic
Point-to-MultipointNo30sAutomatic

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

FeatureeBGPiBGP
PeersDifferent ASSame AS
TTL1 (default)255
Next-hopChangesPreserved
AD20200
Full meshNo requirementRequired (or route-reflector)
Diagramme en cours de génération...

3.3 BGP Path Attributes

AttributeTypeDescription
WEIGHTCisco proprietaryLocal preference (higher is better)
LOCAL_PREFWell-knownBest path selection (higher is better)
AS_PATHWell-known mandatoryLoop prevention and path length
ORIGINWell-known mandatoryIGP, EGP, Incomplete
MEDOptional non-transitiveMulti-Exit Discriminator (lower is better)
NEXT_HOPWell-known mandatoryNext-hop IP
COMMUNITYOptional transitivePolicy tagging
AGGREGATOROptional transitiveRoute 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-ISOSPF
IS (Router)Router
ES (Host)Host
DIS (Designated IS)DR
LSP (Link State PDU)LSA
Level 1Intra-area
Level 2Backbone
L1/L2ABR-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

ProtocolTypeAlgorithmMetricUse Case
OSPFIGPSPFCostEnterprise, DC
IS-ISIGPSPFMetricSP, large networks
BGPEGPPath vectorPoliciesInternet, MPLS VPN
BFDDetectionEcho/HelloN/AFast 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).