260 likes | 417 Vues
Routing Protocols. Distributed Routing Protocols. Rtrs exchange control info Use it to calculate forwarding table Two basic types distance vector ( DECnet, “ old ” ARPANET, RIP ) link state (“ n ew ” ARPANET 1980, DECnet Phase V 1985 , IS-IS 1988 , OSPF version 2 1998 ). cost 2. j. m.
E N D
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).
cost 2 j m cost 3 I am “4” cost 7 cost 2 k n Distance Vector Routing • Rtr knows • own ID • how many cables hanging off box • cost, for each cable, of getting to nbr
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.
Example of DV Routing cost 2 j m cost 3 I am “4” cost 7 cost 2 k n distance vector rcv’d from cable j cost 3 12 3 15 3 12 5 3 18 0 7 15 distance vector rcv’d from cable k cost 2 5 8 3 2 10 7 4 20 5 0 15 distance vector rcv’d from cable m cost 2 0 5 3 2 19 9 5 22 2 4 7 distance vector rcv’d from cable n cost 7 6 2 0 7 8 5 8 12 11 3 2 your own calculated distance vector 2 6 5 0 12 8 6 19 3 ? ? your own calculated forwarding table 0 k/m m j k j k/j n j ? ?
A B C 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.
R1 R2 D Split Horizon • This technique sometime prevents counting toward infinity. • If R1 forwards packetsto D through R2, then R1informs R2that 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.
R2 R3 R1 D Split Horizon • 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.
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
Building Link State Packets (a) A subnet. (b) The link state packets for this subnet.
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
6 2 A B C 5 2 2 1 G 2 4 D E F 1 A B C D E F G B/6 A/6 B/2 A/2 B/1 C/2 C/5 D/2 C/2 F/2 E/2 D/2 E/4 F/1 E/1 G/5 F/4 G/1 Example of Dijkstra Algorithm
C(0) C(0) C(0) B(2) G(5) B(2) G(5) B(2) G(5) F(2) F(2) F(2) E(6) G(3) C(0) C(0) C(0) B(2) B(2) B(2) F(2) A(8) E(3) F(2) A(8) E(3) F(2) E(6) G(3) E(6) G(3) G(3) Example of Dijkstra Algorithm
C(0) C(0) C(0) B(2) B(2) B(2) A(8) E(3) F(2) A(8) E(3) F(2) A(8) E(3) F(2) D(5) D(5) D(5) G(3) G(3) G(3) A(7) C(0) B(2) E(3) F(2) D(5) G(3) A(7) Example of Dijkstra Algorithm Forwarding table: A/B B/B C/self D/B E/B F/F G/F
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,
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).
RIP Version 1 Header 1 Command Request Or Response 1 Version Reserved 2 Address Family ID (=2 for IP) 2 Address 14 Metric 4
RIP Version 2 Header 1 Command Request Or Response 1 Version=2 Reserved 2 When there is auth Address Family=0xFFFF 2 2 Authentication Type 16 Authentication Info 2 Address Family ID=2 For external routes Etc. Route Tag 2 IP Address 4 4 Mask Next Hop =0 or Rtr on LAN 4 When router Represents other rtr Metric 4
Differences Between RIP 1 and 2 • RIP 1 works with classful addresses. • RIP 2 works with classless addresses and ads authentication
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.
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.
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).
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.
OSPF Header Pkt type (1) OSPF ver (1) 2 OSPF Pkt Length Source OSPF Rtr ID 4 4 OSPF Area ID 2 Packet checksum 2 Authentication type Authetication data 8
OSPF Pkt Types 1. Hellos 2. Database description 3. Link state request 4. Link state update: Multiple LSAs 5. Link state ack 6. 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
Address Aggregation Area 0.0.0.1 1 1 3 Area 0.0.0.3 Area 0.0.0.2 10.2.1.0/24 3 3 10.2.2.0/24 B C 1 1 1 1 3 3 2 10.1.2.0/24 2 10.3.7.0/24 A 3 Area 0.0.0.0 D 10.1.1.0/24 10.8.2.0/24 1 3 1 3 1 Border rtr to outside of area, e.g.: A sends pair: net 10.1.1.0/20 cost 4 B sends pair: net 10.2.1.0/16 cost 7 10.1.3.0/24