Download presentation
Presentation is loading. Please wait.
Published bySamantha Craig Modified over 9 years ago
1
1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts
2
2 Route a way or course taken in getting from a starting point to a destination send or direct along a specified course Routing find the path or course of forwarding according to information contained in packet (destination) Difference between network-layer and link-layer format of forwarding table way of updating the table
3
3 Link-layer Forwarding table mapping from destination physical address (MAC address) to port of forwarding Update of the table manually configured
4
4 IP (Network) Layer Forwarding table mapping from destination network id (NetNum) to next-hop (or interface) of forwarding Update the table manually configured (static route) dynamically learned from routing protocol
5
5 Forwarding vs. Routing Forwarding taking a packet looking at its destination address consulting a table sending the packet in a direction determined by that table locally done at a node Routing the process by which forwarding tables are built depends on a distributed algorithm
6
6 Forwarding Table vs. Routing Table Forwarding table used when a packet is being forwarded and so must contain enough information to accomplish the forwarding function a row in the forwarding table contains the mapping from a network number to an outgoing interface and some MAC information, such as the Ethernet address of the next hop
7
7 Routing table the table that is built up by the routing algorithms as a precursor to building the forwarding table it contains mappings from network numbers to next-hops (IP addresses)
8
8 Example, in the following tables the routing table tells us that network number 10 is to be reached by a next hop router with the IP address 171.69.245.10 the forwarding table contains the information about exactly how to forward a packet to that next hop send it out interface number 0 with a MAC address of 8:0:2b:e4:b:l:2 (the last piece of information is provided by the Address Resolution Protocol)
9
9 Network NumberNext Hop 10171.69.245.10 Network Number InterfaceMAC address 10if08:0:2b:e4:b:1:2 Example rows from (a) routing and (b) forwarding tables (a) (b)
10
10 4.2.1 Network as a Graph
11
11 Basic problem of routing find the lowest-cost path between any two nodes, where the cost of a path equals the sum of the costs of all the edges that make up the path
12
12 Solution routing is achieved in most practical networks by running routing protocols among the nodes these protocols provide a distributed, dynamic way to solve the problem of finding the lowest-cost path in the presence of node or link failure addition of new node or new link changes of link cost it is difficult to make centralized solutions scalable, so all the widely used routing protocols use distributed algorithms
13
13 4.2.2 Distance Vector (RIP) Distance-Vector Algorithm (Bellman-Ford Algorithm) each node constructs a one-dimensional array (a vector) containing the "distances" (costs) to all other nodes and distributes that vector to its immediate neighbors response when receiving an announcement from a neighbor for every entry in the announcement, store it if the announced distance is shorter than what in the table a better route is found otherwise discard it
14
14 assumption initially, each node knows the cost of the link to each of its directly connected neighbors broken links are assigned an infinite cost, ∞
15
15 Local data structure routing table destination cost to the destination corresponding next-hop
16
16 Distance Vector Algorithm In this example the cost of each link is set to 1 a least-cost path is simply the one with the fewest hops
17
17 Initial State B AC D E FG Destination Y Node X’s Routing Table: Cost / Next-Hop A’sB’sC’sD’sE’sF’sG’s A01/A ∞ ∞ B1/B0 ∞∞∞∞ C1/C 0 ∞∞∞ D∞∞1/D0∞∞ E1/E∞∞∞0∞∞ F1/F∞∞∞∞0 G∞∞∞1/G∞ 0
18
18 Destination Y Cost/ Next-Hop ABCDEFGABCDEFG 0/ 1/B 1/C 2/C 1/E 1/F 2/F A’s routing table B AC D E FG Distance Vector sent by A
19
19 After One Step B AC D E FG Destination Y Node X’s Routing Table: Cost / Next-Hop A’sB’sC’sD’sE’sF’sG’s A01/A 2/C1/A 2/F B1/B0 2/C2/A ∞ C1/C 0 2/A 2/D D2/C 1/D0∞2/G1/D E1/E2/A ∞0 ∞ F1/F2/A 2/G2/A01/F G2/F∞2/D1/G∞ 0
20
20 After Two Steps B AC D E FG Destination Y Node X’s Routing Table: Cost / Next-Hop A’sB’sC’sD’sE’sF’sG’s A01/A 2/C1/A 2/F B1/B0 2/C2/A 3/F C1/C 0 2/A 2/D D2/C 1/D03/A2/G1/D E1/E2/A 3/C02/A3/F F1/F2/A 2/G2/A01/F G2/F3/C2/D1/G3/A1/G0 convergence: no more changes when getting further announcement
21
21 Two different circumstances for a node to send a routing update to its neighbors periodic update each node automatically sends an update message every so often, even if nothing has changed triggered update happens whenever a node receives an update from one of its neighbors that causes it to change one of the routes in its routing table i.e., whenever a node's routing table changes, it sends an update to its neighbors, which may lead to a change in their tables, causing them to send an update to their neighbors
22
22 Link Failures Example 1 (stable) F detects that link to G has failed F sets distance to G to infinity and sends update to A [F : (G, ∞, G)] A sets distance to G to infinity since it uses F to reach G [A : (G, ∞, F)] ------------------------------------------------------------------------- A receives periodic update from C with 2-hop path to G A sets distance to G to 3 and sends update to F [A : (G, 3, C)] F decides it can reach G in 4 hops via A [F : (G, 4, A)] Pattern : (Dest, Cost, NextHop)
23
23 Example 2 (count to infinity) link from A to E fails A advertises distance of infinity to E [A : (E, ∞, E)] B and C advertise a distance of 2 to E [B : (E, 2, A)] , [C : (E, 2, A)] B hears that E can be reached in 2 hops from C B decides it can reach E in 3 hops; advertises this to A [B : (E, 3, C)] A decides it can reach E in 4 hops; advertises this to C [A : (E, 4, B)] C decides that it can reach E in 5 hops… [C : (E, 5, A)] ∞
24
24 Loop-breaking heuristics (partial solutions) set infinity to 16 split horizon split horizon with poison reverse
25
25 Solution-1 (set infinity to 16) use some relatively small number as an approximation of infinity, which at least bounds the amount of time that it takes to count to infinity example, set the maximum number of hops to get across a certain network is never going to be more than 16 (set 16 to be infinity value) drawback problem occurs if our network grew to a point where some nodes were separated by more than 16 hops
26
26 Solution-2 (split horizon) when a node sends a routing update to its neighbors, it does not send those routes it learned from each neighbor back to that neighbor example, if B has the route (E, 2, A) in its table, then it knows it must have learned this route from A, and so whenever B sends a routing update to A, it does not include the route (E, 2, A) in that update
27
27 Solution-3 (split horizon with poison reverse) (B actually sends that route back to A, but it puts negative information in the route to ensure that A will not eventually use B to get to E) Let B be a neighbor of A if in the routing table of B, the next hop entry for destination Z is A, B informs A that its distance to Z is infinite [B : (Z, cost, A) → A : (Z, ∞, B)]
28
28 Solution 2 & 3 only work for routing loops that involve two nodes example, for larger routing loops if B and C had waited for a while after hearing of the link failure from A before advertising routes to E they would have found that neither of them really had a route to E
29
29 Routing Information Protocol (RIP) One of the most widely used routing protocols in IP networks A DV (Distance Vector) routing protocol Rather than advertising the cost of reaching other routers, the routers advertise the cost of reaching networks example, in the following figure, router C would advertise to router A the fact that it can reach networks 2 and 3 at cost 0 [C : (Net2, 0, Net2) , C : (Net3, 0, Net3)] networks 5 and 6 at cost 1 [C : (Net5, 1, Net3) , C : (Net6, 1, Net3)] network 4 at cost 2 [C : (Net4, 2, Net3)]
30
30 Example network running RIP
31
31 RIP packet format the majority of the packets is taken up with (network-address, distance) pairs example if router A learns from router B that network X can be reached at a lower cost via B than via the existing next hop in the routing table A updates the cost and next hop information for the network number accordingly
32
32 RIP packet format
33
33 RIP a fairly straightforward implementation of distance- vector routing routers running RIP send their advertisements every 30 seconds a router also sends an update message whenever an update from another router causes it to change its routing table
34
34 metrics or costs for routing all link costs being equal to 1 always tries to find the minimum hop route valid distances are 1 through 15, with 16 representing infinity (this limits RIP to running on fairly small networks-those with no paths longer than 15 hops)
35
35 4.2.3 Link State (OSPF) Distance-Vector approach “tell neighbors where I can go, and how far” Link-State approach “tell all which neighbors I have”
36
36 Link-state routing the second major class of intradomain routing protocol assumptions each node is assumed to be capable of finding out the state of the link to its neighbors (up or down) and the cost of each link Intradomain An internetwork in which all the routers are under the same administrative control (e.g., a single university campus, or the network of a single Internet service provider)
37
37 basic idea every node knows how to reach its directly connected neighbors, and if we make sure that the totality of this knowledge is disseminated to every node, then every node will have enough knowledge of the network to build a complete map of the network link-state routing protocols rely on two mechanisms reliable dissemination of link-state information calculation of routes from the sum of all the accumulated link-state knowledge
38
38 Link-State Message Data Structure LSP (Link-State Packet) an update packet created by each node information for route calculation the ID of the node that created the LSP a list of directly connected neighbors of the node, with the cost of the link to each one
39
39 information for reliability a sequence number ensure having the most recent copy reset to zero when routing process restarted a time to live (TTL) for this packet Too old packets are discarded
40
40 Reliable Flooding Send local LSP out on all of its directly connected links Each node receiving the LSP forwards it out on all of its links stores each node’s recent LSP forwards LSP to neighbors except the sender itself
41
41 The following figure shows an LSP being flooded in a small network each node becomes shaded as it stores the new LSP (a) the LSP arrives at node X, which sends it to neighbors A and C (b) A and C do not send it back to X, but send it on to B (c) B receives two identical copies of the LSP, it will accept whichever arrived first and ignore the second as a duplicate (d) B passes the LSP onto D, who has no neighbors to flood it to, and the process is complete
42
42
43
43 New LSP Generation Two circumstances to generate new LSP expiry of a periodic timer change in topology directly connected links go down detected by link-layer protocols immediate neighbors go down detected by periodic “hello” message
44
44 Calculation of Route Dijkstra’s Shortest Path Algorithm Notations N: vertex set of the graph l: l(i, j) is the (non-negative) cost of the edge (i, j) s: current vertex M: set of ever calculated vertices C(n): cost of path from s to n
45
45 Calculate a minimum-cost tree from s 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))
46
46 In practice, each switch computes its routing table directly from the LSPs it has collected using a forward search approach for Dijkstris algorithm each switch maintains two lists, known as Tentative and Confirmed. each of these lists contains a set of entries of the form (Destination, Cost, NextHop)
47
47 Forward Search Approach for Dijkstra Algorithm 1. Initialize the Confirmed list with an entry for myself; this entry has a cost of 0. 2. For the node just added to the Confirmed list in the previous step, call it node Next, select its LSP. 3. For each neighbor (Neighbor) of Next, calculate the cost (Cost) to reach this Neighbor as the sum of the cost from myself to Next and from Next to Neighbor. (a) If Neighbor is currently not on either the Confirmed or the Tentative list, then add (Neighbor, Cost, NextHop) to the Tentative list, where NextHop is the direction I go to reach Next. (b) If Neighbor is currently on the Tentative list, and the Cost is less than the currently listed cost for Neighbor, then replace the current entry with (Neighbor, Cost, NextHop), where NextHop is the direction I go to reach Next. 4. If the Tentative list is empty, stop. Otherwise, pick the entry from the Tentative list with the lowest cost, move it to the Confirmed list, and return to step 2.
48
48 Example Link-state routing: an example network
49
(B, 11, B) → (C, 2, C) (B, 5, C) → (A, 12, C) (A, 10, C)
50
50 Open Shortest Path First Protocol (OSPF) OSPF one of the most widely used link-state routing protocols Open: refers to the fact that it is an open, nonproprietary standard, created under the auspices of the IETF SPF: comes from an alternative name for link-state routing
51
51 OSPF adds the following features to the basic link-state algorithm authentication of routing messages additional hierarchy OSPF introduces another layer of hierarchy into routing by allowing a domain to be partitioned into areas a router within a domain does not necessarily need to know how to reach every network within that domain, but know only how to get to the right area this reduces the amount of information that must be transmitted to and stored in each node
52
52 load balancing OSPF allows multiple routes to the same place to be assigned the same cost and will cause traffic to be distributed evenly over those routes
53
53 There are several different types of OSPF messages, but all begin with the same header OSPF header format Version: 2 Type: 1 through 5 SourceAddr: identifies the sender of the message AreaId: a 32-bit identifier of the area in which the node is located
54
Authentication type the entire packet, except the authentication data, is protected by a 16-bit checksum using the same algorithm as the IP header 0: no authentication is used 1: a simple password is used 2: a cryptographic authentication checksum is used 54
55
55 OSPF header format
56
56 Five OSPF message types Type 1: "hello" message, which a router sends to its peers to notify them that it is still alive and connected Type 2~5: used to request, send, and acknowledge the receipt of link-state messages Basic building block of link-state messages in OSPF is link- state advertisement (LSA) one message may contain many LSAs
57
57 OSPF packet format for link-state advertisement (Type 1)
58
58 OSPF link-state advertisement Type 1 LSAs: advertise the cost of links between routers Type 2 LSAs: advertise networks to which the advertising router is connected LS Age the equivalent of a time to live, except that it counts up and the LSA expires when the age reaches a defined maximum value Type tells us that this is a type 1 LSA
59
59 Link-state ID & Advertising router in a type 1 LSA, these two fields are identical each carries a 32-bit identifier for the router that created this LSA LS sequence number detect old or duplicate LSAs LS checksum verify that data has not been corrupted it covers all fields in the packet except LS Age
60
60 Length the length in bytes of the complete LSA Link ID, Link Data, & metric each link in the LSA is represented by a Link ID, some Link Data, and a metric TOS allow OSPF to choose different routes for IP packets based on the value in their TOS field
61
61 Metrics Original ARPANET metric measures number of packets queued on each link took neither latency nor bandwidth into consideration New ARPANET metric stamp each incoming packet with its arrival time ( AT ) record departure time ( DT ) when link-level ACK arrives, the node compute the packet delay Delay = (DT-AT) + Transmit + Latency if timeout (ACK did not arrive), DT is reset to the time the packet was retransmitted link cost = average delay over some time period
62
62 4.2.5 Routing for Mobile Hosts Mobility issues in IP Networks once a mobile terminal moves to a new subnet, a correspondent node needs to use the mobile’s new IP address it is difficult to force every possible correspondent node to keep track when a mobile terminal may change its IP address and what the mobile’s new address will be
63
63 Mobile IPv4
64
64
65
Home Network Home address a globally unique and routable IP address preconfigured or dynamically assigned Home network the network whose network address prefix matches that of the mobile terminal’s home address Home agent (HA) maintain up-to-date location information for the mobile intercept packets addressed to the mobile’s home address tunnel packets to the mobile’s current location
66
Foreign Network Care-of Address (CoA) assigned to the mobile by the foreign network a mobile uses its CoA to receive IP packets in the foreign network
67
Foreign agent (FA) provides CoAs and other necessary configuration information (e.g., address of default IP router) to visiting mobiles de-tunnels packets from the tunnel sent from a visiting mobile’s HA and then delivers the packets to the visiting mobile acts as the IP default router for packets sent by visiting mobile terminals
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.