CS 352 Internet Technology Routing

56
1 CS 352 Internet Technology Routing Richard Martin Dept. of Computer Science Rutgers University www.btechebooks4u.blogspot.com www.btechebooks4u.blogspot.com

description

CS 352 Internet Technology Routing. Richard Martin Dept. of Computer Science Rutgers University. www.btechebooks4u.blogspot.com. Forwarding vs Routing. Routing is the decision which path to take Forwarding is the lookup once the decision has been made - PowerPoint PPT Presentation

Transcript of CS 352 Internet Technology Routing

Page 1: CS 352 Internet Technology Routing

1

CS 352Internet Technology

Routing

Richard Martin

Dept. of Computer Science

Rutgers University

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 2: CS 352 Internet Technology Routing

2

Forwarding vs Routing

• Routing is the decision which path to take

• Forwarding is the lookup once the decision has been made These functions are typically decoupled in

real systems

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 3: CS 352 Internet Technology Routing

3

Routing Algorithms

• A routing algorithm decides which output link an incoming packet should be transmitted on

• A routing “table” contains the mappings from the networks and host addresses to output ports on the router

• The routing algorithm builds this “table”

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 4: CS 352 Internet Technology Routing

4

Forwarding

• A forwarding algorithm performs the lookup of address to output port

• In connection-oriented service, the forwarding algorithm is performed by switches and only during connection setup

• In connectionless service, the forwarding algorithm is performed by routers every time a packet arrives

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 5: CS 352 Internet Technology Routing

5

Example Routing Table

remus:/ug/u1/rmartin%netstat -rn

Routing Table:

Destination Gateway Flags Ref Use Interface

-------------------- -------------------- ----- ----- ------ --------

128.6.13.0 128.6.13.3 U 3 4259 hme0

224.0.0.0 128.6.13.3 U 3 0 hme0

default 128.6.13.21 UG 02184931

127.0.0.1 127.0.0.1 UH 0 346400 lo0

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 6: CS 352 Internet Technology Routing

6

Routing Algorithms

• Two types of routing algorithms:

Non-Adaptive Routing Algorithms

Adaptive Routing Algorithms• Hierarchical Routing is used to make these

algorithms scale to large networks

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 7: CS 352 Internet Technology Routing

7

Non-Adaptive Routing Algorithms

• Non-adaptive routing algorithms do not base their routing decisions on the current state of the network

• Examples: Flooding Shortest Path Routing

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 8: CS 352 Internet Technology Routing

8

Flooding Algorithm

• Every incoming packet is sent out on every outgoing line except the one it arrived on No routing table, no lookup!

• Problem: Vast number of duplicated packets

Page 9: CS 352 Internet Technology Routing

9

Reducing Flooding Algorithm’s Duplicate Packets

• Solution 1: Hop counter Have a hop counter in the packet header Routers decrement each arriving packet’s hop

counter Routers discard a packet with hop count=0 Ideally, the hop counter should be initialized to the

length of the path from the source to the destination

Hop count defines the “Horizon” of the packet, which is how far a node can “see”.

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 10: CS 352 Internet Technology Routing

10

Reducing Flooding Algorithm’s Duplicate Packets (cont’d)

• Solution 2: Sequence Numbers Require the first router hop to put a sequence

number in each packet it receives from its hosts Each router maintains a table listing the sequence

numbers it has seen from each first-hop router. The router can then discard packets it has already seen.

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 11: CS 352 Internet Technology Routing

11

Flooding Uses

• Used in small networks or limited horizon order 100’s of nodes

• Military A pplications Large number of routers is desirable If one router is taken out (by a bomb?) flooding will

still get packets to their destinations

• Distributed Databases Simultaneous updates of multiple databases can

be done with a single packet transmission Gnutella search is an example, uses horizon

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 12: CS 352 Internet Technology Routing

12

Shortest Path Routing

• For a pair of communicating hosts, there is a shortest path between them

• Shortness may be defined by: Number of router/switch hops Geographic distance Link delay

Page 13: CS 352 Internet Technology Routing

13

Shortest Path

