Академический Документы
Профессиональный Документы
Культура Документы
Routing Protocols
The routers in an internet are responsible for receiving and forwarding IP datagrams through the interconnected set of sub-networks from source to destination. Routing protocols essential to operation of an internet. Router must have idea of topology and condition of internet. Routing protocols provide this information. Routing algorithm is used to make a routing decision for a particular datagram, based on current routing information. Decisions based on some least cost criterion.
Routing Table
One required for each router Entry for each network Not for each destination Routing only needs network portion
1
Once datagram reaches router attached to destination network, that router can deliver to host. Each entry shows next node on route Not whole route
A routing protocol is the implementation of a routing algorithm in software or hardware. A routing protocol uses metrics to determine which path to utilize to transmit a packet across an internetwork.
2
The metrics used by routing protocols include: Number of network layer devices along the path (hop count) Delay Load Cost
routing protocols automatically inform all routers about the change. If static routing is used, then the administrator has to update all changes into all routers and therefore no routing protocol is used.
Only dynamic routing uses routing protocols, which enable routers to : Dynamically discover and maintain routes Calculate routes Distribute routing updates to other routers Reach agreement with other routers about the network topology
Group of routers exchanging information via common routing protocol Set of routers and networks managed by single organization Connected Except in time of failure An interior router protocol (IRP) passes routing information between routers within an autonomous system. The protocol used within the autonomous system does not need to be implemented outside of the system.
At least one router in each AS must talk Use Exterior Routing Protocol (ERP) Examples of an IRP: Routing Information Protocol (RIP) Open Shortest Path First (OSPF) Protocol
Distance means how far and vector means in which direction. Distance Vector Routing calculate a best route to reach a destination. Distance Vector means that Routers are advertised as vector of Distance and Direction.
Basic Idea:
Each node periodically sends its own distance vector estimate to neighbors
9
When a node x receives new DV estimate from neighbor, it updates its own DV using B-F equation: Dx(y) min{c(x,v) + Dv(y)} for each node y N
Under minor, natural conditions, the estimate Dx(y) converge to the actual least cost dx(y)
Bellman-Ford Equation:
Define dx(y) := cost of least-cost path from x to y Then Dx(y) min{c(x,v) + Dv(y)} for each node y where min is taken over all neighbors v of x N
Bellman-Ford example
10
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3 du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 Node that achieves minimum is next hop in shortest path
DV EXAMPLE 1:
11
In this network we have 3 routers X, Y and Z: Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3 Node that achieves minimum is the next hop in the shortest path.
12
13
DV EXAMPLE 2
The current time (or iteration) in the algorithm with T, and shall begin (at time 0, or T=0) by creating distance matrices for each router to its immediate neighbors. The routing tables below, are build with the shortest path is highlighted with the color green, a new shortest path is highlighted with the color yellow.
14
At this point, all the routers (A,B,C,D) have new "shortest-paths" for their DV (the list of distances that are from them to another router via a neighbor). They each broadcast this new DV to all their neighbors: A to B and C, B to C and A, C to A, B, and D, and D to C. As each of these neighbors receives this information, they now recalculate the shortest path using it. For example: A receives a DV from C that tells A there is a path via C to D, with a distance (or cost) of 5. Since the current "shortestpath" to C is 23, then A knows it has a path to D that costs 23+5=28. As there are no other shorter paths that A knows about, it puts this as its current estimate for the shortest-path from itself (A) to D, via C.
15
At T =1
Again, all the routers have gained in the last iteration (at T=1) new "shortest-paths", so they all broadcast their DVs to their neighbors; This prompts each neighbor to re-calculate their shortest distances again. For instance: A receives a DV from B that tells A there is a path via B to D, with a distance (or cost) of 7. Since the current "shortestpath" to B is 3, then A knows it has a path to D that costs 7+3=10. This path to D of length 10 (via B) is shorter than the existing "shortest-path" to D of length 28 (via C), so it becomes the new "shortest-path" to D.
16
At T=2
This time, only routers A and D have new shortest-paths for their DVs. So they broadcast their new DVs to their neighbors: A broadcasts to B and C, and D broadcasts to C. This causes each of the neighbors receiving the new DVs to re-calculate their shortest paths. However, since the information from the DVs doesn't yield any shorter paths than they already have in their routing tables, then there are no changes to the routing tables. At T=3
17
None of the routers have any new shortest-paths to broadcast. Therefore, none of the routers receive any new information that might change their routing tables. So the algorithm comes to a stop. Distance vector routing protocols pass periodic copies of routing table to neighbor routers and accumulate distance vectors. In distance vector routing protocol, routers discover the best path to destination from each neighbor. The routing table updates proceed step by step from router to router.
Periodic Updates
Periodic updates means that at the end of a certain time period, updates will be transmitted.
18
Neighbors
In the context of routers, neighbors always means routers sharing a common data link. A distance vector routing protocol sends its updates to neighboring routers and depends on them to pass the update information along to their neighbors. For this reason, distance vector routing is said to use hop-by-hop updates.
Broadcast Updates
When a router first becomes active on a network, how does it find other routers and how does it announce its own presence? Several methods are available. The simplest is to send the updates to the broadcast address. Neighboring routers speaking the same routing protocol will hear the broadcasts and take appropriate action. Hosts and other devices uninterested in the routing updates will simply drop the packets.
A Link-state routing is a concept used in routing of packet-switched networks in computer communications. Link-state routing works by having the routers tell every router on the network about its closest neighbors. Each router does the following: Keeps track of its neighbors: the neighbors name, and the cost of the link to the neighbor. Construct an LSA (Link state Advertisement) packet that lists its neighbors router names and link costs. This includes new neighbors, changes in link costs and links to neighbors that have gone down. Sends out LSA packet so that all routers receive it. Records each LSA packet it receives in its database immediately, to ensure that it has the most recently generated LSA packet from every other router. Using accumulated LSA packet data to construct a complete map of internetwork topology.
20
Can calculate shortest path to each destination network Router use routing algorithm to determine shortest paths In practice, Dijkstra's algorithm Open shortest path first (OSPF) protocol uses link-state routing.
Dijkstra's Algorithm : Find shortest paths from given source node to all other nodes, by developing paths in order of increasing path length Proceeds in stages Let
N s M = set of nodes in the network = source node = set of nodes so far incorporated
dii = 0 dij = if nodes are not directly connected dij 0 if nodes directly connected Dn= cost of least-cost path s to n currently known At termination, cost of least-cost path in graph from s to n The algorithm has three steps; steps 2 and 3 are repeated until M = N. That is, steps 2and 3 are repeated until final paths have been assigned to all nodes in the network: 1. Initialization M = {s} i.e. set of nodes so far incorporated consists of only source node Dn = dsn for n s i.e. initial path costs to neighboring nodes are link costs 2. Get Next Node Find neighboring node not in M with least-cost path from s
22
Incorporate node into M Incorporate that node in M that contributes to the path. This can be expressed as: Find wM such that Add w to M; 3. Update Least-Cost Paths
Dn = min[Dn, Dw + dwn] for all n M If the latter term is the minimum, the path from s to n is now the path from s to w concatenated with the link from w to n. The algorithm terminates when all nodes have been added to M.
23
Figure. Packet-switched Network Table below shows the result of applying this algorithm to the above Figure using s = 1. Note that at each step, the path to each node plus the total cost of that path is generated. After the final iteration, the least-cost path to each node and the cost of that path have been developed. The same procedure can be used with node 2 as source node, and so on.
24
Table
25
Bellman-Ford Algorithm:
Find shortest paths from source node such that paths contain at most one link Find shortest paths such that paths have at most two links
26
= source node
w(i, j) = link cost from node i to node j w(i, i) = 0 w(i, j) = if nodes are not directly connected w(i, j) 0 if nodes directly connected h = maximum number of links in path at current stage
Lh(n) =cost of least-cost path from s to n such that no more than h links
The algorithm has the following steps, step 2 of which is repeated until none of the costs change:
1. Initialization
L0(n) = , for all n s Lh(s) = 0, for all h 2. Update For each successive h 0: For each n s, compute
27
Connect n with predecessor node j that achieves minimum Eliminate any connection of n with different predecessor node formed during an earlier iteration. Path from s to n terminates with link from j to n Table b shows the result of applying this algorithm to Figure, using s = 1. At each step, the least-cost paths with a maximum number of links equal to h are found. After the final iteration, the least-cost path to each node, and the cost of that path, have been developed. The same procedure can be used with node 2 as source node, and so on. Note that the results agree with those obtained using Dijkstra's algorithm. Figure illustrate the results of Table . Table b Bellman-Ford Algorithm (s=1)
28
29
Stub, if it is not transit Edges graph edges that connect two router vertices when the corresponding routers are connected to each other by a direct point-to-point link. graph edges that connect a router vertex to a network vertex when the router is directly connected to the network.
Fig. An Autonomous system Figure below shows the directed graph of an above autonomous system.
32
Two routers joined by a point-to-point link are represented in the graph as being directly connected by a pair of edges, one in each direction (e.g., routers 6 and 10). When multiple routers are attached to a network, the directed graph shows all routers bi-directionally connected to the network vertex (e.g., routers 1,2,3, and 4 all connect to network 3). If a single router is attached to a network, the network will appear in the graph as a stub connection (e.g., network 7). An end system, called a host, can be directly connected to a router; such a case is depicted in the corresponding graph (e.g., host 1). If a router is connected to other autonomous systems, then the path cost to each network in the other system must be obtained by some exterior routing protocol (ERP). Each such network is
34
represented on the graph by a stub and an edge to the router with the known path cost (e.g., networks 12 through 15). A cost is associated with the output side of each router interface. This cost is configurable by the system administrator. Arcs on the graph are labeled with the cost of the corresponding router-output interface. Arcs having no labeled cost have a cost of 0. Note that arcs leading from networks to routers always have a cost of 0. A database corresponding to the directed graph is maintained by each router. It is pieced together from link-state messages from other routers in the internet. Using Dijkstra's algorithm a router calculates the least-cost path to all destination networks. The result for router 6 of Figure (Directed graph) is shown as a tree in Figure below, with R6 as the root of the tree. The tree gives the entire route to any destination network or host. However, only the next hop to the destination is used in the forwarding process. The resulting routing table for router 6 is shown in Table. The table includes
35
entries for routers advertising external routes (routers 5 and 7). For external networks whose identity is known, entries are also provided.
36
37
38
Version number: 2 is current Type: one of 5 Packet length: in octets including header Router id: This field contains the 4-byte IP address. The router (source) ID is used to uni-quely identify the router throughout the autonomous system. Area id: Area to which source router belongs. This is also a 4byte number.
39
Checksum This field includes the checksum for the entire OSPF packet, excluding the authentication for data
corruption. Authentication type: This field contains the code for the authentication.
40
to retrieve that precise piece of database information that is missing. Link state update Responds to a link-state request packet. Link state acknowledgement Acknowledges link-state update packets
Routing Updates
41
RIP sends routing-update messages at regular intervals and when the network topology changes. After updating its routing table, the router immediately begins transmitting routing updates to inform other network routers of the change.
42
being propagated. In addition, the RIP hop-count limit prevents routing loops from continuing indefinitely.
RIP Timers
RIP uses numerous timers to regulate its performance. These include a routing-update timer, a route timeout, and a route-flush timer. The routing-update timer clocks the interval between periodic routing updates. Generally, it is set to 30 seconds. Each routingtable entry has a route-timeout timer associated with it. When the route-timeout timer expires, the route is marked invalid but is retained in the table until the route-flush timer expires.
43
Fig. RIP Packet A = Command (Request or Response) B = Version Number C = Zero D = Address Family Identifier E = Address F = Metric CommandIndicates whether the packet is a request or a response. The request asks that a router send all or part of its routing table. The response can be an unsolicited regular routing update or a reply to a request. Responses contain routing table entries. Version NumberSpecifies the RIP version used. ZeroNot used.
44
Address-Family Identifier (AFI)Specifies the address family used. RIP is designed to carry routing information for several different protocols. The AFI for IP is 2. AddressSpecifies the IP address for the router. MetricIndicates how many internetwork hops (routers) have been traversed in the trip to the destination. This value is between 1 and 15 for a valid route, or 16 for an unreachable route.
BGP Messages Open Start neighbour relationship with another router Update
45
Transmit information about single route List multiple routes to be withdrawn Keep-alive Acknowledge open message Periodically confirm neighbour relationship Notification Send when error condition detected
It has three functional procedures Neighbour acquisition Neighbour reach-ability Network reach-ability
Neighbor acquisition
routers are considered to be neighbors if they are attached to the same sub-network
46
If in different ASs routers may wish to exchange information Neighbour acquisition is when two neighbouring routers agree to exchange routing information regularly One router sends request (Open Message), the other acknowledges (Keep-alive Message)
Neighbor reach-ability
Once a neighbor relationship is established, the neighbour reach-ability procedure is used to maintain the relationship. Periodic issue of keep-alive messages. Between all routers that are neighbours.
Network reachability
Each router keeps database of sub-networks it can reach and preferred route.
47
When change made, router issues update message that is broadcast to all other routers implementing BGP. All BGP routers build up and maintain routing information.
Figure below illustrates the formats of all of the BGP messages. Each message begins with a 19-octet header containing three fields : Marker : Reserved for authentication. The sender may insert a value in this field that would be used as part of an authentication mechanism to enable the recipient to verify the identity of the sender. Length : Length of message in octets. Type: Type of message: Open, Update, Notification, Keepalive.
48
49
Open Message Format Sends open message Identifies senders AS and gives IP address Includes Hold Time As proposed by sender If recipient prepared to open neighbour relationship Calculate hold time Reply with keep-alive Keep-alive Message Format Header only Update Message Format Information about single route through internet Information to be added to database of any recipient router Network layer reach-ability information (NLRI)
50
List of network portions of IP addresses of subnets reached by this route Total path attributes length field Path attributes field List of previously advertised routes being withdrawn May contain both Notification Message Format Error notification Message header error Includes authentication and syntax errors Open message error Syntax errors and option not recognised Proposed hold time unacceptable Update message error Syntax and validity errors Hold time expired
51
Close connection in absence of any other error Finite state machine error Includes any procedural error. Cease Used by a router to close a connection with another router in the absence of any other error.
52