1 of 71

CMPT 471/771: Computer Networks��Software-Defined Networking and Network Virtualization

Instructor: Mohamed Hefeeda

1

School of Computing Science �Simon Fraser University

2 of 71

Outline

  • SDN architecture
    • Separate and centralize control: switches, flow rules, controllers
  • SDN in practice
    • Traffic engineering, network functions, WANs, SD-WAN
  • Security and AI
    • Attacks on controller, SDN as defense; learning for traffic engineering
  • Network virtualization
    • VLANs, tunnels, virtual switches, distributed functions

2

3 of 71

3

Hyperscale DCs

(Google, Meta, Azure)

Motivation: Where is SDN Deployed?

Carrier WANs

(AT&T, Bell Canada)

Enterprise Networks

(RBC, SFU)

🡺 SDN is an important topic

4 of 71

4

Control Plane

Control Plane

SFU IF 1

Alice IF 3

DST OUT_IF

Forwarding Table

SFU IF 2

Alice IF 4

DST OUT_IF

Forwarding Table

Routing algorithm

Routing algorithm

Control Plane

SFU IF 2

Alice IF 4

DST OUT_IF

Forwarding Table

Routing algorithm

Routers exchange messages with each other to calculate tables

    • Examples: OSPF, ISIS, BGP
    • Traditional; still used in many places

Recap: Control Plane: Distributed

5 of 71

5

Agent

Agent

Flow Table

Flow Table

Agent

Flow Table

Routers exchange messages with a remote/centralized controller

    • Software-defined networking (SDN)
    • Becoming popular in different networks, e.g., datacenter, ISP, and enterprise networks

Control Plane

Control Plane: Centralized

6 of 71

SDN: Basic Concepts

  • Separate control plane from data plane
    • Control plane (software) typically runs on commodity servers
    • 🡺 separation allows moving complex logic (intelligence) to servers, making switches much simpler and less expensive

​

  • Centralize control plane
    • A single entity controls most/all devices in the network
    • 🡺 centralization gives us a ‘global’ view of the network as well as one place to control the whole network
    • 🡺 allows performing functions that were not possible before

​

​

6

7 of 71

SDN: Basic Concepts

  • SDN accelerates innovations in networking by:
    • defining open standards and thus allowing more companies to enter the networking market (business)
    • separating data and control planes, which allows developing and experimenting with new ideas faster (technical)

​

  • Let us see an analogy from the computer industry
    • Mainframe 🡺 PC
    • Traditional Router 🡺 SDN Switch

7

8 of 71

Mainframe 🡺 PC

8

Vertically integrated

Closed, proprietary 🡺

Slow innovation

Small industry

Horizontal

Open interfaces 🡺

Rapid innovation

Huge industry

9 of 71

Traditional Router 🡺 SDN Switch

9

Vertically integrated

Closed, proprietary 🡺

Slow innovation

Small industry

Horizontal

Open interfaces 🡺

Rapid innovation

Huge industry

10 of 71

SDN: Architecture Overview

10

a.k.a SDN Controller

SDN Switches

e.g., OSPF, load balancer, ...

Open Interfaces

(a.k.a Bare-metal, merchant-silicon switches)

11 of 71

SDN: Data Plane (Switches)

  • SDN Switches run a local Operating System
  • Common switch OS examples include:
    • SONiC (developed at Microsoft for their cloud services)
    • Open Network Linux (ONL)
    • Stratum (developed at Google, built on top of ONL, referred to as ‘Thin Switch OS’)

11

12 of 71

SDN: Data Plane (Switches)

  • SDN Switches can be …
  • Fixed Function
    • Switch offers a fixed set of actions (e.g., forward, drop, …)
    • Implements the match – action abstraction
    • Currently deployed in networks
    • a.k.a OpenFlow Switches
  • Programmable
    • Switch runs ‘programs’ at line rate
    • Programs are written using the P4 language
    • Being deployed
    • (Discussed later)

​

12

Intel Tofino P4 Switch

OpenFlow Switch

13 of 71

SDN Switches

  • SDN Switches (fixed function) are …
    • Fast, commodity switches implementing generalized data-plane forwarding in hardware
  • Switch has flow table computed and installed by controller
    • Flow table has multiple Flow Rules (in the form of match–action)
  • A protocol is used to communicate with and control switch
    • E.g., OpenFlow (traditional), P4Runtime (Recent)