A

B

C E

FD

3

1

2

4

2

3

2

Edge Weight(Distance)

What is the shortest path between A and F?

1

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 14: CS 352 Internet Technology Routing

14

Computing the Shortest Path

• Dijkstra’s Shortest Path Algorithm: Step 1: Draw nodes as circles. Fill in a circle to mark it as a

“permanent node.” Step 2: Set the current node equal to the source node Step 3: For the current node:

– Mark the cumulative distance from the current node to each non-permanent adjacent node. Also mark the name of the current node. Erase this marking if the adjacent node already has a shorter cumulative distance marked

– Mark the non-permanent node with the shortest listed cumulative distance as permanent and set the current node equal to it. Repeat step 3 until all nodes are marked permanent.

Page 15: CS 352 Internet Technology Routing

15

Dijskstra’s Shortest Path AlgorithmExample

A

B

G

E F

C

H

D

7

4

2

2

4

1

2 3

2

3

2

Selected edge

Candidate edgeNot visited

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 16: CS 352 Internet Technology Routing

16

Dijskstra’s Shortest Path AlgorithmExample

A

B

G

E F

C

H

D

7

4

2

2

6

1

2 3

2

3

2

Selected edge

Candidate edgeNot visited

Page 17: CS 352 Internet Technology Routing

17

Dijskstra’s Shortest Path AlgorithmExample

A

B

G

E F

C

H

D

7

4

2

2

6

1

2 3

2

3

2

Selected edge

Candidate edgeNot visited

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 18: CS 352 Internet Technology Routing

18

Dijskstra’s Shortest Path AlgorithmExample

A

B

G

E F

C

H

D

7

4

2

2

6

1

2 3

2

3

2

Selected edge

Candidate edgeNot visited

Page 19: CS 352 Internet Technology Routing

19

Dijskstra’s Shortest Path AlgorithmExample

A

B

G

E F

C

H

D

7

4

2

2

6

1

2 3

2

3

2

Selected edge

Candidate edgeNot visited

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 20: CS 352 Internet Technology Routing

20

Dijkstra’s Algorithm

step N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F)

0 A 2,A 5,A 1,A

1 AD 2,A 4,D 2,D

2 ADE 2,A 3,E 4,E

3 ADEB 3,E 4,E

4 ADEBC 4,E

5 ADEBCF

A F

E

C

D

B2

2

5

1

1

2

3

5

1

3

Page 21: CS 352 Internet Technology Routing

21

Shortest Path Routing (cont’d)

• Non-adaptive, if: geographical distances are used as edge weights maximum link throughputs are used as edge

weights Number of IMP hops are used as edge weights

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 22: CS 352 Internet Technology Routing

22

Adaptive Routing Algorithms

• Problems with non-adaptive algorithms If traffic levels in different parts of the subnet

change dramatically and often, non-adaptive routing algorithms are unable to cope with these changes

Lots of computer traffic is bursty, but non-adaptive routing algorithms are usually based on average traffic conditions

• Adaptive routing algorithms can deal with these situations

Page 23: CS 352 Internet Technology Routing

23

Adaptive Routing Algorithms (cont’d)

• Three Types: Centralized Adaptive Routing Isolated Adaptive Routing Distributed Adaptive Routing

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 24: CS 352 Internet Technology Routing

24

Centralized Adaptive Routing

• Routing table adapts to network traffic• A routing control center is somewhere in the

network• Periodically, each router forwards link status

information to the control center• The center can, with Dijkstra’s shortest path

algorithm, compute the best routes• Best routes are dispatched to each router

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 25: CS 352 Internet Technology Routing

25

Problem with Centralized Algorithms

• Vulnerability If the control center goes down, routing becomes

non-adaptive

• Scalability The control center must handle a great deal of

routing information, especially for larger networks

Page 26: CS 352 Internet Technology Routing

26

Isolated Adaptive Routing Algorithms

• Routing decisions are made only on the basis of information available locally in each router

• Examples: Hot Potato Backward Learning

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 27: CS 352 Internet Technology Routing

27

