First, the preparation of knowledge
???????? The routing algorithm of link State Route is a global route-selection algorithm. In this algorithm, we assume that all network topologies and link charges are known (in practice, by having each node broadcast link-state groupings to all other nodes in the network), the "OSPF protocol" enables all nodes to have a complete view of the network equivalent through node broadcasts. After the view is obtained, the LS algorithm can calculate the minimum cost path from the source node to any node in the network.
.
???????? The link state routing algorithm we give below is called the Dijkstra algorithm, and before we know this algorithm, we first understand the following tokens:
D(v):表示从源节点到目标结点v的最低费用路径的费用p(x):从源结点到目标节点v(最低费用路径)的前一个结点(v的邻居)N‘:如果从源到v的最低费用路径已知,那么可以将v加入N‘集合中w:可被加入到N‘ 中结点,且节点的费用最小
.
Second, LS algorithm principle
???????? We visualize routing problems graphically, g= (n,e) is a graph (representing a network topology) with N nodes (representing routers) and E-bars (representing links). The number on each link represents the cost of this link, as shown in:
???????????????????????????????? Figure 1-1 Network topology and link cost diagram
.
???????? Assuming the source node is U, we want to find the lowest consumption path from the source node to the other node, the algorithm is as follows:
1. Initialize: n ' = {u} D (U) known, add U to n ' Collection For all nodes-N for all nodes except U N if n is a nei Ghbor of U if n node makes adjacent node of U node then D (n) = C (u,n) Then the N node's d (n) is C (u,n) Else D (n) =∞ otherwise d (n) is infinitely large 2, the cyclic phase of find W not in n ' such, D (W) is a minimum find out N ' W "minimum D (w)" Add W to n ' adds W to n ' upda Te d (n) for each neighbor N's W and not in n ' update d (n) of node n adjacent to the W node, and n cannot be in n ' d (n) = min (d (n), D (W) +c (w,n) ) Set D (n) to the minimum value in D (n) and D (W) +c (w,n) until n ' = n Until n ' = n is the end loop
.
???????????????????????????????????????????????????????????????? Table 1-1 Status link algorithm steps for network operation in Figure 1-1
???????? ※ Initialization phase: Find all neighbor nodes adjacent to U v,x,w, make d (v) =2,d (x) =1,d (w) = 5; the remaining y,z nodes that are not adjacent to U, their link cost D (y) =∞,d (z) =∞
???????? ※ First Cycle: We find the node X with the lowest cost at the end of the initialization phase, with a cost of 1, add node x to n ', update the D (n) value of the node that is adjacent to the X node and not in N ' is actually the V,w,y node, the formula is D (n) = min (d (n), D (x) +c (X,n)), D (v) =2,d (W) =4,d (y) =2
???????? ※ Second Cycle: We find the node V and y with the lowest cost at the end of the first cycle, we first add Y to n ' and update the value of the W,z node to get D (w) =3,d (z) =4
........
???????? Until all nodes are added to n ', the loop ends with a minimum cost path: C (u,v) =2,,c (u,w) =3,c (u,x) =1,c (u,y) =2,c (u,z) =4
.
???????? When the LS algorithm terminates, for each target node, we can find the previous node of the shortest cost path from the table. And for this previous node, there is the shortest path of the previous node. By analogy, we can get the full path of the source node to the lowest consumption path of any target node:
???????? (u,v): u-v
???????? (u,w): u-x-y-w
???????? (u,x): U-x
???????? (u,y): u-x-y
???????? (u,z): u-x-y-u
???????? Therefore, for U-node routing, the next hop node of the routing minimum cost path is stored to each destination node, and the U-node routing table is generated as follows:
.
Three, LS oscillation phenomenon
???????? Hypothesis: 1, the link cost is the amount of data that the link carries; 2, the initial route is B counter-clockwise send 1 units to a,d clockwise send 1 units to a,c counter-clockwise send e units to b,b again give a
???????? #注: The red arrow indicates that the B, C, D routers will have a continuous 1 units, E units, 1 units of data to be sent to router a
.
???????? So the initial state will be as shown in 3-1a):
???????????????????????????????? 3-1A) Initial state network cost status
.
???????? When the LS algorithm is run again, the B, C, D routes will be considered to be the lowest in the cost of the clockwise route, then the cost information as shown in 3-1B will be generated:
???????????????????????????????? 3-1B) The network cost status after the LS algorithm is executed again
.
???????? After recording the cost information shown in 3-1b), run the LS algorithm again, and the B, C, D routers will then be delivered to the counter-clockwise direction, as shown in the results 3-1c):
???????????????????????????????? 3-1C) network cost status after the execution of the LS algorithm for the third time
.
???????? After running the LS algorithm again, it turns clockwise, 3-1d) as shown:
???????????????????????????????? 3-1D) network cost status after the execution of the LS algorithm for the third time
.
???????? This phenomenon, known as congestion-sensitive routing shocks, is likely to result in the following phenomena:
???????? Suppose B-Route is now in Figure 3-1b) state, and the data is forwarded to C,C for forwarding to D, but at this point the routing table of D is updated, then the link state becomes 3-1c). D will forward the previous data to C,c and will be forwarded to B, if the routing table is updated again, then it will be shown as Figure 3-1d). As a result, datagrams will be forwarded back and forth between B, C and D and cannot reach a, and when the data is ttl=0, the datagram will be discarded
.
???????? In view of this phenomenon, the link state algorithm will take some mechanism: let each router send the link advertisement time randomization, to ensure that not all routers are running the LS algorithm at the same time (that is, each router executes the LS algorithm is actually different)
Link state routing algorithm for computer network (LS)