​

13

14 of 71

Generalized Forwarding

  • Process packets based on multiple header fields
    • Not just destination IP as before
  • Any combination of fields can be used

​

14

Switch

Port

MAC

src

MAC

dst

Eth

type

VLAN

ID

IP

Src

IP

Dst

IP

Prot

TCP

sport

TCP

dport

Link layer

Network layer

Transport layer

Payload …

15 of 71

Generalized Forwarding: Flow Rule

15

Switch

Port

MAC

src

MAC

dst

Eth

type

VLAN

ID

IP

Src

IP

Dst

IP

Prot

TCP

sport

TCP

dport

Match

Action

Stats

Can be …

  • Forward packet to port(s)
  • Encapsulate and forward to controller
  • Drop packet
  • Send to normal processing pipeline
  • Modify fields

Packet + byte counters

Link layer

Network layer

Transport layer

Match pkt against fields

Perform action(s)

Keep stats

16 of 71

Generalized Forwarding: Examples

16

Destination-based forwarding:

(as a special case of generalized forwarding)

*

Switch

Port

MAC

src

MAC

dst

Eth

type

VLAN

ID

IP

Src

IP

Dst

IP

Prot

TCP

sport

TCP

dport

Action

*

*

*

*

*

51.6.0.8

*

*

*

Forward(6)

Forward datagrams destined to 51.6.0.8 to output port 6

How would you implement this ‘*’ or don’t care thing?

Using binary masks, e.g., mask 0000 0000 0000 1111 means that we do not care about the left 12 bits 🡺 We only want to match against the four rightmost bits

​

17 of 71

Generalized Forwarding: Examples

17

Firewall

*

Switch

Port

MAC

src

MAC

dst

Eth

type

VLAN

ID

IP

Src

IP

Dst

IP

Prot

TCP

sport

TCP

dport

Action

*

*

*

*

*

*

*

*

22

Drop

Block datagrams destined to TCP port 22

*

Switch

Port

MAC

src

MAC

dst

Eth

type

VLAN

ID

IP

Src

IP

Dst

IP

Prot

TCP

sport

TCP

dport

Action

*

*

*

*

128.19.1.1

*

*

*

*

Drop

Block datagrams originated from host 128.19.1.1

18 of 71

OpenFlow Match-Action Abstraction

  • Match + action abstraction: unifies different kinds of devices
    • That is, the same abstraction can be used with various devices
    • And a ‘bare-metal’ switch can be configured to perform various functions …

18

  • Layer 3 Router
    • match: longest dst IP prefix
    • action: forward to a link

​

  • Layer 2 Switch
    • match: dst MAC address
    • action: forward or flood
  • Firewall
    • match: IP addresses and TCP/UDP port numbers
    • action: permit or deny
  • NAT
    • match: IP address and port
    • action: rewrite address and port

​

19 of 71

Flow Table: Contains Multiple Entries

19

Switch

Port

MAC

src

MAC

dst

Eth

type

VLAN

ID

IP

Src

IP

Dst

IP

Prot

TCP

sport

TCP

dport

Match

Action

Stats

  1. Forward packet to port(s)
  2. Encapsulate and forward to controller
  3. Drop packet
  4. Send to normal processing pipeline
  5. Modify Fields

Packet + byte counters

Link layer

Network layer

Transport layer

Match

Action

Stats

Match

Action

Stats

Matching is typically performed using TCAM

20 of 71

Flow Tables: TCAM and Priority

  • Switches use TCAMs to match a packet against every rule at once
    • The highest priority matching rule wins. Not the narrowest one

20

TCAM

1

0

X

X

1

1

0

X

X

X

X

X

Entry 2

Entry 3

Entry 4

Search for

1

0

1

0

Entry 1

1

1

X

X

0

0

1

0

Highest Priority

21 of 71

SDN: Control Plane

  • SDN Control Plane contains
    • SDN Controller (or Network Operating System, NOS)
    • Network Control Apps

21

Control Plane

Data Plane

Notice: the figure shows e2e example where the controller manages all components, including virtual switches (vS) on end hosts 🡺 great flexibility