Hot Potato Routing

• When a packet arrives, the router tries to get rid of it as fast as it can by putting it on the output line that has the shortest queue

• Hot potato does not care where the output line leads

• Not very effective

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 28: CS 352 Internet Technology Routing

28

Backward Learning Routing

• Packet headers include destination and source addresses. They also include a hop counter

• Network nodes, initially ignorant of network topology, acquire knowledge of the network state as packets are handled

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 29: CS 352 Internet Technology Routing

29

Backward Learning

• Algorithm: Routing is originally random A packet with a hop count of one is from a directly connected

node; thus, neighboring nodes are identified with their connecting links

A packet with a hop count of two is from a source two hops away, etc.

As packets arrive, the router compares the hop count for a given source address with the minimum hop count already registered; if the new one is less, it is substituted for the previous one

Page 30: CS 352 Internet Technology Routing

30

Distributed Routing Algorithms

• Each router periodically exchanges routing information (e.g., estimated time delay, queue length, etc.) with its neighbors

• Examples: Distance Vector Routing Link State Routing

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 31: CS 352 Internet Technology Routing

31

Distance Vectors

• Each router maintains lists of best-known distances to all other known routers. These lists are called “vectors.”

• Each router is assumed to know the exact distance (in delay, hop count, etc.) to other routers directly connected to it.

• Periodically, vectors are exchanged between adjacent routers, and each router updates its vectors.

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 32: CS 352 Internet Technology Routing

32

Distance Vectors (cont’d)

Page 33: CS 352 Internet Technology Routing

33

Convergence Speed

• Supposed all routers know the current state of the network

• Next, a change in link-status happens

• How fast the routers learn new state of the network is the “convergence” speed

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 34: CS 352 Internet Technology Routing

34

Problem: Count-to-Infinity

• With distance vector routing, links coming on line converge quickly but link failures converge slowly

• This problem for DV routing algorithms is call “count-to-infinity”

Page 35: CS 352 Internet Technology Routing

35

Count-to-Infinity

A B C D E

1 2 3 4

3 2 3 4

3 4 3 4

5 4 5 4

5 6 5 6

7 6 7 6

Initially

After 1 exchange

After 2 exchanges

After 3 exchanges

After 4 exchanges

After 5 exchanges

etc… to infinity

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 36: CS 352 Internet Technology Routing

36

Split Horizon

• Insight: It’s not useful to claim reachablility for a destination to the neighbor from which the route was learned

• Don’t report routes back to node from which the route was learned E.g. If I hear from X has the shortest route

to Y, don’t report to X I have a route to Y

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 37: CS 352 Internet Technology Routing

37

Poison Reverse

• Not reporting a route means having to wait for a timeout

• Report “split-horizon” routes as infinity to break loops on the first routing exchange.

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 38: CS 352 Internet Technology Routing

38

Split Horizon with Poisoned Reverse

A B C D E

inf. 2 3 4

inf. 2 3 4

inf. inf. 3 4

inf. inf. inf. 4

inf. inf. inf. inf.

B learns A is dead

After 1 exchange

After 2 exchanges

After 3 exchanges

C reports to B that A’s metric is inf.

inf.

Page 39: CS 352 Internet Technology Routing

39

Split Horizon Failure

A B

C

D

If D goes down, A and B will still count to infinity.

Split-Horizon infinity messages are sent from A->C and B->C, not A<->B

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 40: CS 352 Internet Technology Routing

40

Link State Routing

• Each router measures the distance (in delay, hop

count, etc.) between itself and its adjacent routers

• The router builds a packet containing all these

distances. The packet also contains a sequence

number and an age field.

• Each router distributes these packets using flooding

• Each router builds map of the entire network, uses a

shortest-path algorithm

Page 41: CS 352 Internet Technology Routing

41

Link State Routing (cont’d)

• To control flooding, the sequence numbers are used by routers to discard flood packets they have already seen from a given router

• The age field in the packet is an expiration date. It specifies how long the information in the packet is good for.

