Unit IV Slides
Unit IV Slides
Packet Networks
1 3
6
2 Node
5
(switch or router)
2 Node
5
(switch or router)
Node 3
Node 4
Destination Next node
1 1
2 2
Node 2 Node 5
3 3
Destination Next node Destination Next node
5 5
1 1 6 3 1 4
3 1 2 2
4 4 3 4
5 5 4 4 3
6 5 6 6
Routing Protocols
Introducing routing
⚫ Routing is the process that a router uses to
forward packets toward the destination
network.
⚫ A router makes decisions based upon the
destination IP address of a packet.
⚫ In order to make the correct decisions,
routers must learn the direction to remote
networks.
4
Routing Protocols
5
Static route operation
• Static Routing
– Set up manually, do not change; requires administration
– Works when traffic predictable & network is simple
– Used to override some routes set by dynamic algorithm
– Used to provide default router
• Dynamic Routing
– Adapt to changes in network conditions
– Automated
– Calculates routes based on received updated network state
information
8
Routing Algorithm: Classification
A. Centralized vs Distributed Routing
• Centralized Routing
– All routes determined by a central node
– All state information sent to central node
– Problems adapting to frequent topology changes
– Does not scale
• Distributed Routing
– Routes determined by routers using distributed algorithm
– State information exchanged by routers
– Adapts to topology and other changes
– Better scalability
9
10
11
12
C. Flat vs Hierarchical Routing
• Flat Routing
– All routers are peers
– Does not scale
• Hierarchical Routing
– Partitioning: Domains, autonomous systems,
areas...
– Some routers part of routing backbone
– Some routers only communicate within an area
– Scales 13
• Example: Hierarchical Addresses and Routing
0000 0100
0001 0101
0010 1 4 0110
0011 0111
3
R1 R2
2 5
1000 1100
1001 00 1 00 3 1101
1010 01 3 01 4 1110
1011 10 2 10 3 1111
11 3 11 5
0000 0001
0111 0100
1010 1 4 1011
1101 1110
3
R1 R2
2 5
0011 0011
0110 0000 1 0001 4 0101
1001 0111 1 0100 4 1000
1100 1010 1 1011 4 1111
… … … …
21
Shortest Path Protocols
23
Distance Vector
Local Signpost Table Synthesis
• Direction • Neighbors exchange table
• Distance entries
• Determine current best
Routing Table next hop
For each destination list: • Inform neighbors
– Periodically
• Next Node
– After changes
• Distance dest next dist
24
Shortest Path to SJ
Focus on how nodes find their shortest
path to a given destination node, i.e. SJ San
Jose
Dj
Cij
j
i
Di If Di is the shortest distance to SJ from i
and if j is a neighbor on the shortest path,
then Di = Cij + Dj 25
But we don’t know the shortest paths
i only has local info
from neighbors San
Dj' Jose
j'
Cij'
Dj
Cij j
i
Cij” Pick current
Di j"
Dj" shortest path
26
Why Distance Vector Works
SJ sends
accurate info
San
2 Hops
1 Hop
From SJ
Jose
3 Hops From SJ
From SJ
Hop-1 nodes
calculate current
(next hop, dist), &
Accurate info about SJ send to neighbors
ripples across network, 27
Shortest Path Converges
Bellman-Ford Algorithm
⚫ Consider computations for one destination d
⚫ Initialization
⚫ Each node table has 1 row for destination d
⚫ Distance of node d to itself is zero: Dd=0
⚫ Distance of other node j to d is infinite: Dj=, for j d
⚫ Next hop node nj = -1 to indicate not yet defined for j d
⚫ Send Step
⚫ Send new distance vector to immediate neighbors across local link
⚫ Receive Step
⚫ At node j, find the next hop that gives the minimum distance to d,
⚫ Minj { Cij + Dj }
⚫ Replace old (nj, Dj(d)) by new (nj*, Dj*(d)) if new next node or distance
⚫ Go to send step
28
Bellman-Ford Algorithm
⚫ Now consider parallel computations for all destinations d
⚫ Initialization
⚫ Each node has 1 row for each destination d
⚫ Distance of node d to itself is zero: Dd(d)=0
⚫ Distance of other node j to d is infinite: Dj(d)= , for j d
⚫ Next node nj = -1 since not yet defined
⚫ Send Step
⚫ Send new distance vector to immediate neighbors across local link
⚫ Receive Step
⚫ For each destination d, find the next hop that gives the minimum
distance to d,
⚫ Minj { Cij+ Dj(d) }
⚫ Replace old (nj, Di(d)) by new (nj*, Dj*(d)) if new next node or distance
found
⚫ Go to send step
29
Iteration Node 1 Node 2 Node 3 Node 4 Node 5
4
Jose
3 1 3 6
2
2 5
4
30
Iteration Node 1 Node 2 Node 3 Node 4 Node 5
D3=D6+1
n3=6
D6=0
2 3 1
1 1
5 2
0
4 San
3 6
1 3
Jose
2 5 2
4
2
D5=D6+2 D6=0
n5=6 31
Iteration Node 1 Node 2 Node 3 Node 4 Node 5
3 1
2 3
1 1
5 2
3 0
4 San
3 6
1 3
Jose
2 2
5
4
6 2
32
Iteration Node 1 Node 2 Node 3 Node 4 Node 5
1
3 2 3
1 1
5 2
3 0
4 San
3 6
1 3
Jose
2
2 5
4
6 4 2
33
Iteration Node 1 Node 2 Node 3 Node 4 Node 5
1 5
3 2
3
1 1
5 2
3 0
4 San
3 6
1 3
Jose
2
2 5
4 4
2
Network disconnected; Loop created between nodes 3 and 4 34
Iteration Node 1 Node 2 Node 3 Node 4 Node 5
5
37 2
3
1 1
5 53 2
0
4 San
3 6
1 3
Jose
2
2 5
4
4 2
35
Node 4 could have chosen 2 as next node because of tie
Iteration Node 1 Node 2 Node 3 Node 4 Node 5
5 7
7 2 3
1 1
5 2
5 0
4 San
3 6
1 3
Jose
2 5 2
4
46 2
79 2 7
3
1 1
5 2
5 0
4 San
3 6
1 3
Jose
2
2 5
4
6 2
40
6.3.2. Link-State Algorithm
⚫ Basic idea: two step procedure
⚫ Each source node gets a map of all nodes and link metrics (link state) of the
entire network
⚫ Find the shortest path on the map from the source node to all destination nodes
⚫ Broadcast of link-state information
⚫ Every node i in the network broadcasts to every other node in the network:
⚫ ID’s of its neighbors: Ni=set of neighbors of i
⚫ Distances to its neighbors: {Cij | j Ni}
⚫ Flooding is a popular method of broadcasting packets
41
Dijkstra Algorithm: Finding shortest paths in order
z
w
x
s z'
w"
x' 42
Dijkstra’s algorithm
⚫ N: set of nodes for which shortest path already found
⚫ Initialization: (Start with source node s)
⚫ N = {s}, Ds = 0, “s is distance zero from itself”
⚫ Dj=Csj for all j s, distances of directly-connected neighbors
⚫ Step A: (Find next closest node i)
⚫ Find i N such that
⚫ Di = min Dj for j N
⚫ Add i to N
⚫ If N contains all the nodes, stop
⚫ Step B: (update minimum costs)
⚫ For each node j N
Minimum distance from s to
⚫ Dj = min (Dj, Di+Cij)
j through node i in N 43
⚫ Go to Step A
Execution of Dijkstra’s algorithm
2 2 ✓
1 3 1 1 3 1
6 6 ✓
5 2 5 2
3 3
1 4 1 4✓ 2
2
3 3
2 2
✓ 4 5 4 5
Iteration N D2 D3 D4 D5 D6
Initial {1} 3 2✓ 5
1 {1,3} 3✓ 2 4 3
2 {1,2,3} 3 2 4 7 3 ✓
3 {1,2,3,6} 3 2 4 ✓ 5 3
4 {1,2,3,4,6} 3 2 4 5 ✓ 3
5 {1,2,3,4,5,6} 3 2 4 5 3
44
Shortest Paths in Dijkstra’s Algorithm
2 3 1 2 3 1
1 1
6 6
5 2 5 2
3 3
1 4 2 1 4 2
3 3
2 2
4 5 4 5
2 3 1 2 3 1
1 1
6 6
5 2 5 2
3 3
1 4 2 1 4 2
3 3
2 2
4 5 4 5
2 3 1 2 3 1
1 1
6 6
5 2 5 2
3 3
1 4 2 1 4 2
3 3
2 2 45
4 5 4 5
Reaction to Failure
⚫ If a link fails,
⚫ Router sets link distance to infinity & floods the network with an update
packet
⚫ All routers immediately update their link database & recalculate their
shortest paths
⚫ Recovery very quick
⚫ But watch out for old update messages
⚫ Add time stamp or sequence # to each update message
⚫ Check whether each received update message is new
⚫ If new, add it to database and broadcast
⚫ If older, send update message on arriving link
46
Why is Link State Better?
⚫ Fast, loopless convergence
⚫ Support for precise metrics, and multiple metrics if necessary
(throughput, delay, cost, reliability)
⚫ Support for multiple paths to a destination
⚫ algorithm can be modified to find best two paths
47
Specialized Routing
⚫ Flooding
⚫ Useful in starting up network
⚫ Useful in propagating information to all nodes
⚫ Deflection Routing
⚫ Fixed, preset routing procedure
⚫ No route synthesis
Flooding
Send a packet to all nodes in a network
⚫ No routing tables available
Approach
⚫ Send packet on all ports except one where it
arrived
⚫ Exponential growth in packet transmissions
1 3
6
2
5
2
5
1 3
6
2
5
4 4
2 2
5 5
1 3
6
2
5
Packet buffer
…
1 2 N–1 N
⚫ Scheduling Concepts
⚫ fairness/isolation
⚫ priority, aggregation,
⚫ Packet Dropping
⚫ aggregation, drop priorities
FIFO Queueing
Packet buffer
Arriving
packets
Transmission
Packet discard
link
when full
(b)
Packet buffer
Arriving
packets
Transmission
link
Class 1 Class 2 discard
discard when threshold
when full exceeded
Head Of Line (HOL)
Priority Queueing
Packet discard
when full
Transmission
High-priority
link
packets
Low-priority When
packets high-priority
Packet discard queue empty
when full
⚫ High priority queue serviced until empty
⚫ High priority queue has lower waiting time
⚫ Buffers can be dimensioned for different loss probabilities
⚫ Surge in high priority queue can cause low priority queue to
saturate
HOL Priority Features
…
… Transmission
Packet flow n link
⚫ Each flow has its own logical queue: prevents hogging; allows
differential loss probabilities
⚫ C bits/sec allocated equally among non-empty queues
⚫ transmission rate = C / n(t), where n(t)=# non-empty queues
⚫ Idealized system assumes fluid flow from queues
⚫ Implementation requires approximation: simulate fluid system;
sort packets according to completion time in ideal system
Buffer 1 Fluid-flow system:
at t=0 both packets served
at rate 1/2
Buffer 2 1
at t=0 Both packets
complete service
at t = 2
t
0 1 2
Packet from
Packet-by-packet system:
buffer 2 waiting
buffer 1 served first at rate 1;
then buffer 2 served at rate 1.
1
Packet from buffer 2
being served
Packet from t
buffer 1 being 0 1 2
served
2 Fluid-flow system:
Buffer 1
at t=0 both packets served
at rate 1/2
Buffer 2 1
at t=0 Packet from buffer 2
served at rate 1
t
0 2 3
Packet from t
buffer 2 0 1 2
served at rate 1
Packetized GPS/WFQ
Rounds
Buffer 1
Buffer 2
…
Buffer n
Packet of length
Packet completes k bits begins
transmission transmission
k rounds later at this time
Differential Service:
If a traffic flow is to receive twice as much bandwidth as a
regular flow, then its packet completion time would be half
Computing the Finishing Time
⚫ F(i,k,t) = finish time of kth packet that arrives at time t to flow i
⚫ P(i,k,t) = size of kth packet that arrives at time t to flow i
⚫ R(t) = round number at time t
Generalize so R(t) continuous, not discrete
rounds
R(t) grows at rate inversely
proportional to n(t)
Algorithm:
⚫ Maintain running average of queue length
⚫ If Qavg < minthreshold, do nothing
⚫ If Qavg > maxthreshold, drop packet
⚫ If in between, drop packet according to probability
⚫ Flows that send more packets are more likely to have
packets dropped
Packet Drop Profile in RED
0
minth maxth full
3 6
1
4
8
2
7
5
Throughput
Controlled
Uncontrolled
Offered load
Open-Loop Control
⚫ Network performance is guaranteed to all traffic flows that
have been admitted into the network
⚫ Initially for connection-oriented networks
⚫ Key Mechanisms
⚫ Admission Control
⚫ Policing
⚫ Traffic Shaping
⚫ Traffic Scheduling
Admission Control
⚫ Flows negotiate contract with network
⚫ Specify requirements:
Peak rate Traffic descriptor
⚫ Peak, Avg., Min Bit rate
Bits/second
water poured
irregularly Leak rate corresponds to
long-term rate
Depletion rate:
X’ = X - (ta - LCT) 1 packet per unit time
Non-empty No X’ = 0
arriving packet
No
would cause
overflow X = X’ + I X = value of the leaky bucket counter
LCT = ta X’ = auxiliary variable
conforming packet LCT = last conformance time
conforming packet
Leaky Bucket Example
I=4 L=6 Nonconforming
Packet
arrival
Time
L+I
Bucket
content
* * * * * * * * * Time
L
MBS = 1 +
I −T
MBS
Time
T L I
Dual Leaky Bucket
Dual leaky bucket to police PCR, SCR, and MBS:
Incoming Tagged or
Leaky bucket 1
traffic dropped
SCR and MBS
Untagged traffic
1 2 3 4
Network A Network C
Network B
Egress node Ingress node
Packet
Size N
Incoming traffic Shaped traffic
Server
Packet
⚫ Token rate regulates transfer of packets
⚫ If sufficient tokens available, packets enter network without delay
⚫ K determines how much burstiness allowed into the network
Token Bucket Shaping Effect
The token bucket constrains the traffic from a source to
be limited to b + r t bits in an interval of length t
b+rt
b bytes instantly
r bytes/second
t
Packet transfer with Delay Guarantees
A(t) = b+rt Bit rate > R > r
(a) e.g., using WFQ No backlog
Token Shaper of packets
R(t)
1 2
Buffer Buffer
(b) occupancy Empty
occupancy
at 1 at 2
t t
0 b b
R R-r
Admission
Control
101
What is congestion ? - 2
Congestion Control
102
Closed-Loop Flow Control
⚫ Congestion control
⚫ feedback information to regulate flow from sources into network
⚫ Based on buffer content, link utilization, etc.
⚫ Examples: TCP at transport layer; congestion control at ATM level
⚫ End-to-end vs. Hop-by-hop
⚫ Delay in effecting control
⚫ Implicit vs. Explicit Feedback
⚫ Source deduces congestion from observed behavior
⚫ Routers/switches generate messages alerting to congestion
End-to-End vs. Hop-by-Hop Congestion
Control
Source Packet flow Destination
(a)
Source Destination
(b)
Feedback information
Implicit vs. Explicit feedback
⚫ Implicit feedback Congestion Control
105
Implicit vs. Explicit feedback - 2
⚫ Explicit feedback Congestion Control
◆ Network component (e.g., router) provides congestion indication explicitly
to sources
• use packet marking, or RM cells (in ATM ABR control)
◆ Examples: DECbit, ECN, ATM ABR CC, etc.
◆ Provide more accurate information to sources
◆ But is more complicate to implement
• Need to change both source and network algorithm
• Need cooperation between sources and network component
106
Traffic Engineering
Traffic management at flow aggregate level
3 6 3 6
1 1
4 7 4 7
2 2
8 8
5 5
(a) (b)