22 of 71

SDN Controller (Network OS)

  • SDN controller
    • Maintains network state information
    • Interacts with network control applications “above” via northbound API
    • Interacts with network switches “below” via southbound API

22

Network-wide distributed, robust state management

Communication to/from controlled devices

Link-state info

switch info

host info

statistics

flow tables

…

…

OpenFlow

P4Runtime

…

network graph

intent

RESTful

API

…

Interface, abstractions for network control apps

SDN

controller

routing

access

control

load

balance

Communication layer: communicate between controller and switches

Network-wide state management layer: state of networks links, switches, services

Interface layer to network control apps: APIs

23 of 71

SDN Controller (Network OS)

  • Common examples of SDN Controllers:

23

24 of 71

SDN: Control Plane

Network-control apps:

  • Implement control functions using lower-level services and APIs provided by SDN controller

​

  • Examples: routing, load balancing, traffic engineering, …

​

  • Unbundled: can be provided by 3rd party: distinct from switch vendor and SDN controller

24

25 of 71

SDN: Control-Data Planes Interaction: Example

25

Link-state info

switch info

host info

statistics

flow tables

…

…

OpenFlow

P4Runtime

…

network graph

intent

RESTful

API

…

Dijkstra’s link-state

routing

s1

s2

s3

s4

S1, experiencing link failure uses OpenFlow port status message to notify controller

1

SDN controller receives OpenFlow message, updates link status info

2

Dijkstra’s routing algorithm application has previously registered to be called when ever link status changes. It is called.

3

Dijkstra’s routing algorithm access network graph info, link state info in controller, computes new routes

4

1

2

3

4

26 of 71

SDN: Control/Dataplane Interaction Example

26

Link-state info

switch info

host info

statistics

flow tables

…

…

OpenFlow

SNMP

…

network graph

intent

RESTful

API

…

Dijkstra’s link-state

routing

s1

s2

s3

s4

link state routing app interacts with flow-table-computation component in SDN controller, which computes new flow tables needed

5

controller uses OpenFlow to install new tables in switches that need updating

6

5

6

1

2

3

4

27 of 71

SDN vs Traditional Approach

  • If we were using OSPF on individual routers (not SDN), what would be the steps?

​

  • Work it out and compare both approaches

​

  • OSPF: update flooded; every router reruns Dijkstra
  • SDN: switch reports; controller computes once, pushes rules
  • Trade-off: SDN computes once, but needs controller

27

28 of 71

SDN Reduces Cost of Switches

  • SDN moves logic to central entities (servers)
  • 🡺 switches simpler to design and implement
  • 🡺 commodity 🡺 cost a fraction of traditional switches
  • Example
    • Datacenter with 100,000 hosts using a tree-based topology
    • Rough estimates: 5,000 switches (with fanout of 20)
    • Traditional switch ~$5+K
    • SDN Switch: ~$1K
    • Savings: $25M - $5M = $20M

​

  • In addition to the flexibility of SDN

28

29 of 71

SDN Offers Better Support for Traffic Engineering

  • Network operators need to carefully direct various traffic flows through their networks
    • This is referred to as Traffic Engineering (TE)

​

  • In TE, network paths are chosen (engineered) to meet the requirements of applications or customers
    • These are not necessarily the shortest paths computed by the routing protocols

29

30 of 71

SDN: Traffic Engineering

  • For specific customer, network operator wants:
    • x-to-z traffic goes through x-w-y-z (not the shortest path)
  • Traditional approach: would need to define link weights so that routing algorithm computes routes accordingly
  • But that would affect all traffic going through w and y!
  • In contrast, SDN can enforce TE for specific traffic flows

30

2

2

1

3

1

1

2

5

3

5

v

w

u

z

y

x

Example 1:

31 of 71

SDN: Traffic Engineering

  • Latency-sensitive applications require passing through low-delay paths, and
  • high-volume content distribution applications need to go through paths with large available bandwidth

31

2

2

1

3

1

1

2

5

3

5

v

w

u

z

y

x

App 1

App 2

Can this be achieved by OSPF (or siblings)?

Example 2:

32 of 71

SDN: Traffic Engineering

  • A network operator wants to:
    • split u-to-z traffic along u-v-w-z and u-x-y-z (load balancing)
  • Hard to do this using traditional routing algorithms
  • Much simpler to do using SDN

