← Back to Lessons

LESSON 02

SDN Architecture Application Layer Northbound API Control Plane (SDN Controller) Network Intelligence & Routing Logic Southbound API Data Plane (Infrastructure) Switches & Routers - Packet Forwarding Switch 1 Switch 2 Router

Network Control Plane

Data Plane vs. Control Plane

Understanding the difference between these two planes is fundamental to networking:

📦 Data Plane (Forwarding)

What: Moves packets from input to output

Logic: Local, per-router decision

Speed: Nanosecond timescale

Analogy: Train conductor switching tracks

VS

🧭 Control Plane (Routing)

What: Determines the path from source to destination

Logic: Global, network-wide view

Speed: Seconds to minutes

Analogy: GPS planning your route

Real-World Example: When you visit www.google.com:
  • Control Plane: Routing protocols (OSPF, BGP) have already calculated that packets should go: Your Router → ISP Router → Regional Router → Google's Data Center
  • Data Plane: Each router quickly looks at the packet's destination IP and forwards it to the next hop based on its forwarding table

SDN Architecture

Software-Defined Networking (SDN) separates the control plane from the data plane:

Component Traditional Network SDN Network
Control Plane Location In each router Centralized controller
Configuration Manual, per-device Programmatic, network-wide
Intelligence Distributed Logically centralized
Flexibility Vendor-locked Open standards (OpenFlow)

Key Interfaces:

  • Southbound Interface (SBI): Controller ↔ Network Devices. Protocol: OpenFlow, NETCONF
  • Northbound Interface (NBI): Controller ↔ Applications. Protocol: REST APIs
Real-World Example: In a data center with 1000 switches:
  • Traditional: Network admin logs into each switch, configures VLANs manually. Takes days.
  • SDN: Admin writes a Python script that tells the controller: "Create VLAN 100 for the marketing team." Controller pushes config to all switches in seconds.

Routing Algorithms

