univ. of tehranintroduction to computer network1 an introduction computer networks an introduction...

31
Univ. of Tehran Introduction to Computer Network 1 An Introduction An Introduction to Computer Networks Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 11: Routing

Upload: daniela-harrison

Post on 28-Dec-2015

226 views

Category:

Documents


0 download

TRANSCRIPT

Univ. of TehranIntroduction to Computer

Network 1

An IntroductionAn Introduction to

Computer NetworksComputer Networks

University of TehranDept. of EE and Computer Engineering

By:Dr. Nasser Yazdani

Lecture 11: Routing

Univ. of TehranIntroduction to Computer

Network 2

Outline Routing process Routing Algorithms Scalability

Univ. of TehranIntroduction to Computer

Network 3

Routing Process Question? How to populate the lookup table? Forwarding vs Routing

forwarding: to select an output port based on destination address from the lookup table.

Minimize the lookup time. routing: process by which the routing table is built.

Optimize the calculating paths in case of changing topology. Primery solutions:

Build the lookup table Manually? Is it practical? The answer is no.

Flooding- Broadcast to all node except the one we have received the packet.

Waste the bandwidth Not scale well- Broadcast storm.

Univ. of TehranIntroduction to Computer

Network 4

Overview Network as a Graph

Problem: Find lowest cost, or shortest path between two nodes

The process is distributed and this makes it complicated, I.e, it may create loop.

Factors static: topology dynamic: load

4

3

6

21

9

1

1D

A

FE

B

C

Univ. of TehranIntroduction to Computer

Network 5

Distance Vector Each node maintains a set of triples

(Destination, Cost, NextHop)

Exchange updates directly connected neighbors periodically ( on the order of several seconds) whenever its table changes (called triggered update)

Each update is a list of pairs:(Destination, Cost)

Update local table if receive a “better” route smaller cost came from next-hop

Refresh existing routes; delete if they time out

Univ. of TehranIntroduction to Computer

Network 6

The Bellman-Ford Algorithm

•Bellman-Ford algorithm solve the distance Vector problem in general case.

1. Set: Xo = ( , , ,…, ).

2. Send updates of components of Xn to neighbors

3. Calculate: Xn+1 = F(Xn)

4. If Xn+1 Xn then go to (2)

5. Stop

Univ. of TehranIntroduction to Computer

Network 7

Distance Vector: Control Traffic

By changing the routing table, a node sends its table to its neighbors

A node updates its table with information received from its neighbors

Host A

Host BHost E

Host D

Host C

N1 N2

N3

N4

N5

N7N6

Univ. of TehranIntroduction to Computer

Network 8

Example: Distance Vector Algorithm

A C12

7

B D3

1

Dest.

Cost NextHop

B 2 B

C 7 C

D ∞ -

Node A

Dest.

Cost

NextHop

A 2 A

C 1 C

D 3 D

Node B

Dest.

Cost

NextHop

A 7 A

B 1 B

D 1 D

Node C

Dest.

Cost

NextHop

A ∞ -

B 3 B

C 1 C

Node D1 Initialization: 2 for all neighbors V do3 if V adjacent to A 4 D(A, V) = c(A,V); 5 else 6 D(A, V) = ∞; …

Univ. of TehranIntroduction to Computer

Network 9

Dest. Cost NextHop

B 2 B

C 7 C

D ∞ -

Node A

Example: 1st Iteration (C A)

A C12

7

B D3

1

Dest.

Cost

NextHop

A 2 A

C 1 C

D 3 D

Node B

Dest

Cost

NextHop

A 7 A

B 1 B

D 1 D

Node C

Dest

Cost

NextHop

A ∞ -

B 3 B

C 1 C

Node D(D(C,A), D(C,B), D(C,D))

…7 loop: …12 else if (update D(V, Y) received from V) 13 for all destinations Y do14 if (destination Y through V)15 D(A,Y) = D(A,V) + D(V, Y);16 else17 D(A, Y) = min(D(A, Y), D(A, V) + D(V, Y));18 if (there is a new minimum for dest. Y)19 send D(A, Y) to all neighbors 20 forever