​

32

2

2

1

3

1

1

2

5

3

5

v

w

u

z

y

x

Example 3:

33 of 71

SDN Supports Efficient Management of Network Functions

  • Network operators deploy many network functions
    • Also called middle boxes, network devices
  • Current trend is to virtualize these functions on general-purpose servers 🡺 referred to as Network Function Virtualization (NFV)

33

Firewall

IDS

Video Encoder

Parental control

Monitoring

Network Functions

Virtualized on Servers

34 of 71

SDN Supports Efficient Management of Network Functions

  • Large-scale networks are complex
    • They have routers and
    • FW, IDS, encoders, …, and many other devices

​

  • Network management becomes a hard task

​

  • SDN offers a unified way for managing all network devices
  • SDN also enables TE in presence of devices

​

​

34

Firewall

IDS

Video Encoder

Monitoring

35 of 71

SDN Supports Efficient Management of Network Functions

  • Traffic may need to traverse a specific order of services
    • Before reaching a destination

35

1

2

3

a

h

d

e

g

b

i

c

f

k

j

Route calculated by OSPF

1

2

3

36 of 71

SDN Deployment

  • Cloud providers, e.g., Google and Microsoft, use SDN for:
    • Managing datacenter networks: SD-Fabric, and
    • Optimizing inter-datacenter links: TE for WAN
      • Examples: Google B4, Microsoft SWAN 
  • Major ISPs, e.g., AT&T, Comcast, and Bell, use SDN for:
    • Implementing traffic engineering (replacing MPLS), and
    • Managing network functions (e.g., FW, LB, IDS)
  • Enterprises, e.g., companies and universities, use SDN for:
    • Creating and managing virtual networks, and
    • Managing WAN traffic and services (SD-WAN)

​

36

37 of 71

SDN: TE for WANs

  • Major IT companies, e.g., Microsoft, Google, Meta, have many datacenters around the world
    • They are interconnected with expensive WAN links
    • Links carry huge amount of traffic, e.g., web index, user data

37

Google: 43 cloud regions (2026)

Expensive links

38 of 71

SDN: TE for WANs

  • The utilization of expensive WAN links used to be kept low
    • ~40–60%. Why?
    • To ensure QoS in presence of high traffic variations

​

  • Using SDN, Google reported many links near 100% and all links averaging ~70%, and Microsoft reported 60% more traffic than MPLS TE

​

  • Let us see an example from Microsoft to understand better

38

39 of 71

SDN: TE for WANs

  • Measurement from Microsoft: before and after SDN

​

​

​

​

​

​

39

Source: Hong et al., Achieving High Utilization with Software-Driven WAN, SIGCOMM’13. (Microsoft SWAN)

Provision for peak 🡺 < 50% utilization

Smaller peak 🡺 better utilization

Adapt using SDN

Aggregate traffic

40 of 71

SDN: TE for WANs

  • Why SDN was able to achieve much better utilization?
    • Because it performs “global” traffic optimization instead of local optimization as before
  • Illustrative example:
    • Every link has 1 unit capacity in each direction
    • We have 3 flows A, B, C going to node 5 from nodes 1, 2, 3

40

1

4

5

2

3

Distributed: each source chooses its local optimal

A

B

C

1

4

5

2

3

Central optimization using SDN 🡺 global optimal

A

B

C

41 of 71

Google SDN: Control at Three Timescales

  • Each loop fixes what it sees, as fast as it can see it
    • Hosts see own packets: react within round trips
    • Central controllers see whole network: recompute paths in seconds
    • Planners see long-term demand: rewire topology in weeks
  • Centralized SDN is middle loop; other two complement it

41

Hosts: µs to ms

Congestion control

Protective ReRoute: new path

after timeout

Controllers: s to min

B4 traffic engineering (WAN)

Jupiter TE, every 30 s

BwE rate limits

Planning: weeks to months

Topology engineering:

optical switches rewire links

Capacity planning

faster ← reaction time → slower

42 of 71