1. Link-State Routing (Dijkstra's Algorithm)

Used by: OSPF (Open Shortest Path First)

  • How it works: Every router has a complete map of the network topology
  • Process: Each router floods link-state information to all others
  • Algorithm: Dijkstra calculates least-cost path to all destinations
  • Advantage: Fast convergence, loop-free
  • Disadvantage: High memory and CPU usage
Example: Router A wants to reach Router E. It has the full topology:
A--2--B--3--E
     |         |
     5         1
     |         |
     C----4----D
Dijkstra calculates: A→B→D→E (cost: 2+3+1=6) is better than A→C→D→E (cost: 5+4+1=10)

2. Distance-Vector Routing (Bellman-Ford)

Used by: RIP (Routing Information Protocol), EIGRP

  • How it works: Routers only know about their neighbors
  • Process: Iteratively share distance vectors with neighbors
  • Formula: D(x,y) = min{c(x,v) + D(v,y)} for all neighbors v
  • Advantage: Simple, low overhead
  • Disadvantage: Slow convergence, count-to-infinity problem
Example: Router A only knows:
  • B is 2 hops away
  • C is 5 hops away
B tells A: "I can reach E in 3 hops"
A calculates: "I can reach E in 2+3=5 hops through B"

BGP (Border Gateway Protocol)

BGP is the routing protocol of the Internet, routing between Autonomous Systems (AS).

Key Characteristics:

  • Type: Path-vector protocol (enhanced distance-vector)
  • Scope: Inter-AS (between different organizations/ISPs)
  • Policy-Based: Routing decisions based on business policies, not just performance
  • Attributes: AS-PATH, NEXT-HOP, LOCAL-PREF
Real-World Example: When you access Facebook:
  • Your ISP (AS 1234) uses BGP to find a path to Facebook's AS (AS 32934)
  • Multiple paths exist: through Cogent, Level3, or Hurricane Electric
  • BGP selects based on: shortest AS-PATH, business peering agreements, and local preferences
  • Example: Your ISP might prefer the longer path through Level3 because they have a free peering agreement, avoiding paid transit through Cogent

BGP vs. OSPF:

Feature BGP OSPF
Scope Inter-AS (between ISPs) Intra-AS (within organization)
Metric Policy-based Cost-based (bandwidth)
Scalability Internet-scale (millions of routes) Enterprise-scale (thousands)

Data Plane vs. Control Plane

මේව network එකේ මුලින්ම තේරුම් ගන්න ඕන මූලික සංකල්ප:

Data Plane (Forwarding):

මේක වගේ train station එකට සංසන්දනය කරන්න පුළුවන්. Train conductor කෙනෙක්ව tracks switch කරනවා වගේ, router එක incoming packet එකට බලනවා සහ "මේක output port 3 එකට යන්න ඕන" කියලා තීරණය කරනවා. එක local decision එකක් - router එක කොච්චර network එකත් බලන්නේ නෑ, just ඊළඟ router එකට packet එක යවන්න ඕන විතරයි.

උදාහරණය: Packet එක ආවිල්ලා router එකට. Router එක forwarding table එකට බලනවා:

  • Destination IP: 192.168.1.5
  • Table එකේ: "192.168.1.0/24 → Port 3"
  • Router එක: "OK, Port 3 එකට යවනවා" (nanoseconds විතරයි)

Control Plane (Routing):

මේක GPS එක වගේ. ඔයා කොළඹ ඉඳලා කඩුවෙල යන්න ඕන කියලා GPS එකට කිව්වාම, එක මුලින්ම හොඳ route එක සැලසුම් කරනවා (කෑගල්ල හරහාද, කුරුණෑගල හරහාද). එවගේ තමයි Control Plane එක - network එකේ ඇති හැම routers ලා collectively global view එකට බලනවා සහ best paths තීරණය කරනවා.

උදාහරණය: OSPF protocol එක running:

  • Router A: "මම Router B, C, D එකේ කොච්චර දුරෙන් distance එක කියන්න"
  • සියලුම routers share කරනවා ඔවුන්ගේ "link states"
  • එක එක router: "ආහ්, මට network එකේ සම්පූර්ණ map එක තියෙනවා, best path එක ගණනය කරන්න පුළුවන්"
  • කාල පරිමාණය: තත්පර සිට මිනිත්තු (configuration වෙනස් උනාම update වෙනවා)

SDN (Software-Defined Networking)

සාම්ප්‍රදායික network එකක හර් router එකක්ම තමන්ට control plane එක තියෙනවා (distributed intelligence). SDN එකෙන් control plane එක centralized කරනවා - එකම controller එකක් මුලින්ම network එක කළමනාකරණය කරනවා.

සැබෑ ලෝක අවස්ථාව:

Data center එකක් තියෙනවා switches 1000 ක්. Marketing කණ්ඩායමට VLAN එකක් හදන්න ඕන:

සාම්ප්‍රදායික ක්‍රමය:

  • Network engineer කෙනෙක්ව හර් switch එකට login වෙනවා
  • අතින් commands type කරනවා: vlan 100, name Marketing
  • 1000 switches → දවස් වලට යනවා
  • මානව දෝෂ: Switch 347 එකේ typo එකක් උනාම debug කරන්න අමාරුයි

SDN ක්‍රමය:

  • Engineer කෙනෙක්ව Python script එකක් ලියන්න පුළුවන්
  • SDN Controller එකට API call එකක්: "Create VLAN 100 for Marketing"
  • Controller එක ස්වයංක්‍රීයව OpenFlow messages යවනවා සියලුම 1000 switches වලට
  • කාලය: තත්පර විතරයි, දෝෂ රහිත

අතුරු මුහුණත්:

  • Southbound (SBI): Controller ↔ Devices (OpenFlow protocol). "මම" කියලා controller එක switches වලට commands දෙනවා.
  • Northbound (NBI): Applications ↔ Controller (REST APIs). Applications කළමනාකරණය කරන්න පුළුවන් controller එක හරහා API calls.

Routing Algorithms

1. Link-State (Dijkstra) - OSPF use කරනවා

මෙකෙන් හර් router එකක්ම සම්පූර්ණ network map එක තියෙනවා. ඔයා Google Maps use කරනවා වගේ - ඔයාට හැම roads, distances එහෙම තියෙනවා. Dijkstra algorithm එක use කරලා shortest path එක ගණනය කරනවා.

උදාහරණය: නගර 5 ක් තියෙනවා (A, B, C, D, E). Router A ට E ට reach කරන්න ඕන:

  • විකල්පය 1: A → B → E (cost: 2+3 = 5)
  • විකල්පය 2: A → C → D → E (cost: 5+4+1 = 10)
  • Dijkstra: "විකල්පය 1 හොඳයි, එක use කරමු" ✓

වාසිය: ඉතා නිවැරදි, වේගවත් convergence (network වෙනස් උනාම ඉක්මනින් adapt වෙනවා)

අවාසිය: Memory සහ CPU usage වැඩියි (සම්පූර්ණ map එක ගබඩා කරන්න ඕන නිසා)

2. Distance-Vector (Bellman-Ford) - RIP use කරනවා

මෙකෙන් routers වලට සම්පූර්ණ map එක නෑ. හර් router එකක් කොච්චර අසල්වැසියන් විතරයි කතා කරන්නේ.

උදාහරණය: Router A:

  • "මම දන්නවා B එකෙන් distance 2, C එකෙන් 5"
  • Router B කියනවා: "ඔයි A, මම E ට reach කරන්න පුළුවන් 3 hops වලින්"
  • A ගණනය කරනවා: "මමත් E ට යන්න පුළුවන්: මේ හරහා B (2+3=5 hops)"

වාසිය: සරල, configuration පහසුයි

අවාසිය: Slow to adapt, "count-to-infinity" ගැටලුව (link fail උනාම loops හැදෙන්න පුළුවන්)

BGP (Border Gateway Protocol)

BGP එකෙන් Internet එකේ backbone එක. විවිධ ISPs (Autonomous Systems - AS) අතර routing කරනවා.

සැබෑ ලෝක උදාහරණය:

ඔයා ශ්‍රී ලංකාවේ Dialog ඉඳලා Facebook access කරනවා:

  • Dialog (AS 17494) ට Facebook වලට path එකක් හදාගන්න ඕන
  • Facebook එකේ AS number එක: AS 32934
  • Path විකල්ප ගොඩක් තියෙනවා:
    • Path 1: Dialog → Cogent → AT&T → Facebook
    • Path 2: Dialog → Tata Communications → Facebook
    • Path 3: Dialog → Level3 → Facebook
  • BGP තීරණය කරනවා ව්‍යාපාරික ප්‍රතිපත්ති වලින්:
    • Tata හරහා path එක නොමිලේ peering (ගෙවීමක් නෑ)
    • Cogent හරහා path එක ගෙවන transit (මුදල් දෙන ගන්න ඕන)
    • BGP: "Tata එකෙන් යමු, එතනින් මුදල් ඉතිරි වෙනවා" ✓

BGP vs OSPF:

  • OSPF: සමාගමක අභ්‍යන්තර network එකට (intra-AS). වේගය අනුව route තෝරා ගන්නවා.
  • BGP: ISPs අතර (inter-AS). ව්‍යාපාරික ප්‍රතිපත්ති අනුව route තෝරා ගන්නවා (මුදල්, දේශපාලනය, සබඳතා).