• Once a router receives all the link state packets from the network, it can reconstruct the complete topology and compute a shortest path between itself and any other node using Dijsktra’s algorithm.

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 42: CS 352 Internet Technology Routing

42

Hierarchical Routing

• All routing algorithms have difficulties as the network becomes large

• For large networks, the routing tables grow very quickly, and so does the number of flood packets

• How can this be reduced? Hierarchical routing

Page 43: CS 352 Internet Technology Routing

43

Hierarchical Routing (cont’d)

• Segment the network into regions• Routers in a single region know all the details

about other routers in that region, but none of the details about routers in other regions

• Analogy: Telephone area codes

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 44: CS 352 Internet Technology Routing

44

Hierarchical Routing (cont’d)

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 45: CS 352 Internet Technology Routing

45

RIP

• Route Information Protocol• One of the routing algorithms used by the

Internet• Based on distance vector routing• Did not scale well

suffered the count-to-infinity problem weak security

• RIP is phased out for large backbones but still widely used for smaller networks

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 46: CS 352 Internet Technology Routing

46

OSPF

• Open Shortest Path First• Routing algorithm now used in the Internet• OSPF uses the Link State Routing algorithm with

modifications to support: Multiple distance metrics (geographical distance,

delay, throughput) Support for real-time traffic Hierarchical routing Security

Page 47: CS 352 Internet Technology Routing

47

OSPF (cont’d)

• OSPF divides the network into several hierarchies: Autonomous Systems (AS’s)

– groups of subnets Areas

– Groups of routers within an AS Backbone Areas

– Groups of routers that connect other areas together

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 48: CS 352 Internet Technology Routing

48

OSPF (cont’d)

Area

Area

BackboneArea

Autonomous System

Area

Area

BackboneArea

Autonomous System

Area

Page 49: CS 352 Internet Technology Routing

49

OSPF (cont’d)

• Routers are distinguished by the functions they perform Internal routers

– Only route packets within one area Area border routers

– Connect to areas together Backbone routers

– Reside only in the backbone area AS boundary routers

– Routers that connect to a router outside the AS

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 50: CS 352 Internet Technology Routing

50

OSPF: Modified Link State Routing

• Recall: In link state routing, routers flood their routing information to

all other routers in the network• In OSPF, routers only send their information to “adjacent

routers”, not to all routers.• Adjacent does NOT mean nearest-neighbor in OSPF• One router in each area is marked as the “designated router”• Designated routers are considered adjacent to all other routers

in the area• OSPF combines link state routing with centralized adaptive

routing

Page 51: CS 352 Internet Technology Routing

51

OSPF: Adjacency

A

B

C

D

E

DesignatedRouter

Area

F

To backbonearea

Example:C is “adjacent” to B but not to A or EB is “adjacent” to all routers in the area

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 52: CS 352 Internet Technology Routing

52

Mobile Routing

• How to deal with mobile computers?

• Want a single network address to route to a single computer, wherever it is. Example: Cell phone number allways

contacts a single device, even when changing access points.

Page 53: CS 352 Internet Technology Routing

53

Motivating Mobility

Radio Media M is a mobile host

A

B

C E

FD

3

1

2

4

2

3

2

1

M

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 54: CS 352 Internet Technology Routing

54

Motivating Mobility

Radio Media M is a mobile host

Now M can only contact C

Update all routingtables?

A

B

C E

FD

3

1

2

4

2

3

2

1

M

Page 55: CS 352 Internet Technology Routing

55

Mobility Solutions

• Home agent: Keeps track of a Mobile’s position in fixed network Serves as the contact point for M

• Foreign agent: Record all mobile agents in area. Act as mobile’s representative in local area

• Tunneling: Sending a layer N(3) packet in layer N.

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com

Page 56: CS 352 Internet Technology Routing

56

Mobility Example

S

F

H

M

(2) Mobile registers withforeign agent

(3) Foreign and Home agents authenticate

(1) Mobile broadcasts to find foreign agent

(4)Traffic from S to M routed to H and tunneled through H<->F

1,2

3

4

www.btechebooks4u.blogspot.comwww.btechebooks4u.blogspot.com