Software Defined Wide Area Network: SD-WAN

  • Consider a large organization with multiple sites/branches
    • e.g., Royal Bank of Canada (RBC)
  • Traditionally (and still used)
    • RBC would lease virtual circuits (VCs) from ISP(s), e.g., Telus
    • ISP uses MPLS (Multi-Protocol Label Switching) to create VCs
      • ISP provisions VCs to guarantee delay and bandwidth
    • Disadvantages for RBC: slow to establish VCs, costly, ISP lock-in

​

42

Branch office

Main office

Corporate datacenter

ISP(s)

43 of 71

Software Defined Wide Area Network: SD-WAN

  • SD-WAN: Recent (gradually being deployed)

​

43

Branch office

Main office

Corporate datacenter

ISP(s)

SD-WAN Controller

VPN Tunnel

44 of 71

SD-WAN: Advantages

  • Fast deployment (zero-touch)
    • Switches are shipped to sites with address of the controller
    • Controller distributes all configurations including security certificates, all from one location 🡺 much simpler
  • Cost effective, no leased VCs, no vendor lock-in
    • Bandwidth on the internet is becoming abundant 🡺 no need to reserve links
  • VPNs offer more security (through encryption)
    • VPN: encrypted tunnel (e.g., IPsec) over public Internet

44

45 of 71

SDN Security: Attacks on Control Plane

  • Controller controls whole network: high-value target
  • Saturation: new-flow flood → Packet-In storm, full tables
    • Defense: rate-limit Packet-Ins; switch finishes TCP handshake first
  • Topology poisoning: forged LLDP links, spoofed host moves
    • Defense: authenticate LLDP; verify host moves (TopoGuard)
  • Control channel: OpenFlow supports TLS, but it is optional

45

Controller

switch 1

switch 2

Attacker

1 many new flows → Packet-In flood

2 fake link (forged LLDP)

3 plain TCP channel: rules read or injected

46 of 71

SDN for Defense: DDoS and Noisy Neighbors

  • Global view: Google Cloud Armor detects attacks worldwide
    • Pushes ACLs to edge, written by operators or generated
  • Noisy neighbor: one VM floods shared links and hurts others
  • Hybrid: hosts detect fast; central server sets rate limits
    • Same split as SDN: fast local reaction, accurate global decision
  • Microsegmentation: per-VM firewall rules in every vSwitch

46

host 1

host 2

host 3

Central DoS server

congestion signals (receivers)

rate limits at senders

47 of 71

SDN and AI

Example: AuTO (SIGCOMM 2018): reinforcement learning for TE

47

Control Plane

Data Plane

Reinforcement Learning (RL) Agent

Reward: minimize latency

Action: install rules

Telemetry: link utilization, queue depth, RTT per flow,…

Decisions: reroute flow X to path Y; install R1, R3 into S1 and S3

R1

R3

48 of 71

Network Virtualization

  • Network virtualization is an old concept
    • But has substantially evolved with SDN and datacenter networks
  • Network virtualization is a highly overloaded term
    • Means different things to different people
  • Here are some common terms/concepts…
    • Virtual Circuits (VCs)
    • Virtual LANs (VLANs)
    • Virtual Networks in Datacenters (L2/L3 virtualization)
    • Virtual Private Networks (VPNs)
    • Virtual Switches
    • …
  • Let us start the virtualization story from the beginning …

48

49 of 71

Virtualization in Computing

  • Virtualization is a fundamental, old, concept in computing
    • Virtualization ~= abstraction

​

  • Virtualization has many benefits, e.g.,
    • High resource utilization (via sharing and multiplexing)
    • Better security (via isolation)
    • Easier programming models (via common APIs)
    • Faster resource deployment (via software instead of hardware)

​

49

50 of 71

Common Virtualization in Computing

  • Virtual Memory
    • Abstraction of physical memory
    • Physical address is different from virtual address (used by process)
    • Mapping between virtual and physical space is needed
    • Allows memory sharing (better utilization) and offers simple address space (easier programming)

​

​

50

51 of 71

Common Virtualization in Computing

  • Virtual Machine (VM)
    • Complete virtualization of all components: processor, memory, storage, I/O, …

​

  • VM Offers
    • Better resource utilization
    • Faster deployment of VMs compared to physical servers
    • Better security (VM isolation)

​

​

​

51

Hardware: Processor, memory, storage, I/O, …

e.g., VirtualBox

52 of 71