Univ. of TehranIntroduction to Computer

Network 10

Dest.

Cost

NextHop

B 2 B

C 7 C

D 8 C

Node A

Example: 1st Iteration (C A)

A C12

7

B D3

1

Dest.

Cost

NextHop

A 2 A

C 1 C

D 3 D

Node B

Dest.

Cost

NextHop

A 7 A

B 1 B

D 1 D

Node C

Dest.

Cost

NextHop

A ∞ -

B 3 B

C 1 C

Node D

D(A, D) = min(D(A, D), D(A, C) + D(C,D) = min(∞ , 7 + 1) = 8

(D(C,A), D(C,B), D(C,D))

…7 loop: …12 else if (update D(V, Y) received from V) 13 for all destinations Y do14 if (destination Y through V)15 D(A,Y) = D(A,V) + D(V, Y);16 else17 D(A, Y) = min(D(A, Y), D(A, V) + D(V, Y));18 if (there is a new minimum for dest. Y)19 send D(A, Y) to all neighbors 20 forever

Univ. of TehranIntroduction to Computer

Network 11

…7 loop: …12 else if (update D(V, Y) received from V) 13 for all destinations Y do14 if (destination Y through V)15 D(A,Y) = D(A,V) + D(V, Y);16 else17 D(A, Y) = min(D(A, Y), D(A, V) + D(V, Y));18 if (there is a new minimum for dest. Y)19 send D(A, Y) to all neighbors 20 forever

Dest.

Cost

NextHop

B 2 B

C 7 C

D 8 C

Node A

Example: 1st Iteration (B A)

A C12

7

B D3

1

Dest.

Cost

NextHop

A 2 A

C 1 C

D 3 D

Node B

Dest

Cost

NextHop

A 7 A

B 1 B

D 1 D

Node C

Dest.

Cost

NextHop

A ∞ -

B 3 B

C 1 C

Node D

Univ. of TehranIntroduction to Computer

Network 12

Dest.

Cost

NextHop

B 2 B

C 3 B

D 5 B

Node A

Example: 1st Iteration (BA, CA)

A C12

7

B D3

1

Dest.

Cost

NextHop

A 2 A

C 1 C

D 3 D

Node B

Dest.

Cost

NextHop

A 7 A

B 1 B

D 1 D

Node C

Dest.

Cost

NextHop

A ∞ -

B 3 B

C 1 C

Node D

D(A,D) = min(D(A,D), D(A,B) + D(B,D)) = min(8, 2 + 3) = 5

D(A,C) = min(D(A,C), D(A,B) + D(B,C)) = min(7, 2 + 1) = 3

…7 loop: …12 else if (update D(V, Y) received from V) 13 for all destinations Y do14 if (destination Y through V)15 D(A,Y) = D(A,V) + D(V, Y);16 else17 D(A, Y) = min(D(A, Y), D(A, V) + D(V, Y));18 if (there is a new minimum for dest. Y)19 send D(A, Y) to all neighbors 20 forever

Univ. of TehranIntroduction to Computer

Network 13

Example: End of 1st Iteration

A C12

7

B D3

1

Dest.

Cost

NextHop

B 2 B

C 3 B

D 5 B

Node A

Dest.

Cost

NextHop

A 2 A

C 1 C

D 2 C

Node B

Dest.

Cost

NextHop

A 3 B

B 1 B

D 1 D

Node C

Dest.

Cost

NextHop

A 2 B

B 3 B

C 1 C

Node D…7 loop: …12 else if (update D(V, Y) received from V) 13 for all destinations Y do14 if (destination Y through V)15 D(A,Y) = D(A,V) + D(V, Y);16 else17 D(A, Y) = min(D(A, Y), D(A, V) + D(V, Y));18 if (there is a new minimum for dest. Y)19 send D(A, Y) to all neighbors 20 forever

Univ. of TehranIntroduction to Computer

Network 14

Example: End of 3nd Iteration

A C12

7

B D3

1

Dest.

Cost

NextHop

B 2 B

C 3 B

D 4 B

Node A

Dest.

Cost

NextHop

A 2 A

C 1 C

D 2 C

Node B

Dest.

Cost

NextHop

A 3 B

B 1 B

D 1 D

Node C

Dest.

Cost

NextHop

A 4 C

B 2 C

C 1 C

Node D

Nothing changes algorithm terminates

…7 loop: …12 else if (update D(V, Y) received from V) 13 for all destinations Y do14 if (destination Y through V)15 D(A,Y) = D(A,V) + D(V, Y);16 else17 D(A, Y) = min(D(A, Y), D(A, V) + D(V, Y));18 if (there is a new minimum for dest. Y)19 send D(A, Y) to all neighbors 20 forever

Univ. of TehranIntroduction to Computer

Network 15

Link Cost Changes

A C

14

50

B1

“goodnews travelsfast”

D C N

A 4 A

C 1 B

Node B

D C N

A 5 B

B 1 B

Node C

D C N

A 1 A

C 1 BD C N

A 5 B

B 1 B

D C N

A 1 A

C 1 BD C N

A 2 B

B 1 B

D C N

A 1 A

C 1 BD C N

A 2 B

B 1 B

Link cost changes heretime

Algorithm terminates

7 loop: 8 wait (link cost update or update message)9 if (c(A,V) changes by d) 10 for all destinations Y through V do 11 D(A,Y) = D(A,Y) + d 12 else if (update D(V, Y) received from V) 13 for all destinations Y do14 if (destination Y through V)15 D(A,Y) = D(A,V) + D(V, Y);16 else17 D(A, Y) = min(D(A, Y), D(A, V) + D(V, Y));18 if (there is a new minimum for destination Y)19 send D(A, Y) to all neighbors 20 forever

Univ. of TehranIntroduction to Computer

Network 16

Example Destination Cost NextHop A 1 A C 1 C D 2 C E 2 A F 2 A G 3 A

•Distance of other nodes from Node B.• The cost between two nodes has been assumed 1.•All nodes keep a routing table from themselves.

D

G

A

F

E

B

C

Univ. of TehranIntroduction to Computer

Network 17

Routing Loops Example

link from A to E fails A advertises distance of infinity to E B and C advertise a distance of 2 to E B decides it can reach E in 3 hops; advertises this to

A A decides it can read E in 4 hops; advertises this to C C decides that it can reach E in 5 hops…

Univ. of TehranIntroduction to Computer

Network 18

Loop-Breaking Heuristics

Set infinity to a reasonably small number. For instance, RIP sets to 16

Split horizon: Don’t announce the distance to the node the distance has been gotten from.

Split horizon with poison reverse: Instead of not announcing the distance put negative numbers.

Univ. of TehranIntroduction to Computer

Network 19

Link State Strategy

send to all nodes (not just neighbors) information about directly connected links (not entire routing table)

Link State Packet (LSP) id of the node that created the LSP cost of the link to each directly connected

neighbor sequence number (SEQNO) time-to-live (TTL) for this packet

Univ. of TehranIntroduction to Computer

Network 20

Link State (cont) Reliable flooding

store most recent LSP from each node forward LSP to all nodes but one that

sent it generate new LSP periodically

increment SEQNO start SEQNO at 0 when reboot decrement TTL of each stored LSP

discard when TTL=0

Univ. of TehranIntroduction to Computer

Network 21

Route Calculation Dijkstra’s shortest path algorithm Let

N denotes set of nodes in the graph l (i, j) denotes non-negative cost (weight) for edge (i, j) s denotes this node M denotes the set of nodes incorporated so far C(n) denotes cost of the path from s to node n

M = {s}for each n in N - {s}

C(n) = l(s, n)while (N != M)

M = M union {w} such that C(w)is the minimum for all w in (N - M)for each n in (N - M)

C(n) = MIN(C(n), C (w) + l(w, n ))

Univ. of TehranIntroduction to Computer

Network 22

Link state (Example)

A

B

C

D

5 3

2

10

11

•Two list confirmed and tentative

•Always, select the one with minimum distance from the tentative list.

Step Confirmed Tentative

1 (D,0,-)

2 (D,0,-) (B,11,B), (C,2,C)

3 (D,0,-), (C,2,C) (B,5,C), (A, 12,C)

Univ. of TehranIntroduction to Computer

Network 23

Interior Gateway Protocols

RIP: Route Information Protocol developed for XNS distributed with Unix distance-vector algorithm based on hop-count

OSPF: Open Shortest Path First recent Internet standard uses link-state algorithm supports load balancing supports authentication

Univ. of TehranIntroduction to Computer

Network 24

Metrics Original ARPANET metric

measures number of packets enqueued on each link took neither latency or bandwidth into consideration

New ARPANET metric stamp each incoming packet with its arrival time (AT) record departure time (DT) when link-level ACK arrives, compute

Delay = (DT - AT) + Transmit + Latency if timeout, reset DT to departure time for

retransmission link cost = average delay over some time period

Fine Tuning compressed dynamic range replaced dynamic with link utilization

Univ. of TehranIntroduction to Computer

Network 25

How to Make Routing Scale

Flat versus Hierarchical Addresses Inefficient use of Hierarchical Address

Space class C with 2 hosts (2/255 = 0.78% efficient) class B with 256 hosts (256/65535 = 0.39%

efficient) Still Too Many Networks

routing tables do not scale route propagation protocols do not scale

Univ. of TehranIntroduction to Computer

Network 26

Route Propagation Know a smarter router

hosts know local router local routers know site routers site routers know core router core routers know everything

Autonomous System (AS) corresponds to an administrative domain examples: University, company, backbone network assign each AS a 16-bit number

Two-level route propagation hierarchy interior gateway protocol (each AS selects its own) exterior gateway protocol (Internet-wide standard)

Univ. of TehranIntroduction to Computer

Network 27

EGP: Exterior Gateway Protocol

Overview Designed for tree-structured Internet Concerned with reachability, not optimal routes

Protocol messages neighbor acquisition: one router requests that

another be its peer; peers exchange reachability information

neighbor reachability: one router periodically tests if the another is still reachable; exchange HELLO/ACK messages;

routing updates: peers periodically exchange their routing tables (distance-vector)

Univ. of TehranIntroduction to Computer

Network 28

BGP-4: Border Gateway Protocol

AS Types stub AS: has a single connection to one other AS

carries local traffic only multihomed AS: has connections to more than one

AS refuses to carry transit traffic

transit AS: has connections to more than one AS carries both transit and local traffic

Each AS has: one or more border routers one BGP speaker that advertises:

local networks other reachable networks (transit AS only) gives path information

Univ. of TehranIntroduction to Computer

Network 29

BGP Example Speaker for AS2 advertises reachability to P and Q

network 128.96, 192.4.153, 192.4.32, and 192.4.3, can be reached directly from AS2

Speaker for backbone advertises networks 128.96, 192.4.153, 192.4.32, and 192.4.3 can be reached

along the path (AS1, AS2). Speaker can cancel previously advertised paths

Backbone network(AS 1)

Regional provider A(AS 2)

Regional provider B(AS 3)

Customer P(AS 4)

Customer Q(AS 5)

Customer R(AS 6)

Customer S(AS 7)

128.96192.4.153

192.4.32192.4.3

192.12.69

192.4.54192.4.23

Univ. of TehranIntroduction to Computer

Network 30

Internet Structure

Recent Past

NSFNET backboneStanford

BARRNET

regional

BerkeleyPARC

NCAR

UA

UNM

Westnet

regional

UNL KU

ISU

MidNet

regional…

Univ. of TehranIntroduction to Computer

Network 31

Internet Structure

Today

Backbone service provider

Peering

pointPeering

point

Large corporation

Large corporation

Smallcorporation

“Consumer ” ISP

“Consumer ” ISP

“ Consumer ” ISP