CSS334 — Control Plane, Routing Algorithms & SDN Cheat Sheet
Exam-ready summary | Lecture 10 | All topics included
0. Control Plane: Two Approaches
| Approach | How | Example |
|---|---|---|
| Per-Router (Traditional) | Each router runs its own routing algorithm independently | OSPF, RIP, BGP |
| Logically Centralized (SDN) | Remote controller computes routes, pushes to all routers | OpenFlow |
Per-Router: Like every taxi driver independently knowing the city map — no central dispatcher.
SDN: Like separating the GPS app (control plane) from the car's engine (data plane) — updatable independently.
1. Graph Abstraction of a Network
Network = graph
- = set of routers (nodes):
- = set of links (edges):
- = cost of direct link between nodes and
- if and are not direct neighbours
Cost can represent:
- Always 1 (hop count)
- Inversely proportional to bandwidth (lower bandwidth = higher cost)
- Inversely proportional to congestion
- Operator-defined metric
Analogy: Like a GPS map where road "costs" can represent distance, traffic, or road quality.
2. Routing Algorithm Classification
By Information Type (more important for exam)
| Type | Who knows what | Algorithm | Protocol |
|---|---|---|---|
| Global (Link State) | All routers know complete topology + all link costs | Dijkstra | OSPF |
| Decentralized (Distance Vector) | Router knows only neighbours' costs; learns iteratively | Bellman-Ford | RIP, EIGRP |
By Rate of Change
| Type | Description |
|---|---|
| Static | Routes change slowly; human manually updates |
| Dynamic | Routes update automatically on topology changes |
3. Dijkstra's Link-State Algorithm
Properties
- Global: requires complete topology known to all nodes (distributed via link-state broadcast)
- Computes least-cost path from one source to all other nodes
- Builds the forwarding table for that source router
- Iterative: after iterations, knows least-cost path to destinations
Notation
| Symbol | Meaning |
|---|---|
| Direct link cost from to ; if not direct neighbours | |
| Current best known cost from source to node | |
| Predecessor node on the best known path to | |
| Set of nodes whose final least-cost path is confirmed |
Pseudocode
Initialization:
N' = {u} ← start: only source is confirmed
for all nodes v:
if v is adjacent to u:
D(v) = c(u, v), p(v) = u
else:
D(v) = ∞
Loop (repeat until all nodes in N'):
find node a NOT in N' with minimum D(a)
add a to N' ← a is now confirmed
for all b adjacent to a, b NOT in N':
D(b) = min( D(b), D(a) + c(a, b) )
if updated: p(b) = a
Key Update Formula
Analogy: Google Maps updating your ETA at every turn — always keeps the shortest known path, revises when a faster route is found.
Worked Example (source = u)
Graph: u–v(2), u–x(1), u–w(5), v–x(2), v–w(3), x–w(3), x–y(1), w–y(1), w–z(5), y–z(2)
| Step | ||||||
|---|---|---|---|---|---|---|
| 0 | {u} | 2, u | 5, u | 1, u | ∞ | ∞ |
| 1 | {u,x} | 2, u | 4, x | — | 2, x | ∞ |
| 2 | {u,x,y} | 2, u | 3, y | — | — | 4, y |
| 3 | {u,x,y,v} | — | 3, y | — | — | 4, y |
| 4 | {u,x,y,v,w} | — | — | — | — | 4, y |
| 5 | {u,x,y,v,w,z} | — | — | — | — | — |
Reading the table: means: cost to is 3, reached via .
Resulting Forwarding Table (from u)
| Destination | Next Hop (Outgoing link) | Total Cost |
|---|---|---|
| v | (u,v) | 2 |
| x | (u,x) | 1 |
| y | (u,x) → x → y | 2 |
| w | (u,x) → x → y → w | 3 |
| z | (u,x) → x → y → z | 4 |
Everything from u routes through
(u,x)except the direct link to v — x is the central hub in this topology.
4. Distance Vector (DV) Algorithm
Bellman-Ford Equation
- = node 's estimate of least-cost path to destination
- taken over all direct neighbours of
- = direct link cost from to neighbour
- = neighbour 's reported cost to reach
Analogy: Ask all your friends "how far are you from the airport?" Then pick whichever friend is cheapest to reach + they're cheapest to the airport.
Worked Example
For node finding cost to (neighbours: v, x, w):
→ Next hop to from = x (the one achieving the minimum)
How DV Works in Practice
- Each node initialises its DV: ,
- Each node periodically sends its DV to all direct neighbours
- On receiving a neighbour's DV, update own DV using Bellman-Ford
- Only notify neighbours if DV changed (self-stopping)
State diffusion speed:
| Time | Info reaches |
|---|---|
| t=0 | Only source node |
| t=1 | 1-hop neighbours |
| t=2 | 2-hop neighbours |
| t=n | n-hop neighbours |
Analogy: Rumour spreading through a social network — each round of gossip spreads info one more hop.
"Good News Travels Fast"
- Link cost decreases → converges in 2 steps (fast ✅)
- Link cost increases → can cause count-to-infinity problem (slow ⚠️)
5. DV vs LS Comparison
| Feature | Distance Vector (DV) | Link State (LS) |
|---|---|---|
| Topology knowledge | Only neighbours | Full network topology |
| Algorithm | Bellman-Ford | Dijkstra |
| Convergence | Slow (iterative gossip) | Fast (full view) |
| Updates sent | Frequently (periodic) | Event-triggered (on change only) |
| Routing loops | Prone (count-to-infinity) | Less susceptible |
| Configuration | Easy | More complex |
| Scalability | Limited | Highly scalable (with hierarchy) |
| Metric used | Hop count | Link cost (bandwidth-based) |
| Protocols | RIP, IGRP, EIGRP | OSPF, IS-IS |
DV = asking friends for directions (each only knows their local area).
LS = having a complete city map yourself.
6. Scalable Routing: Autonomous Systems (AS)
Why AS?
- Scale: Billions of destinations → impossible to store all in one routing table
- Administrative autonomy: Each organisation controls its own routing policy
- Solution: Group routers into Autonomous Systems (AS) — a network under single admin control
Two Levels of Routing
| Level | Scope | Protocol examples | Routers involved |
|---|---|---|---|
| Intra-AS | Within one AS | OSPF, RIP, EIGRP | All routers in the AS |
| Inter-AS | Between ASes | BGP | Gateway routers at AS edges |
- Gateway router: edge router of an AS — has links to routers in other ASes
- Gateway routers run both intra-AS (e.g., OSPF) and inter-AS (BGP) protocols simultaneously
- Forwarding table built by combining intra-AS + inter-AS routing info
7. Intra-AS Routing Protocols
RIP — Routing Information Protocol (RFC 1723)
- Type: Distance Vector
- Metric: Hop count
- Max hops: 15 (hop count = 16 → destination unreachable/∞)
- Sends full routing table to neighbours every 30 seconds
- Administrative distance: 120
- Multicast address:
224.0.0.9 - No longer widely used
RIPv1 vs RIPv2
| Feature | RIPv1 | RIPv2 |
|---|---|---|
| Addressing | Classful only | Classless (CIDR) |
| Updates | Broadcast | Multicast (224.0.0.9) |
| VLSM support | ❌ No | ✅ Yes |
| Authentication | ❌ No | ✅ Yes |
| Update trigger | Every 30s only | Triggered on change |
RIP's fatal flaw: Max 15 hops — useless for large networks. Modern Internet has far more than 15 hops.
EIGRP — Enhanced Interior Gateway Routing Protocol
- Type: Advanced Distance Vector (Hybrid) — developed by Cisco, open standard since 2013 (RFC 7868)
- Very fast convergence with minimal bandwidth usage
- Enhancement of IGRP
Composite Metric (default = Bandwidth + Delay):
| Component | How | Recommended? |
|---|---|---|
| Bandwidth | Slowest (min) bandwidth along the path | ✅ Yes |
| Delay | Sum of all interface delays (×10 µs) | ✅ Yes |
| Reliability | Worst reliability on any link in path | ⚠️ No — causes frequent recalculation |
| Load | Worst load on any link in path | ⚠️ No — same reason |
OSPF — Open Shortest Path First (RFC 2328)
- Type: Link State
- Algorithm: Dijkstra (each router computes full shortest-path tree)
- "open": publicly available (non-proprietary) standard
- Each router floods OSPF link-state advertisements (LSAs) to every router in the entire AS
- Carried directly over IP (not TCP/UDP) — Protocol number 89
- Security: All OSPF messages authenticated (prevents malicious injection)
- Multiple cost metrics: bandwidth, delay, etc.
Hierarchical OSPF (Two-Level)
┌─────────────────────────────────────────────┐
│ Backbone │ ← backbone routers + area border routers
│ (Area 0 — links ASes together) │
└───────┬──────────────────────┬──────────────┘
│ │
┌────▼────┐ ┌────▼────┐
│ Area 1 │ │ Area 2 │ ← internal routers flood LS only within area
└─────────┘ └─────────┘
| Router Type | Role |
|---|---|
| Internal routers | Flood LS within their own area; compute intra-area routes |
| Area border routers | Summarise distances to own-area destinations → advertise in backbone |
| Backbone routers | Run OSPF limited to backbone (Area 0) |
| Boundary routers | Connect to other ASes (run BGP) |
Benefit of hierarchy: LS advertisements flood only within an area — backbone area never flooded with every internal link. Greatly reduces update traffic for large networks.
Dynamic Routing Protocol Comparison
| Feature | RIP | OSPF | EIGRP |
|---|---|---|---|
| Type | Distance Vector | Link State | Adv. DV |
| Algorithm | Bellman-Ford | Dijkstra | DUAL |
| Metric | Hop count | Link cost | BW + Delay |
| Convergence | Slow | Fast | Very fast |
| VLSM support | No (v2: Yes) | ✅ Yes | ✅ Yes |
| Bandwidth usage | High (full table every 30s) | Low | Low |
| Resource usage | Low | High (stores full topology) | Low |
| Multiple path support | No | ✅ Yes | ✅ Yes |
| Scalability | Poor (max 15 hops) | ✅ Yes (hierarchical) | ✅ Yes |
| Proprietary | No | No | Yes (Cisco) |
| Update style | Full table, periodic | Triggered, partial | Triggered, partial |
Why OSPF/EIGRP are faster than RIP: They only send what changed, not the full table. RIP sends its entire routing table every 30 seconds regardless.
8. Inter-AS Routing: BGP
BGP = "the glue that holds the Internet together"
What is BGP?
- Border Gateway Protocol — the de facto standard inter-AS routing protocol
- Protocol type: Path Vector (advertises complete AS-path, not just cost)
- Allows each subnet to advertise its existence to the rest of the Internet
- Two BGP routers ("peers") exchange messages over TCP
eBGP vs iBGP
| Protocol | Scope | Purpose |
|---|---|---|
| eBGP | Between ASes | Learn reachability from neighbouring ASes |
| iBGP | Within one AS | Propagate reachability info to all routers inside AS |
Gateway routers run both eBGP and iBGP simultaneously.
BGP Path Advertisement Flow
X (new subnet) joins AS3
Step 1: AS3 gateway (3a) → announces "AS3, X" to AS2 via eBGP
Step 2: AS2 propagates "AS3, X" to all AS2 routers via iBGP
Step 3: AS2 gateway (2a) → announces "AS2, AS3, X" to AS1 via eBGP
Step 4: AS1 now knows: to reach X, go through AS2 → AS3
BGP Path Attributes
- AS-PATH: list of all ASes the advertisement has passed through
- e.g.,
AS2 AS3means "pass through AS2 then AS3 to reach destination" - Used to detect loops (if own AS number appears → discard)
- e.g.,
- NEXT-HOP: IP address of the router at the entry point of the next AS
BGP Route Selection (Priority Order)
- Local preference value — policy decision set by admin (highest = preferred)
- Shortest AS-PATH — fewest ASes to traverse
- Closest NEXT-HOP — hot potato routing: pick the gateway with the lowest intra-AS cost to reach the next-hop router (get rid of the packet as fast as possible within your AS)
- Additional tiebreaking criteria
Hot potato routing: "I have a hot potato — throw it to the nearest exit as fast as possible!" Don't care what happens after it leaves your AS.
Policy-Based Routing
- Each AS can use import policy to decide whether to accept a route
- Each AS can decide whether to advertise (export) a path to its neighbours
- Example: AS2 may learn a path but refuse to advertise it to AS1 (commercial reasons)
- Policy dominates over performance in inter-AS routing — unlike intra-AS
Why Different Intra-AS vs Inter-AS?
| Dimension | Intra-AS | Inter-AS (BGP) |
|---|---|---|
| Policy | Single admin — less of an issue | Each AS has its own traffic policies |
| Performance | Can optimise for speed/cost | Policy often overrides performance |
| Scale | Hierarchical area design | Route aggregation at AS boundaries |
9. SDN Control Plane
Motivation: Problems with Traditional Routing
- Each router runs proprietary OS (e.g., Cisco IOS) — hard to program
- Traffic engineering is very difficult:
- Want to force path
u→v→w→zinstead ofu→x→y→z? → Must re-define ALL link weights - Want load balancing across both paths? → Can't do with traditional routing
- Want different routing based on source IP? → Can't do with destination-based forwarding
- Want to force path
SDN Solution
Key insight: Separate the Control Plane (brain) from the Data Plane (body)
| Plane | Role | Location |
|---|---|---|
| Control Plane | Calculates routes, policies | Remote controller (server) |
| Data Plane | Actually forwards packets | Each switch (hardware) |
4 Key SDN Characteristics
- Generalised "flow-based" forwarding — match on any header field, not just dest IP
- Control/data plane separation — control runs on separate servers
- Control plane external to data-plane switches — switches are "dumb" fast hardware
- Programmable control applications — routing, firewall, load balancer all as software apps
SDN Architecture (3 Layers)
┌──────────────────────────────────────────────┐
│ Network-Control Applications │ ← "Brains": routing, firewall, load balance
│ (Routing) (Access Control) (Load Bal.) │ (can be 3rd party!)
└──────────────┬───────────────────────────────┘
│ northbound API (REST)
┌──────────────▼───────────────────────────────┐
│ SDN Controller (Network OS) │ ← Control Plane
│ state management + network-wide view │ (distributed system for fault-tolerance)
└──────────────┬───────────────────────────────┘
│ southbound API (OpenFlow)
┌──────────────▼───────────────────────────────┐
│ SDN-Controlled Switches │ ← Data Plane
│ (fast commodity hardware, flow tables) │ (no routing logic — just match+action)
└──────────────────────────────────────────────┘
| API Direction | Name | Connects |
|---|---|---|
| Northbound API | REST API / Intent | Controller ↔ Network apps (routing, firewall) |
| Southbound API | OpenFlow / SNMP | Controller ↔ Switches (installs flow tables) |
SDN Controller Components (3 Layers Internal)
| Layer | Contents |
|---|---|
| Interface Layer | Abstractions/API for network control apps; network graph; RESTful API |
| State Management | Distributed DB: flow tables, link-state info, host/switch info, statistics |
| Communication Layer | OpenFlow protocol, SNMP — talks to controlled devices |
SDN Link Failure Example (End-to-End Flow)
1. Switch S1 detects link failure
→ sends OpenFlow "port status" message to SDN controller
2. SDN controller receives message
→ updates link-state info in state DB
3. Dijkstra routing app (listening for link changes) is triggered
→ reads updated network graph from controller
4. Dijkstra computes new shortest paths
5. Flow-table computation component calculates new flow tables
6. SDN controller pushes new flow tables to affected switches via OpenFlow
10. Generalised Forwarding & OpenFlow
Match Plus Action
| Forwarding Type | Match Field | Action |
|---|---|---|
| Destination-based | Dest. IP address only | Forward out specific link |
| Generalised (OpenFlow) | Any header field | drop / copy / modify / log / forward |
Flow Table Entry Structure
| Match (header fields) | Action | Stats (counters) |
|---|---|---|
| src IP, dst IP, src/dst port, MAC, VLAN, etc. | forward(port) / drop / modify / send-to-controller | #bytes, #packets |
Priority field: disambiguates overlapping rules (higher priority wins)
Matchable Header Fields (OpenFlow — across all layers)
| Layer | Fields available to match |
|---|---|
| Link (L2) | Ingress Port, Src MAC, Dst MAC, Eth Type, VLAN ID, VLAN Pri |
| Network (L3) | IP Src, IP Dst, IP Protocol, IP ToS/DSCP |
| Transport (L4) | TCP/UDP Src Port, TCP/UDP Dst Port |
OpenFlow Actions Available
- Forward packet to specific port(s)
- Drop packet
- Modify fields in header (change src/dst IP, port, MAC, VLAN — like NAT!)
- Encapsulate and send to controller
OpenFlow Examples
Router behaviour (dest-based forwarding):
match: IP Dst = 51.6.0.8 → action: forward(port 6)
Firewall behaviour (block SSH):
match: TCP d-port = 22 → action: drop
Firewall behaviour (block specific host):
match: IP Src = 128.119.1.1 → action: drop
NAT behaviour:
match: IP address + port → action: rewrite address and port
OpenFlow Unifies All Network Devices
| Traditional Device | OpenFlow Match | OpenFlow Action |
|---|---|---|
| Router | Longest dst IP prefix | Forward out a link |
| Switch | Destination MAC | Forward or flood |
| Firewall | IP addr + TCP/UDP port | Permit or deny |
| NAT | IP addr + port | Rewrite address and port |
One device (SDN switch) can act as router, switch, firewall, NAT simultaneously — just program different flow table entries!