Common Virtualization in Computing

  • Container ...
    • Is a package of software with all necessary elements to run in any environment
    • Shares OS resources
    • 🡺 much lighter than VMs and runs faster
  • Common in datacenters

​

​

​

52

Hardware: Processor, memory, storage, I/O, …

e.g., Docker

53 of 71

Virtual LANs: Layer 2 (Ethernet) VLANs

  • Example: Create two separate virtual LANs
    • H1, H3, H5: VLAN 100
    • H2, H4: VLAN 200

53

L3 Router

L2 Switch

L2 Switch

To other IP subnets or Internet

H1

H2

H3

H4

H5

H6

VLAN 100

VLAN 100

VLAN 100

VLAN 200

VLAN 200

54 of 71

  • Extension of the Ethernet standard to support VLANs

54

802.1 Ethernet frame

dest.

address

source

address

data (payload)

CRC

preamble

type

16 bits: Type

4 bits: Control

12 bits: Tag (VLAN ID)

Recomputed

CRC

802.1Q frame

dest.

address

source

address

data (payload)

CRC

preamble

type

802.1Q VLAN Frame Format

  • This is old, not using SDN, but still deployed

55 of 71

L2 (Ethernet) VLANs

  • Switches are configured to associate port numbers to VLANs
    • By a controller
  • Switches forward traffic of a VLAN to its hosts only
    • Based on VLAN ID 🡺 Logical isolation

​

  • L2 VLANs somewhat resemble Virtual Memory
    • They offer basic sharing of physical links
    • Good enough for traditional enterprise/campus networks
    • Not sufficient for datacenters that host many tenants, with different workloads, services, and requirements

​

55

56 of 71

Network Virtualization: Modern Definition

  • A virtual network is a lot more than just links
    • It can contain switches, firewalls, NATs, load balancers, etc.

​

  • We want virtual networks that resemble virtual machines

​

  • A Virtual Machine offers complete server
    • CPU, memory, storage, I/O, …

​

  • A Virtual Network should offer complete network
    • Switches, links, firewalls, NATs, topologies, addressing schemes, …

​

​

​

​

56

57 of 71

Network Virtualization: Modern Definition

  • Virtual Network should offer/enable:
  • Control of address space
    • Allow using various address schemes (e.g., MAC, IPv4, IPv6 ) over the same physical network
    • Allow migration of VMs from one subnet/rack/server to another
  • Control of network topology
    • Allow creating various topologies over the same physical network
  • Control of network functions
    • Allow creating/managing various network functions, e.g., FW, LB

​

  • 🡺 All of the above are critical for multi-tenant datacenters
    • Let us see what datacenters look like to understand the demands

​

​

57

58 of 71

Datacenters: Common Design

58

Server racks

  • 20- 40 servers
  • Each runs multiple VMs

Top of Rack (TOR) switch

  • one per rack
  • 40-100Gbps

Tier-2 switches

  • connecting to ~16 TORs below

Tier-1 switches

  • connecting to ~16 T-2s below

Border routers

  • connections outside datacenter

…

…

…

…

…

…

…

…

59 of 71

Datacenters: Multi-Tenants

59

…

…

…

…

…

…

…

…

Tenant 1:

Star topology, IPv4

100 servers

10.1.1.100

10.1.1.1

10.1.1.2

10.1.1.1

10.1.1.2

10.1.1.100

10.1.1.1

Virtual links (tunnels) between VMs

Server failed 🡺 VM migrated but kept same (virtual) IP address

60 of 71

Datacenters: Multi-Tenants

60

…

…

…

…

…

…

…

…

10.1.1.1

10.1.1.2

10.1.1.100

Tenant 2:

Mesh topology, 3 switches, IPv6, FW, LB, 10 servers

Tenant 2 network will be overlayed over the same physical network

Tenant 1 network

61 of 71

Network Virtualization: Basic Architecture

  • Network Virtualization App (on top of SDN controller)
    • Has global view of the whole network
    • Gets requirements of the virtual network (through GUI or APIs)
    • Creates flow rules to realize the requested network
    • Sends the flow rules to devices
    • Tracks network changes and updates rules to reflect them

61

62 of 71

Virtual Networks: Building Blocks

  • Tunnelling
    • Decouples virtual addresses from physical ones
    • Done through Encapsulation: putting a packet inside another

