+ All Categories
Home > Documents > Computer Networks - ELTE

Computer Networks - ELTE

Date post: 15-Oct-2021
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
109
Computer Networks Sándor Laki ELTE-Ericsson Communication Networks Laboratory ELTE FI – Department Of Information Systems [email protected] http://lakis.web.elte.hu Based on the slides of Laurent Vanbever. Further inspiration: Scott Shenker & Jennifer Rexford & Phillipa Gill
Transcript
Page 1: Computer Networks - ELTE

Computer NetworksSándor Laki

ELTE-Ericsson Communication Networks Laboratory

ELTE FI – Department Of Information Systems

[email protected]

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

Last week onComputer Networks

Page 3: Computer Networks - ELTE

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

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

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

This weekFundamental challenges – Part I

Routing

How do you deliver packetfrom a source to destination?

Page 7: Computer Networks - ELTE

Think of IP packets as envelopes

Packet

Page 8: Computer Networks - ELTE

They have

a header

&

a payload

Think of IP packets as envelopes

Payload

Header

Page 9: Computer Networks - ELTE

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

The payload contains the data to be delivered

Payload

Page 11: Computer Networks - ELTE

Routers forward IP packets hop-by-hoptowards their destination

Page 12: Computer Networks - ELTE

Routers forward IP packets hop-by-hoptowards their destination

src: Bob

dst: Google

Page 13: Computer Networks - ELTE

Routers forward IP packets hop-by-hoptowards their destination

src: Bob

dst: Google

Page 14: Computer Networks - ELTE

Routers forward IP packets hop-by-hoptowards their destination

src: Bob

dst: Google

Page 15: Computer Networks - ELTE

Routers forward IP packets hop-by-hoptowards their destination

src: Bob

dst: Google

Page 16: Computer Networks - ELTE

Routers forward IP packets hop-by-hoptowards their destination

src: Bob

dst: Google

Page 17: Computer Networks - ELTE

Routers forward IP packets hop-by-hoptowards their destination

src: Bob

dst: Google

Page 18: Computer Networks - ELTE

Let’s check what is going on between two neighboring routers

Page 19: Computer Networks - ELTE

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

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

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

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

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

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

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

Nowadays network equipments can haveTerabits per second of forwarding capacity

Page 27: Computer Networks - ELTE

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

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

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

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

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

An example of a spanning tree for destination C

C

Page 33: Computer Networks - ELTE

In the rest of the lecture,we’ll consider destination-based routing

The default in the Internet

Page 34: Computer Networks - ELTE

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

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

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

Control plane = the router’s brain

Page 38: Computer Networks - ELTE

Roles Routing

Configuration

Statistics (counters, meters, etc.)

Control plane = the router’s brain

Page 39: Computer Networks - ELTE

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

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

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

[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

[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

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

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

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

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

How do we verify that a forwarding state is valid?

Page 49: Computer Networks - ELTE

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

C

dst outputC East

dst outputC East

Given a graph

Page 51: Computer Networks - ELTE

Mark all outgoing ports with an arrow

C

Page 52: Computer Networks - ELTE

Eliminate links with no arrow

C

Page 53: Computer Networks - ELTE

Eliminate links with no arrow

C

The result is a spanning tree.This is a valid routing state

Page 54: Computer Networks - ELTE

Example 2Mark all outgoing ports with an arrow

C

Page 55: Computer Networks - ELTE

Example 2Eliminate links with no arrow

C

Page 56: Computer Networks - ELTE

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

How do we compute valid forwarding state?

Page 58: Computer Networks - ELTE

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

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

1) Use tree-like topologies Spanning-tree

Page 61: Computer Networks - ELTE

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

In practice, there can be many spanning-trees for a given topology

Page 63: Computer Networks - ELTE

Spanning tree #1

Page 64: Computer Networks - ELTE

Spanning tree #2

Page 65: Computer Networks - ELTE

Spanning tree #3

Page 66: Computer Networks - ELTE

We’ll see how to compute spanning-trees in 2 weeks.For now, assume it is possible

Page 67: Computer Networks - ELTE

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

useless transmissions

Flooding is quite wasteful

A

B

Page 69: Computer Networks - ELTE

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

A

B

Page 71: Computer Networks - ELTE

A

B

Node A can be reached throughthis link

Page 72: Computer Networks - ELTE

A

B

Blue nodes learnhow to reach node A

Page 73: Computer Networks - ELTE

A

B

Blue nodes learnhow to reach node A

Page 74: Computer Networks - ELTE

A

B

Blue nodes learnhow to reach node A

Page 75: Computer Networks - ELTE

A

B

All nodes know how toreach node A

Page 76: Computer Networks - ELTE

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

A

B

Learning is topology- dependent

The yellow nodes only know how to reach A (not B)

Page 78: Computer Networks - ELTE

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

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

2) Rely on global network view Link-state routing

Page 81: Computer Networks - ELTE

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Building a global view is essentially equal to solving jigsaw puzzle

Page 96: Computer Networks - ELTE

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

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

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

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

3) Rely on distributed computation Distance-vector routing

Page 101: Computer Networks - ELTE

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

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

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

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

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

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

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

Evaluating the complexity of DV is harder,we’ll get back to that in a couple of weeks

Page 109: Computer Networks - ELTE

To be continued…


Recommended