Control Plane
Control Plane
Theoretical Background
§ Control plane calculates the entries of forwarding
tables.
• How?
• Use a routing algorithm from graph theory
4-2
Theoretical Background
§ What do you need to know to compute a path
between two nodes on a graph?
• Topology (who’s connected to who)
• Link capacities
• Propagation delays.
§ How do we obtain these?
• Link-state routing (e.g., OLSR)
• Distance-vector routing (e.g., AODV)
§ Assume network parameters are static for now.
4-3
Basics of Routing
Single-Source Shortest Path Problem - The
problem of finding shortest paths from a source
vertex v to all other vertices in the graph.
4-4
Network Layer
Dijkstra's algorithm
Dijkstra's algorithm - is a solution to the single-source
shortest path problem in graph theory.
Approach
§ The algorithm computes for each vertex u the distance to
u from the start vertex v, that is, the weight of a shortest
path between v and u.
§ the algorithm keeps track of the set of vertices for which
the distance has been computed, called the cloud C
§ Every vertex has a label D associated with it. For any
vertex u, D[u] stores an approximation of the distance
between v and u. The algorithm will update a D[u] value
when it finds a shorter path from v to u.
§ When a vertex u is added to the cloud, its label D[u] is
equal to the actual (final) distance between the starting
vertex v and vertex u.
6
Dijkstra pseudocode
Dijkstra(v1, v2):
for each vertex v: // Initialization
v's distance := infinity.
v's previous := none.
v1's distance := 0.
List := {all vertices}.
Example: Initialization
4 1 3 10
2 2 ∞
∞ C D E
5 8 ∞ 4 6
1
F G
∞ ∞
8
Example: Update neighbors'
distance
0 2
2
A B
4 1 3 10
2 2 ∞
∞ C D E
5 8 1 4 6
Distance(B) = 2 1
F G
Distance(D) = 1
∞ ∞
4 1 3 10
2 2 ∞
∞ C D E
5 8 1 4 6
1
F G
∞ ∞
10
Example: Update neighbors
0 2
2
A B
4 1 3 10
2 2
3 C D E 3
5 8 1 4 6
Distance(C) = 1 + 2 = 3 1
F G
Distance(E) = 1 + 2 = 3
Distance(F) = 1 + 8 = 9 9 5
Distance(G) = 1 + 4 = 5
11
Example: Continued...
Pick vertex in List with minimum distance (B) and update neighbors
0 2
2
A B
4 1 3 10
2 2
3 C D E 3
5 8 1 4 6
Note : distance(D) not
F
1
G updated since D is
already known and
9 5 distance(E) not updated
since it is larger than
previously computed
12
Example: Continued...
Pick vertex List with minimum distance (E) and update neighbors
0 2
2
A B
4 1 3 10
2 2
3 C D E 3
5 8 1 4 6
1
F G
No updating
9 5
13
Example: Continued...
Pick vertex List with minimum distance (C) and update neighbors
0 2
2
A B
4 1 3 10
2 2
3 C D E 3
5 8 1 4 6
Distance(F) = 3 + 5 = 8 1
F G
8 5
14
Example: Continued...
Pick vertex List with minimum distance (G) and update neighbors
0 2
2
A B
4 1 3 10
2 2
3 C D E 3
5 8 1 4 6
1
F G
Previous distance
6 5
Distance(F) = min (8, 5+1) = 6
15
Example (end)
0 2
2
A B
4 1 3 10
2 2
3 C D E 3
5 8 1 4 6
1
F G
6 5
Pick vertex not in S with lowest cost (F) and update neighbors
16
Back to reality
§ No one initially has the complete network info.
• Nodes only know their neighbours.
• Centralized algorithm should be replaced by a
decentralized algorithm.
§ Link-state routing
• Each router collects information about its local
neighborhood by sending probe packets out of all its
output ports to see who it is connected to and what
the properties of the connecting link (propagation
delay and capacity) are.
• Exchange this info with each other by Link State
Advertisements (LSA).
• Broadcast to everyone in the network.
4-17
Distance-vector routing
§ LSR sequences routing into two phases:
• Information accumulation to reconstruct network
graph.
• Route computation
§ DVR is more incremental
• Two phases are interleaved.
• Idea: a router’s shortest path to a destination can be
decomposed into a LINK to one of the router’s
neighbors concatenated with a shortest path to that
destination from that neighbor.
• At each step expand the frontier of the routers one
«hop» at a time!
4-18
Distributed Bellman-Ford
§ Each node keeps best estimate to destination:
• d(v), where d represents the router’s current estimate
of the shortest distance to destination v
• «distance-vector»
• Whenever the distance vector of a router changes, the
router exchanges the distance vector with its
neighbors alone
• No broadcast to entire network.
• When a router receives a distance vector dN from one
of its neighbors, it incrementally updates its own
distance vector dR for every destination v
dR(v)=min(dR(v),dN(v)+link metricR,N)
• Update the forwarding table:
• if a router chooses to update its shortest path to go through
its neighbor, it updates its next hop to that neighbor
4-19
22
Packet Scheduling
§ Decide when and what packet to send on
output link
• Usually implemented at output interface
flow 1
2 flow n
Buffer
management
23
Internet Classifier
§ A “flow” is a sequence of packets that are related (e.g. from the
same application)
§ Flow in Internet can be identified by a subset of following fields
in the packet header
• source/destination IP address (32 bits)
• source/destination port number (16 bits)
• protocol type (8 bits)
• type of service (4 bits)
§ Examples:
• All TCP packets from Ozgur’s web browser on machine A to web
server on machine B
• All packets from Sabanci
• All packets between Sabanci and Koc
• All UDP packets from Sabanci FENS
§ Classifier takes a packet and decides which flow it belongs to
§ Note: In ATM or MPLS, the classifier can become just a label
demultiplexer
24
Buffer/Queue
§ Buffer: memory where packets can be stored
temporarily
§ Queue: using buffers to store packets in an
ordered sequence
• E.g. First-in-First-Out (FIFO) queue
Buffer Buffer
Packet Packet
25
Buffer/Queue
§ When packets arrive at an output port faster than the output link
speed (perhaps only momentarily)
§ Can drop all excess packets
• Resulting in terrible performance
§ Or can hold excess packets in buffer/queue
• Resulting in some delay, but better performance
§ Still have to drop packets when buffer is full
• For a FIFO queue, “drop tail” or “drop head” are common policies
• i.e. drop last packet to arrive vs drop first packet in queue to make room
26
Scheduler
§ Decides how the output link capacity is shared by
flows
• Which packet from which flow gets to go out next?
§ E.g. FIFO schedule
• Simple schedule: whichever packet arrives first leaves
first
• Agnostic of concept of flows, no need for classifier, no
need for a real “scheduler”, a FIFO queue is all you
need
§ E.g. TDMA schedule
• Queue packets according to flows
• Need classifier and multiple FIFO queues
• Divide transmission times into slots, one slot per flow
• Transmit a packet from a flow during its time slot
27
TDMA Example
flow 1
2 flow n
Buffer
management
28
Internet Today
§ FIFO queues are used at most routers
§ No classifier, no scheduler, best-effort
29
30
Fair Queueing
§ In a fluid flow system, it reduces to bit-by-bit round
robin among flows
• Each flow receives min(ri, f) , where
• ri – flow arrival rate
• f – link fair rate (see next slide)
§ Weighted Fair Queueing (WFQ) – associate a
weight with each flow [Demers, Keshav & Shenker
’89]
• In a fluid flow system it reduces to bit-by-bit round robin
§ WFQ in a fluid flow system à Generalized
Processor Sharing (GPS) [Parekh & Gallager ’92]
31
f = 4:
8 10
4 min(8, 4) = 4
6 4 min(6, 4) = 4
2 min(2, 4) = 2
2
32
WFQ Architecture
flow 1
2 flow n
Buffer
management
33
w2
R
wn
34
What is the Intuition? Fluid Flow
w1
water pipes
w2
w3
water buckets
t2
t1
w1 w2 w3
35
36
Fluid Flow System: Example 1
Packet Packet inter-arrival Arrival
Flow 1 (w1 = 1) 100 Kbps
Size (bits) time (ms) Rate
(Kbps)
Flow 1 1000 10 100
Flow 2 (w2 = 1)
Flow 2 500 10 50
Flow 1 1 2 3 4 5
(arrival traffic) time
Flow 2 1 2 3 4 5 6
(arrival traffic) time
Service 3 4 5
1 2
in fluid flow 1 2 3 4 5 6
system 0 10 20 30 40 50 60 70 80 time (ms)
37
0 2 4 6 8 10 15
38
Implementation in Packet System
§ Packet (Real) system: packet transmission cannot
be preempted. Why?
§ Solution: serve packets in the order in which they
would have finished being transmitted in the fluid
flow system
39
Service
in fluid flow
system
0 2 4 6 8 10
§ Select the first packet that finishes in the fluid flow system
Packet
system
0 2 4 6 8 10
40
Packet System: Example 2
Service 3 4 5
1 2
in fluid flow 1 2 3 4 5 6
system time (ms)
§ Select the first packet that finishes in the fluid flow system
Packet 1 2 1 3 2 3 4 4 5 5 6
system time
41
Implementation Challenge
§ Need to compute the finish time of a packet in
the fluid flow system…
§ … but the finish time may change as new packets
arrive!
§ Need to update the finish times of all packets that
are in service in the fluid flow system when a new
packet arrives
• But this is very expensive; a high speed router may
need to handle hundred of thousands of flows!
42
Example
§ Four flows, each with weight 1
Flow 1
time
Flow 2
time
Flow 3
time
Flow 4
time
ε
Finish times computed at time 0
time
0 1 2 3
Finish times re-computed at time ε
time
0 1 2 3 4
43
45
Flow 1 (w1 = 1)
time
Flow 2 (w2 = 1)
time
1 2 3 4 5
1 2 3 4 5 6
V(t) C/2
C
46
Fair Queueing Implementation
§ Define
• Fi k- virtual finishing time of packet k of flow i
• aik- arrival time of packet k of flow i
• Lki - length of packet k of flow i
• wi – weight of flow i
47
48
Arrival and Departure Process
Rin Network Element Rout
delay
buffer
Rout(t) = departure process
= amount of data departing up to time t
t
49
b(t) = Envelope
slope = max average rate
“Burstiness Constraint”
t
50
Service Curve
§ Assume a flow that is idle at time s and it is
backlogged during the interval (s, t)
§ Service curve: the minimum service received by
the flow during the interval (s, t)
51
Big Picture
bits Service curve
bits
Rin(t)
slope = C
t t
bits
Rout(t)
t
52
Delay and Buffer Bounds
E(t) = Envelope
bits (arrival curve)
Maximum delay
Maximum buffer
53
t t
Video packets have to wait after ftp packets
istoica@cs.berkeley.edu
t 55
Non-Linear Service Curves: Example
bits bits
Service Video FTP
curves
t
Arrival t
process
bits bits
Arrival
curves
t
t
bits bits
Deadline
computation
t t
Video packets transmitted
as soon as they arrive
istoica@cs.berkeley.edu
t 56
Network-layer functions
Recall: two network-layer functions:
§ forwarding: move packets
from router’s input to data plane
appropriate router output
§ routing: determine route
taken by packets from source control plane
to destination
Routing
Algorithm
Routing algorithm control
Control plane plane
Data plane
Values in arriving
values in arriving
packet’s header
1
packet header 1101
2
3
0111 1
2
3
M04_KURO4140_07_SE_C04.indd 309
Remote Controller 11/02/16 3:14 PM
control
plane
data
plane
CA
CA CA CA CA
values in arriving
packet header
0111 1
2
3
control plane
data plane
local flow table
headers counters actions
1
0100 1101
3 2
values in arriving
packet’s header
Network Layer: Data Plane 4-60
OpenFlow abstraction
§ match+action: unifies different kinds of devices
§ Router § Firewall
• match: longest • match: IP addresses
destination IP prefix and TCP/UDP port
• action: forward out numbers
a link • action: permit or
§ Switch deny
• match: destination § NAT
MAC address • match: IP address
• action: forward or and port
flood • action: rewrite
address and port
Remote Controller
control
plane
data
plane
CA
CA CA CA CA
SDN-controlled switches
Network Layer: Control Plane 5-69
scalability, fault-tolerance,
robustness data
plane
SDN-controlled switches
Network Layer: Control Plane 5-70
SDN perspective: control applications
network-control apps: network-control applications
§ “brains” of control:
routing
…
implement control functions
using lower-level services, API access load
control balance
provided by SDN controller
§ unbundled: can be provided by northbound API
control
plane
3rd party: distinct from routing
vendor, or SDN controller SDN Controller
(network operating system)
southbound API
data
plane
SDN-controlled switches
Network Layer: Control Plane 5-71
Network-wide state
management layer: statistics … flow tables
state of networks
Network-wide distributed, robust state management
SDN
links, switches,
controller
services: a distributed
database
Link-state info host info … switch info
* : wildcard
1. src=1.2.*.*, dest=3.4.5.* à drop
2. src = *.*.*.*, dest=3.4.*.* à forward(2)
3. src=10.1.2.3, dest=*.*.*.* à send to controller
Examples
Destination-based layer 2 (switch) forwarding:
Switch MAC MAC Eth VLAN IP IP IP TCP TCP
Action
Port src dst type ID Src Dst Prot sport dport
22:A7:23:
* 11:E1:02 * * * * * * * * port3
layer 2 frames from MAC address 22:A7:23:11:E1:02
should be forwarded to output port 6
s2
s1
s4
s3
Network Layer: Control Plane 5-82
OpenFlow example Example: datagrams from
hosts h5 and h6 should
be sent to h3 or h4, via s1
match action and from there to s2
IP Src = 10.3.*.* Host h6
forward(3)
IP Dst = 10.2.*.* 10.3.0.6
1 s3 controller
2
3 4
Host h5
10.3.0.5
1 s1 1 s2
2 Host h4
4 2 4
Host h1 10.2.0.4
3 3
10.1.0.1
Host h2
10.1.0.2 match action
match action Host h3 ingress port = 2
10.2.0.3 forward(3)
ingress port = 1 IP Dst = 10.2.0.3
IP Src = 10.3.*.* forward(4) ingress port = 2
forward(4)
IP Dst = 10.2.*.* IP Dst = 10.2.0.4
agent data
agent data
managed device
managed device
SNMP protocol
Two ways to convey MIB info, commands:
managing managing
entity entity
request
trap msg
response
87
NMS Tools
White Box
Hardware
Vendor-Specific
Extreme Management
Lock-in