62

Seen and processed by physical network

Added and removed at start/end of tunnel

Seen and processed by vSwitch and VMs

63 of 71

Virtual Networks: Building Blocks

  • Virtual Switch (vSwitch)
    • Implemented in software
    • Offers similar functionality/interface as physical switch
    • Essential to optimize for high-speed packet processing, otherwise becomes a bottleneck
    • Common example: Open vSwitch (OVS)
      • OVS has many implementation optimizations
      • Read (optionally) the following paper for more details on OVS:

​

  • Let us see an example optimization in OVS

63

64 of 71

Software Switches: Basics

  • Software switches run on VMs
    • Packets arrive at NIC
    • Passed up to OS kernel
    • Passed up for processing by vSwitch App
    • Sent down to OS kernel
    • And finally sent to NIC
    • 🡺 slow

​

  • How would you optimize this?
  • Do as much as possible in Kernel

​

​

64

OS Kernel

vSwitch App

65 of 71

Software Switches: Prefix Matching

  • Example optimization: prefix matching
    • Very expensive (recall we do not have TCAMs here)
    • Cannot do it all in Kernel. Why?
  • vSwitch Solution (guess?):
    • Hint: a connection typically has �many packets, all use same patterns
    • 🡺 do expensive matching once and �re-use/cache for following packets
    • First packet:
      • Perform prefix matching in user space
      • Cache the result in kernel space
    • Subsequent packets
      • Use cache in kernel space

​

​

65

66 of 71

Open vSwitch: Microflow and Megaflow Caches

  • First kernel cache: exact-match entries, one per connection
    • Many short connections: most packets miss and go to user space
  • Megaflow: wildcard entry, covers many connections
    • Matches only fields rules looked at, e.g., destination prefix
  • Microflow cache in front: connection → its megaflow
  • Production (>1,000 hosts): 97.7% hits; most hosts ≤ 5% CPU

66

Microflow cache (kernel)

exact match, 1 hash lookup

Megaflow cache (kernel)

wildcards, many connections

ovs-vswitchd (user space)

full OpenFlow tables

miss

miss

install megaflow for later packets

hit: forward now

67 of 71

Virtual Switch Offload: SmartNICs

  • Software vSwitch takes host cores and adds latency
    • Google: host overhead can burst above 50% of server compute
  • SR-IOV: VM gets own NIC function; bypasses host
  • SmartNIC runs vSwitch data path: rules, tunnels, crypto
    • Azure: software handles first packet; FPGA forwards rest
  • Same split as SDN: control in software, data path in hardware

67

Software vSwitch

VM

VM

vSwitch on host CPU cores

NIC

every packet

uses host cores

Offloaded (SmartNIC or IPU)

VM

VM

VF (SR-IOV)

SmartNIC: flow table + tunnels in hardware

vSwitch software: first packet, fills table

68 of 71

Virtual Networks: Distributed Functions

  • Consider a firewall (FW) as an example network function
  • In traditional approach (before SDN), FW is at one location (ingress point) and traffic should go through it
  • Suppose VM A is sending to VM C: needs to go through FW
    • Extra delay, FW overloaded, may become a bottleneck
  • Extreme: VM A is sending to VM B (aka hairpinning)

​

68

69 of 71

Virtual Networks: Distributed Functions

  • SDN enables “distributed” network functions
  • How would you implement a distributed FW using SDN?
    • Controller computes all needed rules for each vSwitch
    • 🡺 more efficient, less delay, less overhead, more scalable
    • 🡺 good for datacenters as they need to support numerous virtual networks for their customers

69

70 of 71

Summary

  • SDN: separate control from data plane; centralize control logically
    • Switch: flow rules of match, action, priority; set by controller
    • Controller: network OS with global view; apps run on top
  • SDN in practice: traffic engineering, network functions, SD-WAN
    • Google: hosts react in RTTs, TE in seconds, topology in weeks
  • Virtualization: tenant gets own addresses, topology, functions
    • Tunnels between vSwitches carry tenant traffic over shared network
    • Fast vSwitches: megaflow caches, SmartNIC offload
  • Security: controller is target; SDN also enables defenses

70

71 of 71

Readings

​

71