1 routing protocols. 2 distributed routing protocols rtrs exchange control info use it to calculate...

26
1 Routing Protocols

Upload: paulina-stephens

Post on 11-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

1

Routing Protocols

Page 2: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

2

Distributed Routing Protocols

• Rtrs exchange control info

• Use it to calculate forwarding table

• Two basic types– distance vector (DECnet, “old” ARPANET,

RIP)– link state (“new” ARPANET 1980, DECnet

Phase V 1985, IS-IS 1988, OSPF version 2 1998).

Page 3: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

3

Distance Vector Routing• Rtr knows

– own ID– how many cables hanging off box– cost, for each cable, of getting to nbr

j

k

m

n

cost 3

cost 2

cost 2

cost 7I am “4”

Page 4: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

4

Distance Vector (DV) Routing

• Initialize distances to all rtrs in the network to be 0, except to its nbrs.

• Rtr learns from nbrs their distances to all nodes in the network, calculate own distances, and forward the distance vector to nbrs. This repeats until the distance vector converges.

• Rtr updates the distance vector whenever it receives different distance vector from some nbr, or whenever some link breaks.

• Distance vector is either sent periodically or when the network configuration changes.

Page 5: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

5

j

k

m

n

cost 3

cost 2

cost 2

cost 7I am “4”

distance vector rcv’d from cable j

distance vector rcv’d from cable k

distance vector rcv’d from cable m

distance vector rcv’d from cable n

your own calculated distance vector

your own calculated forwarding table

12 3 15 3 12 5 3 18 0 7 15

5 8 3 2 10 7 4 20 5 0 15

0 5 3 2 19 9 5 22 2 4 7

6 2 0 7 8 5 118 12 3 2

2

m

6

j

5

k/m

0

0

12

k

8

j

6

k/j

cost 3

cost 2

cost 2

cost 7

19

n

3 ?

j ?

?

?

Example of DV Routing

Page 6: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

6

Problems with Distance Vector Routing

• B does not conclude that C is unreachable but that d(B,C)=d(B,A)+d(A,C) =3

• When A receives DV from B it concludes that d(A,C)=4

• DV increases in this until infinity, or maximum value which is set by administrator. For this reason, the cost field has the small size.

A B C

Page 7: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

7

Split Horizon

• This technique sometime prevents counting toward infinity.• If R1 forwards packets to D through R2, then R1 informs R2

that its distance to D is infinity. • So, when the link toward node D fails, R2 learns from R1 that

its distance to D is infinity immediately, i.e. that D is unreachable.

R1 R2 D

Page 8: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

8

• Unfortunatelly, split horizon does not always work. • When link to D fails, R1 concludes that D is unreachable.• R2 gets the information from R1 that D is unreachable, and sets the

path to D through R3, calculating DV based on DV of R3. R2 sends new DV to R1, that updates it and sends it further to R3. R3 updates DV and sends it to R3, which updates it and sends it to R2 etc. Cost of path to D is again increasing slowly toward infinity.

R2

D

R1

R3

Split Horizon

Page 9: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

9

Link State Routing

• Construct Link State Packet (LSP)– who you are– list of (nbr, cost) pairs

• Broadcast LSPs to all rtrs• Store latest LSP from each rtr received from

nbrs• Compute Routes• Forward LSPs from each nbr to other nbrs

Page 10: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

10

Building Link State Packets

(a) A subnet. (b) The link state packets for this subnet.

Page 11: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

11

Computing Routes

• Edsgar Dijkstra’s algorithm:– calculate tree of shortest paths from self to each

– also calculate cost from self to each

– Algorithm:

• step 0: put (SELF, 0) on tree

• step 1: look at LSP of node (N,c) just put on tree. If for any nbr K, this is best path so far to K, put (K, c+dist(N,K)) on tree, child of N, with dotted line

• step 2: make dotted line with smallest cost solid, go to step 1

Page 12: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

12

A B C

D E F

G

6 25

1

2122 4

A

B/6

D/2

B

A/6

C/2

E/1

C

B/2

F/2

G/5

D

A/2

E/2

E

B/1

D/2

F/4

F

C/2

E/4

G/1

G

C/5

F/1

Example of Dijkstra Algorithm

Page 13: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

13

C(0)

B(2)

F(2)

G(5)

C(0)

B(2)

F(2)

G(5)

C(0)

B(2)

F(2)

G(5)

E(6) G(3)C(0)

B(2)

F(2)

E(6) G(3)

C(0)

B(2)

F(2)

E(6) G(3)

A(8) E(3)

C(0)

B(2)

F(2)

G(3)

A(8) E(3)

Example of Dijkstra Algorithm

Page 14: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

14

C(0)

B(2)

F(2)

G(3)

A(8) E(3)

D(5)

C(0)

B(2)

F(2)

G(3)

A(8) E(3)

D(5)

C(0)

