Computer Networks - ELTE
Transcript of Computer Networks - ELTE
![Page 1: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/1.jpg)
Computer NetworksSándor Laki
ELTE-Ericsson Communication Networks Laboratory
ELTE FI – Department Of Information Systems
http://lakis.web.elte.hu
Based on the slides of Laurent Vanbever.Further inspiration: Scott Shenker & Jennifer Rexford & Phillipa Gill
![Page 2: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/2.jpg)
Last week onComputer Networks
![Page 3: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/3.jpg)
Applications
…built on…
Reliable (or unreliable) transport
…built on…
Best-effort global packet delivery
…built on…
Best-effort local packet delivery
…built on…
Physical transfer of bits
Each layer provides a service to the layer aboveby using the services of the layer directly below it
![Page 4: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/4.jpg)
Since when bits arrive they must make it tothe application, all the layers exist on a host
Application
Transport
Network
Link
HTTP
TCP
IP
Ethernet
HTTP
TCP
IP
Ethernet
IP
eth
0
eth
1
eth
2
eth
0
eth
1
eth
2
hosts
![Page 5: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/5.jpg)
How long does it take for a packet to reach the destination
What fraction of packets sent to a destination are dropped?
At what rate is the destination receiving data from the source?
A network connection is characterized byits delay, loss rate and throughput
delay throughputloss
![Page 6: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/6.jpg)
This weekFundamental challenges – Part I
Routing
How do you deliver packetfrom a source to destination?
![Page 7: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/7.jpg)
Think of IP packets as envelopes
Packet
![Page 8: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/8.jpg)
They have
a header
&
a payload
Think of IP packets as envelopes
Payload
Header
![Page 9: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/9.jpg)
E.g. identify the
source
destination
of the communication
The header contains metadata needed forforwarding the packet
Payload
src address
dst address
![Page 10: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/10.jpg)
The payload contains the data to be delivered
Payload
![Page 11: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/11.jpg)
Routers forward IP packets hop-by-hoptowards their destination
![Page 12: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/12.jpg)
Routers forward IP packets hop-by-hoptowards their destination
src: Bob
dst: Google
![Page 13: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/13.jpg)
Routers forward IP packets hop-by-hoptowards their destination
src: Bob
dst: Google
![Page 14: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/14.jpg)
Routers forward IP packets hop-by-hoptowards their destination
src: Bob
dst: Google
![Page 15: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/15.jpg)
Routers forward IP packets hop-by-hoptowards their destination
src: Bob
dst: Google
![Page 16: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/16.jpg)
Routers forward IP packets hop-by-hoptowards their destination
src: Bob
dst: Google
![Page 17: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/17.jpg)
Routers forward IP packets hop-by-hoptowards their destination
src: Bob
dst: Google
![Page 18: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/18.jpg)
Let’s check what is going on between two neighboring routers
![Page 19: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/19.jpg)
Two neighboring routers
Data Plane Data Plane
IF-2
IF-1
IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
LOSA HOUS
![Page 20: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/20.jpg)
Upon packet reception, routers locally lookuptheir forwarding table to know where to send it next
Data Plane Data Plane
IF-2
IF-1
IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
LOSA HOUS
src: Bob
dst: Google
Packet
destination outputBob IF-1Google IF-4
Forwarding table
![Page 21: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/21.jpg)
According to the fwd table,the packet should be directed to IF-4
Data Plane Data Plane
IF-2
IF-1
IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
LOSA HOUS
src: Bob
dst: Google
Packet
destination outputBob IF-1Google IF-4
Forwarding table
![Page 22: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/22.jpg)
According to the fwd table,the packet should be directed to IF-4
Data Plane Data Plane
IF-2 IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
LOSA HOUS
src: Bob
Packet
IF-1
dst: Google
![Page 23: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/23.jpg)
destination outputBob IF-2Google IF-3
Forwarding table
Forwarding is repeated at each router until the destination is reached
Data Plane Data Plane
IF-2 IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
LOSA HOUS
src: Bob
Packet
IF-1
dst: Google
![Page 24: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/24.jpg)
destination outputBob IF-2Google IF-3
Forwarding table
Forwarding is repeated at each router until the destination is reached
Data Plane Data Plane
IF-2 IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
LOSA HOUS
src: Bob
Packet
IF-1
dst: Google
![Page 25: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/25.jpg)
src: Bob
Packet
dst: Google
Forwarding is repeated at each router until the destination is reached
Data Plane Data Plane
IF-2
IF-3 IF-1
IF-4
IF-3
LOSA HOUS
IF-1
IF-4 IF-2
![Page 26: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/26.jpg)
Nowadays network equipments can haveTerabits per second of forwarding capacity
![Page 27: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/27.jpg)
criteria destination mandatory (why?)
source requires n2 states
input port traffic engineering
+any other header fields
Forwarding decisions necessarily depend onthe destination, but can also depend on other criteria
![Page 28: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/28.jpg)
criteria destination mandatory (why?)
source requires n2 states
input port traffic engineering
+any other header fields
Forwarding decisions necessarily depend onthe destination, but can also depend on other criteria
![Page 29: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/29.jpg)
Paths from different sources can differLet’s consider source- and destination-based routing
A
B
C
src dst outputA C EastB C South
Forwarding table
![Page 30: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/30.jpg)
Paths from different sources coincide once they overlapWith destination-based routing
A
B
C
Forwarding table
dst outputC EastA NorthB West
![Page 31: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/31.jpg)
Set of paths to the destination produce a spanning tree rooted at the destination:
cover every router exactly once
only one outgoing arrow at each router
Once paths to destination meet,they will never split
![Page 32: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/32.jpg)
An example of a spanning tree for destination C
C
![Page 33: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/33.jpg)
In the rest of the lecture,we’ll consider destination-based routing
The default in the Internet
![Page 34: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/34.jpg)
Where are these forwarding tables coming from?
Data Plane Data Plane
IF-2 IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
destination outputBob IF-1Google IF-4
Forwarding table
IF-1
destination outputBob IF-2Google IF-3
Forwarding table
![Page 35: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/35.jpg)
In addition to a data plane…
Data Plane Data Plane
IF-2
IF-1
IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
![Page 36: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/36.jpg)
In addition to a data plane,routers are also equipped with a control plane
Data Plane Data Plane
IF-2
IF-1
IF-4
IF-3
IF-2
IF-1
IF-4
IF-3
Control Plane Control Plane
![Page 37: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/37.jpg)
Control plane = the router’s brain
![Page 38: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/38.jpg)
Roles Routing
Configuration
Statistics (counters, meters, etc.)
…
Control plane = the router’s brain
![Page 39: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/39.jpg)
Routing is the control plane process thatcomputes and populates the forwarding tables
destination outputBob IF-1Google IF-4
Forwarding table
destination outputBob IF-2Google IF-3
Forwarding table
Control Plane Control Plane
![Page 40: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/40.jpg)
While forwarding is a local process,routing is inherently a global process
A router should know how the network looks likefor directing the packet towards the destination.
![Page 41: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/41.jpg)
forwarding routing
Goal directing a packet to computing the pathan outgoing link packets will follow
Scope local global, network wide
Implementation hardware (usually) software (always)(software is also possible)
Timescale nanoseconds 10s of milliseconds
Forwarding vs routing
![Page 42: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/42.jpg)
[Definition]
A global forwarding state is valid if
it always delivers packets to the correct destination
The goal of routing is to compute valid global forwarding state
![Page 43: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/43.jpg)
[Theorem]
A global forwarding state is valid iff (iff = if and only if)
A) there are no dead ends
dead end = i.e. no outgoing port defined in the table for a given dst
B) there are no loops
loop = i.e. packets going around the same set of nodes
Valid states
![Page 44: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/44.jpg)
A global forwarding state is valid if and only ifthere are no dead ends
A
B
C
dst outputC EastA NorthB West
dst outputA WestB West
No entry for dst CIt drops all traffic to C
![Page 45: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/45.jpg)
A global forwarding state is valid if and only ifthere are no forwarding loops
A
B
C
dst outputC EastA NorthB West
dst outputC WestA WestB West
It bounces traffic back
![Page 46: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/46.jpg)
If a routing state is validthen there are no loops or dead-end
[Proof]
If you run into a dead-end or a loop
you’ll never reach the destination
Proving the necessary condition is easy
![Page 47: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/47.jpg)
If a routing state has no dead end and no loop then it is valid
[Proof]
A) Assumption: there is only a finite number of ports to visit
B) A packet can never enter a switch via the same port,
otherwise it is a loop (which does not exist by assumption)
C) As such, the packet must eventually reach the destination
Proving the sufficient condition is more subtle
![Page 48: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/48.jpg)
How do we verify that a forwarding state is valid?
![Page 49: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/49.jpg)
A simple algorithm for one destination
1) Mark all outgoing ports with an arrow
2) Eliminate all links with no arrow
3) State is valid iff the remaining graph is a spanning-tree
Verifying that a routing state is valid is easy
![Page 50: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/50.jpg)
C
dst outputC East
dst outputC East
Given a graph
![Page 51: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/51.jpg)
Mark all outgoing ports with an arrow
C
![Page 52: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/52.jpg)
Eliminate links with no arrow
C
![Page 53: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/53.jpg)
Eliminate links with no arrow
C
The result is a spanning tree.This is a valid routing state
![Page 54: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/54.jpg)
Example 2Mark all outgoing ports with an arrow
C
![Page 55: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/55.jpg)
Example 2Eliminate links with no arrow
C
![Page 56: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/56.jpg)
Example 2Eliminate links with no arrow
C
The result is not a spanning-tree.The routing state is not valid
dead-end
loop
![Page 57: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/57.jpg)
How do we compute valid forwarding state?
![Page 58: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/58.jpg)
Preventing dead-ends
easy
Preventing loops
harder – we will focus on this…
Producing valid routing state is hard,but doable
![Page 59: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/59.jpg)
Essentially, there are three ways to compute valid routing state
Intuition Example
1) Use tree-like topologies Spanning-tree
2) Rely on global network view Link-state routingSDN
3) Rely on distributed computation Distance vector routingBGP
Existing routing protocols differ inhow they avoid loops
![Page 60: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/60.jpg)
1) Use tree-like topologies Spanning-tree
![Page 61: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/61.jpg)
A simple algorithm
1) Take an arbitrary topology
2) Build a spanning tree and ignore all other links
3) Done!
Why does it work?
Spanning-trees have only one path
between any two nodes
The easiest way to avoid loops is to route trafficon a loop-free topology
![Page 62: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/62.jpg)
In practice, there can be many spanning-trees for a given topology
![Page 63: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/63.jpg)
Spanning tree #1
![Page 64: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/64.jpg)
Spanning tree #2
![Page 65: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/65.jpg)
Spanning tree #3
![Page 66: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/66.jpg)
We’ll see how to compute spanning-trees in 2 weeks.For now, assume it is possible
![Page 67: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/67.jpg)
Literally just flood the packets everywhere
When a packet arrives,simply send it on all ports
Once we have a spanning tree,forwarding on it is easy
A
B
![Page 68: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/68.jpg)
useless transmissions
Flooding is quite wasteful
A
B
![Page 69: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/69.jpg)
Problem
The issue is that nodes do not know their respective locations
Solution
Nodes can learn how to reach nodes by remembering where packets came from
Intuition if flood packet from node A entered switch X on port 4
then switch X can use port 4 to reach node A
![Page 70: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/70.jpg)
A
B
![Page 71: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/71.jpg)
A
B
Node A can be reached throughthis link
![Page 72: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/72.jpg)
A
B
Blue nodes learnhow to reach node A
![Page 73: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/73.jpg)
A
B
Blue nodes learnhow to reach node A
![Page 74: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/74.jpg)
A
B
Blue nodes learnhow to reach node A
![Page 75: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/75.jpg)
A
B
All nodes know how toreach node A
![Page 76: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/76.jpg)
A
B
B answers back to ANo need for flooding anymore
enabling the blue nodes to also learn where B is
![Page 77: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/77.jpg)
A
B
Learning is topology- dependent
The yellow nodes only know how to reach A (not B)
![Page 78: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/78.jpg)
Flood first packet to node you’re trying to reach
all switches learn where you are
When destination answers, some switches learn where it is
some because packet to you is not flooded anymore
The decision to flood or not is done on each switch
depending on who has communicated before
Routing by flooding on a spanning-treein a nutshell
![Page 79: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/79.jpg)
advantages disadvantages
plug-and-play only use the links of the spanning-tree
configuration-free eliminate many links from the topology
inefficient
automatically adapts slow to react to failures
to moving host slow to react to host movement
Spanning-tree in practiceused in Ethernet
![Page 80: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/80.jpg)
2) Rely on global network view Link-state routing
![Page 81: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/81.jpg)
Once a node u knows the entire topology,
it can compute shortest-paths using Dijkstra’s algorithm
Initialization Loop
If each router knows the entire graph,it can locally compute paths to all other nodes
S = {u} for all nodes v:
if (v is adjacent to u):D(v) = c(u,v)
else:D(v) = ∞
while not all nodes in S:add w with the smallest D(w) to Supdate D(v) for all adjacent v (to w) not in S:
D(v) = min{D(v), D(w) + c(w,v)}
![Page 82: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/82.jpg)
Once a node u knows the entire topology,
it can compute shortest-paths using Dijkstra’s algorithm
Initialization Loop
If each router knows the entire graph,it can locally compute paths to all other nodes
S = {u} while not all nodes in S:
for all nodes v:if (v is adjacent to u):
D(v) = c(u,v)else:
D(v) = ∞
while not all nodes in S:add w with the smallest D(w) to Supdate D(v) for all adjacent v (to w) not in S:
D(v) = min{D(v), D(w) + c(w,v)}
u is the node running thealgotrithm
The weight of link connecting u and v
![Page 83: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/83.jpg)
Dijkstra’s Algorithm - Example
10
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 84: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/84.jpg)
Dijkstra’s Algorithm - Example
0
10
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 85: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/85.jpg)
Dijkstra’s Algorithm - Example
0
5
10
10
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 86: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/86.jpg)
Dijkstra’s Algorithm - Example
0
5
10
10
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 87: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/87.jpg)
Dijkstra’s Algorithm - Example
0
5
8
7
1410
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 88: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/88.jpg)
Dijkstra’s Algorithm - Example
0
5
8
7
1410
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 89: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/89.jpg)
Dijkstra’s Algorithm - Example
0
5
8
7
1310
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 90: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/90.jpg)
Dijkstra’s Algorithm - Example
0
5
8
7
1310
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 91: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/91.jpg)
Dijkstra’s Algorithm - Example
0
5
8
7
910
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 92: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/92.jpg)
Dijkstra’s Algorithm - Example
0
5
8
7
910
1
5
2
649
7
2 3
S set is marked by green
D values are writteninside the nodes
![Page 93: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/93.jpg)
iteration #1 search for minimum through n nodes
iteration #2 search for minimum through n-1 nodes
iteration #n search for minimum through 1 node
𝑛(𝑛+1)
2operations => O(n2)
This algorithm has a O(n2) complexitywhere n is the number of nodes in the graph
![Page 94: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/94.jpg)
iteration #1 search for minimum through n nodes
iteration #2 search for minimum through n-1 nodes
iteration #n search for minimum through 1 node
𝑛(𝑛+1)
2operations => O(n2)
This algorithm has a O(n2) complexitywhere n is the number of nodes in the graph
Better implementations rely on a heapto find the next node to expand,
bringing down the complexity to O(n log n)
![Page 95: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/95.jpg)
Building a global view is essentially equal to solving jigsaw puzzle
![Page 96: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/96.jpg)
Node A only knows:
A) it is connected to B and D
B) the weigths to reach them(by configuration).
Initially,routers only know their ID and their neighbors
10
5
B
A
D
![Page 97: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/97.jpg)
Node A’s advertisement
edge(A,B); cost=10
edge(A,D); cost=5
At the end of the flooding process,
everybody share the exact same view of the network
Each routers builds a message (known as Link-State Advertisement (LSA))and floods it (reliably) in the entire network
10
1
5
2
649
7
2 3A
B
E
C
D
![Page 98: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/98.jpg)
Dijkstra will always converge to a unique stable statewhen run on static weights
Dynamically changing weights can lead to oscillations
![Page 99: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/99.jpg)
Solution #1 Use static weights
i.e. don’t do congestion-aware routing
Solution #2 Use randomness to break self-synchronization
wait(random(0,50ms)); send(new_link_weight);
Solution #3 Have the routers agree on the paths to use
essentially meaning to rely on circuit-switching
The problem of oscillation is fundamental tocongestion-based routing with local decisions
![Page 100: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/100.jpg)
3) Rely on distributed computation Distance-vector routing
![Page 101: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/101.jpg)
Let dx(y) be the cost of the least-cost path known by x to reach y
1) Each node bundles these distances into one message (called a vector)
that it repeatedly sends until convergence to all its neighbors
2) Each node updates its distances based on neighbors’ vectors:
dx(y) = min{ c(x,v) + dv(y) }
Instead of locally compute paths based on the graph,paths can be computed in a distributed fashion
![Page 102: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/102.jpg)
Let’s compute the shortest-pathfrom u to D
u
A B
CD
E
2
3 1
1
5
1
2
![Page 103: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/103.jpg)
The values computed by a node udepends on what it learns from its neighbors (A and E)
u
A B
CD
E
2
3 1
1
5
1
2
dx(y) = min{ c(x,v) + dv(y) }over all neighbors v
Now:du(D) = min{ c(u, A) + dA(D),
c(u, E) + dE(D) }
![Page 104: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/104.jpg)
To unfold the recursion,let’s start with the direct neighbor of D
u
A B
CD
E
2
3 1
1
5
1
2dB(D) = 2
dC(D) = 5
![Page 105: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/105.jpg)
B and C announce their vector to their neighbors,enabling A to compute its shortest-path
u
A B
CD
E
2
3 1
1
5
1
2
dA(D) = min { 1 + dB(D),1 + dC(D) }
= min { 1 + 2, 1 + 5 }
= 3
![Page 106: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/106.jpg)
B and C announce their vector to their neighbors,enabling A to compute its shortest-path
u
A B
CD
E
2
3 1
1
5
1
2
dA(D) = min { 1 + dB(D),1 + dC(D) }
= min { 1 + 2, 1 + 5 }
= 3
dE(D) = min { 1 + dC(D) }
= min { 1 + 5 }
= 6
As soon as a distance vector changes,each node propagates it to its neighbor
![Page 107: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/107.jpg)
Eventually, the process convergesto the shortest-path distance to each destination
u
A B
CD
E
2
3 1
1
5
1
2
du(D) = min { 2 + dA(D),3 + dE(D) }
= min { 2 + 3, 3 + 6 }
= 5
u directs the traffic to the best neighborbest nb = the one with the smallest cost in the forwarding table
![Page 108: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/108.jpg)
Evaluating the complexity of DV is harder,we’ll get back to that in a couple of weeks
![Page 109: Computer Networks - ELTE](https://reader031.fdocuments.us/reader031/viewer/2022012019/616870bed394e9041f6f98ae/html5/thumbnails/109.jpg)
To be continued…