B(2)

F(2)

G(3)

A(8) E(3)

D(5)

A(7)C(0)

B(2)

F(2)

G(3)

E(3)

D(5)

A(7)

Forwarding table:A/BB/BC/selfD/BE/BF/FG/F

Example of Dijkstra Algorithm

Page 15: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

15

Distance Vector vs Link State

• Memory: distance vector wins (but memory is cheap)

• Computation: debatable• Simplicity of coding: simple distance vector wins. • Convergence speed: link state better• Functionality: link state can have custom routes,

mapping the net, easier troubleshooting,

Page 16: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

16

Routing Information Protocol (RIP)

• Packets are requests and responses. • Report through response every destination every 30

seconds, or as a reply to request. • Throw away info if too old (90s for IP)• Request when a rtr comes up or when info is too old• Maximum cost is 16• 0.0.0.0 with mask 0.0.0.0 is default destination• Most implementations of IP RIP do

– split horizon– triggered updates– poison reverse (rtr that learns about link fail announce the distance

through it as infinity).

Page 17: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

17

RIP Version 1 Header

Command

Version

Reserved

Address Family ID (=2 for IP)

Address

Metric

1

1

2

2

14

4

RequestOr Response

Page 18: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

18

RIP Version 2 HeaderCommand

Version=2

Reserved

Address Family=0xFFFF

1

1

2

2

16

4

RequestOr Response

Authentication TypeAuthentication Info

Address Family ID=2Route Tag

IP Address

Mask

Next Hop =0 or Rtr on LAN

Metric

2

2

2

4

4

4

When there is auth

When router Represents other rtr

For external routesEtc.

Page 19: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

19

Differences Between RIP 1 and 2

• RIP 1 works with classful addresses.

• RIP 2 works with classless addresses and ads authentication

Page 20: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

20

OSPF: Nbr Discovery

• Routers send Hellos to their nbrs periodically. Nbrs learn about nbr appearance and dissappearances from hello messages.

• Hello messages specify hello interval and RouterDeadInterval.

• If a router does not receive hello message in one RouterDeadInterval, it regards the link as failed.

• New router learns from one of its nbrs the entire link state database, and acks every entry.

Page 21: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

21

OSPF: Info Exchange on LAN

• One router is designated to send link state updates to the routers on LAN, and another routers is backup designated router.

• Routers on LAN send their link state ads to the DR and BDR. DR send these messages to all routers on LAN as a part of link state update message.

• DR is the first one on LAN, BDR is the second one. If one of them fails it is replaced by the router with the highest priority.

Page 22: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

22

OSPF: Flooding LSAs

• LSAs are distributed through flooding– send to every nbr except from which LSA rcv’d

• LSA is updated only if it has a higher sequence number than the existing one, or if its age exceeded the maximum age.

• Rtr forwards only updated LSAs, and it generates new LSAs periodically or when there is a configuration change (link cost has changed, nbr is down).

Page 23: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

23

OSPF Hierarchy

• Runs on the top of IP with protocol field 89, and is applied to autonomous systems (AS).

• Comprises two levels of hierarchy: areas and backbone.

• Boarder routers of some domain calculate their costs to the routers of the area and flood this info to other boarder routers. They flood processed info learned from other boarder routers to their areas.

• Area boarder routers learn info about external routes from AS boarder routers, and flood this info to other boarder and internal routers.

Page 24: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

24

OSPF Header

OSPF ver (1) Pkt type (1)

OSPF Pkt Length

Source OSPF Rtr ID

OSPF Area ID

Packet checksum

Authentication type

Authetication data

2

4

4

2

2

8

Page 25: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

25

OSPF Pkt Types

1. Hellos2. Database description3. Link state request4. Link state update: Multiple LSAs5. Link state ack6. Links state advertisement (LSA)

– Type 1 LSA: link between routers, or LAN – Type 2 LSA: all routers on LAN, or MAN – Type 3 LSA: area border router send costs to prefixes of the area

to other border rtrs, they process these LSAs and send them to the area.

– Type 4 LSA: AS border routers are advertised to the area border routers and they further advertise them to their areas

– Type 5 LSA: an AS external link ad

Page 26: 1 Routing Protocols. 2 Distributed Routing Protocols Rtrs exchange control info Use it to calculate forwarding table Two basic types –distance vector

26

Address Aggregation

B C

A10.1.2.0/24

1

1

3

3

31 1

3 3

2 2

1 1

1

3

3

3

1

1

Area 0.0.0.2 Area 0.0.0.3

Area 0.0.0.1

Area 0.0.0.0 D10.1.1.0/24

10.1.3.0/24

10.2.1.0/24 10.2.2.0/24

10.8.2.0/24

10.3.7.0/24

Border rtr to outside of area, e.g.: A sends pair: net 10.1.1.0/20 cost 4B sends pair: net 10.2.1.0/16 cost 7