CN101515899B - Route generation method and device - Google Patents
Route generation method and device Download PDFInfo
- Publication number
- CN101515899B CN101515899B CN2009101326712A CN200910132671A CN101515899B CN 101515899 B CN101515899 B CN 101515899B CN 2009101326712 A CN2009101326712 A CN 2009101326712A CN 200910132671 A CN200910132671 A CN 200910132671A CN 101515899 B CN101515899 B CN 101515899B
- Authority
- CN
- China
- Prior art keywords
- node
- optimal
- address
- destination network
- routing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明实施例提供一种路由生成方法和装置,本发明实施例提供一种路由生成方法,包括:接收邻居节点发送的更新报文;比较当前节点同所述邻居节点的最优路由信息,更新当前节点的最优路由信息;依据各节点的路由表项中到同一目的网络的IP地址的最优距离确定各节点的上下游关系;依据各节点的上下游关系,获得至少一个到达同一目的网络的IP地址的下一跳路由信息。
The embodiment of the present invention provides a route generation method and device. The embodiment of the present invention provides a route generation method, comprising: receiving an update message sent by a neighbor node; comparing the optimal route information of the current node with the neighbor node, and updating the optimal route information of the current node; determining the upstream and downstream relationship of each node according to the optimal distance to the IP address of the same destination network in the routing table items of each node; and obtaining at least one next-hop route information of the IP address reaching the same destination network according to the upstream and downstream relationship of each node.
Description
技术领域 technical field
本发明涉及网络技术领域,更具体地说,涉及一种路由生成方法和装置。The present invention relates to the field of network technology, and more specifically, to a route generation method and device.
背景技术 Background technique
随着科技的发展,互联网越来越普及,而将各种网络连接起来主要依靠路由器,路由器是互联网络的枢纽,路由器通过路由决定数据的转发。所谓路由就是指通过相互连接的网络把信息从源地点移动到目标地点的活动。一般来说,在路由过程中,信息至少会经过一个或多个中间节点。作为不同网络之间互相连接的枢纽,路由器系统构成了基于TCP/IP的国际互连网络Internet的主体脉络,也可以说,路由器构成了Internet的骨架。它的处理速度是网络通信的主要瓶颈之一,它的可靠性则直接影响着网络互连的质量。因此,在园区网、地区网、乃至整个Internet研究领域中,路由器技术始终处于核心地位,其发展历程和方向,成为整个Internet研究的一个缩影。With the development of science and technology, the Internet is becoming more and more popular, and the connection of various networks mainly depends on routers. Routers are the hub of the Internet, and routers determine data forwarding through routing. Routing is the activity of moving information from a source location to a destination location through an interconnected network. Generally speaking, in the routing process, information will pass through at least one or more intermediate nodes. As the hub of interconnection between different networks, the router system constitutes the main context of the TCP/IP-based international interconnection network Internet. It can also be said that the router constitutes the skeleton of the Internet. Its processing speed is one of the main bottlenecks of network communication, and its reliability directly affects the quality of network interconnection. Therefore, in the field of campus network, regional network, and even the entire Internet research, router technology has always been at the core, and its development history and direction have become a microcosm of the entire Internet research.
现有较为成熟的路由协议中,无论是基于距离矢量算法的RIP(RoutingInformation Protocol,路由信息协议)协议,或是基于链路状态的OSPF(OpenShortest Path First,开放式最短路径优先)协议,均属于单下一跳路由协议。采用单下一跳路由协议的方法进行数据传输的过程中,虽然可以发现并建立分组转发的最佳路径,但在发生链路故障时,无法将传输的数据切换到其它路由进行传输,导致数据传输过程中丢包率比较高。Among the existing relatively mature routing protocols, whether it is the RIP (Routing Information Protocol, Routing Information Protocol) protocol based on the distance vector algorithm, or the OSPF (OpenShortest Path First, open shortest path first) protocol based on the link state, all belong to the Single next hop routing protocol. In the process of data transmission using the single-next-hop routing protocol method, although the best path for packet forwarding can be found and established, when a link failure occurs, the transmitted data cannot be switched to other routes for transmission, resulting in data The packet loss rate is relatively high during transmission.
发明内容 Contents of the invention
本发明的实施例提供一种路由生成方法和装置,以解决现有技术中单下一跳路由在发生链路故障时,无法将传输的数据切换到其它路由进行传输,导致数据传输过程中丢包率比较高的问题。Embodiments of the present invention provide a method and device for generating a route to solve the problem that in the prior art, when a link failure occurs in a single-next-hop route, the transmitted data cannot be switched to other routes for transmission, resulting in data loss during data transmission. The problem of relatively high packet rate.
本发明实施例提供一种路由生成方法,包括:An embodiment of the present invention provides a method for generating a route, including:
接收邻居节点发送的更新报文;Receive update messages sent by neighbor nodes;
比较当前节点同所述邻居节点的最优路由信息,更新当前节点的最优路由信息;Comparing the optimal routing information of the current node with the neighbor node, updating the optimal routing information of the current node;
依据各节点的路由表项中到同一目的网络的IP地址的最优距离确定各节点的上下游关系;Determine the upstream and downstream relationship of each node according to the optimal distance to the IP address of the same destination network in the routing table entry of each node;
依据各节点的上下游关系,获得至少一个到达同一目的网络的IP地址的下一跳路由信息;Obtain at least one next-hop routing information to the IP address of the same destination network according to the upstream and downstream relationship of each node;
所述更新当前节点的最优路由信息包括:The updating of the optimal routing information of the current node includes:
如果当前节点到目的网络的IP地址的路由信息不是最优路由信息时,则将同邻居节点比较得到的最优路由信息写入当前节点路由表项;If the routing information from the current node to the IP address of the destination network is not the optimal routing information, then write the optimal routing information obtained by comparing with the neighbor node into the current node routing table entry;
将当前节点路由表项写入更新报文中发送给邻居节点。Write the current node routing table entry into the update message and send it to the neighbor nodes.
进一步的,在得到各节点的上下游关系之后还包括:Further, after obtaining the upstream and downstream relationships of each node, it also includes:
构建邻居节点中上游节点到下游节点的有向边;Construct directed edges from upstream nodes to downstream nodes among neighbor nodes;
将多条邻居间的有向边级连,构成以目的网络的IP地址为终点的路由有向图。The directed edges between multiple neighbors are cascaded to form a directed routing graph with the destination network IP address as the end point.
进一步的,如果当前节点接收的更新报文中包含当前节点路由表项中没有的路由表项时,则当前节点将其没有的路由表项写入到当前节点路由表项中。Further, if the update message received by the current node contains a routing table entry that does not exist in the routing table entry of the current node, the current node writes the routing table entry that it does not have into the routing table entry of the current node.
进一步的,确定各节点的上下游关系包括:Further, determining the upstream and downstream relationship of each node includes:
比较各节点的路由表项中到同一目的网络的IP地址的最优距离,最优距离大的为上游节点,最优距离小的为下游节点;Comparing the optimal distance to the IP address of the same destination network in the routing table entries of each node, the upstream node with the largest optimal distance, and the downstream node with the smallest optimal distance;
如果不同节点的路由表项中到同一目的网络地址的最优距离相同,则比较节点的路由器ID,路由器ID大的节点为上游节点,路由器ID小的节点为下游节点。If the optimal distances to the same destination network address in the routing table entries of different nodes are the same, compare the router IDs of the nodes, the node with the larger router ID is the upstream node, and the node with the smaller router ID is the downstream node.
进一步的,路由器ID为当前节点的接口中最小的IP地址。Further, the router ID is the smallest IP address among the interfaces of the current node.
进一步的,确定各节点的上下游关系还包括:当所述当前节点接收到其没有的路由表项时,则将发送所述路由表项的邻居节点设为当前节点的下游节点,并当所述邻居节点优于原先的下游节点时,则用该邻居节点代替原先的下游节点。Further, determining the upstream and downstream relationship of each node also includes: when the current node receives a routing entry that it does not have, setting the neighbor node that sent the routing entry as the downstream node of the current node, and when the When the above neighbor node is better than the original downstream node, the neighbor node is used to replace the original downstream node.
进一步的,更新报文的内容包括:各个目的网络的IP地址、子网掩码、下一跳路由、到各个目的网络的距离和路由器ID。Further, the content of the update message includes: the IP address of each destination network, the subnet mask, the next-hop route, the distance to each destination network, and the router ID.
进一步的,更新报文的内容写入RIP协议报文的6号标识中,并在路由信息部分增加用于存储路由器ID的值的字段。Further, the content of the update message is written into the No. 6 identifier of the RIP protocol message, and a field for storing the value of the router ID is added in the routing information part.
本发明实施例还提供了一种路由生成装置,包括:The embodiment of the present invention also provides a route generation device, including:
接收单元,用于接收邻居节点发送的更新报文;a receiving unit, configured to receive an update message sent by a neighbor node;
比较更新单元,用于比较当前节点同所述邻居节点的最优路由信息,更新当前节点的最优路由信息,所述更新当前节点的最优路由信息包括:如果当前节点到目的网络的IP地址的路由信息不是最优路由信息时,则将同邻居节点比较得到的最优路由信息写入当前节点路由表项;将当前节点路由表项写入更新报文中发送给邻居节点;A comparing and updating unit, configured to compare the optimal routing information of the current node with the neighbor node, and update the optimal routing information of the current node, wherein the updating of the optimal routing information of the current node includes: if the current node reaches the IP address of the destination network When the routing information is not the optimal routing information, the optimal routing information compared with the neighbor node is written into the current node routing table item; the current node routing table item is written into the update message and sent to the neighbor node;
识别确定单元,用于依据各节点的路由表项中到同一目的网络的IP地址的最优距离确定各节点的上下游关系;An identification and determination unit is used to determine the upstream and downstream relationship of each node according to the optimal distance to the IP address of the same destination network in the routing table entry of each node;
获取单元,用于依据各节点的上下游关系,获得多个到达同一目的网络的IP地址的下一跳路由信息。The obtaining unit is used to obtain the next-hop routing information of a plurality of IP addresses reaching the same destination network according to the upstream-downstream relationship of each node.
进一步的,所述装置实施例还包括:Further, the device embodiment also includes:
构边单元,用于构建邻居节点中上游节点到下游节点的有向边;An edge building unit is used to construct directed edges from upstream nodes to downstream nodes among neighbor nodes;
构图单元,用于将多条邻居间的有向边级连,构成以目的网络的IP地址为终点的路由有向图。The graph composition unit is used to cascade the directed edges between multiple neighbors to form a route directed graph with the IP address of the destination network as the end point.
与现有技术相比,本发明的实施例中提供至少一个或者多个可用的下一跳路由,在发生链路故障时可以将传输数据迅速切换到其它的路由,显著降低了数据传输中的丢包率。Compared with the prior art, at least one or more available next-hop routes are provided in the embodiments of the present invention, and the transmission data can be quickly switched to other routes in the event of a link failure, which significantly reduces the traffic in data transmission. Packet loss rate.
在发明的实施例中基于比较最优距离和路由器ID的机制得到的路由有向图可以保证进行数据并行传输时不会出现环路,解决了单下一跳路由导致的瓶颈链路拥塞的问题。In the embodiment of the invention, the routing directed graph obtained based on the mechanism of comparing the optimal distance and the router ID can ensure that there will be no loops during parallel data transmission, and solve the problem of bottleneck link congestion caused by single-next-hop routing .
本发明的实施例中获取至少一个下一跳路由可以在基于传统的RIP协议更新报文基础上进行简单改进即可实现,简单易行。In the embodiment of the present invention, obtaining at least one next-hop route can be realized by simple improvement based on the traditional RIP protocol update message, which is simple and easy.
附图说明 Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1为本发明方法实施例一的流程图;Fig. 1 is the flowchart of the method embodiment 1 of the present invention;
图2为本发明实施例一中确定各节点上下游关系的步骤流程图;2 is a flow chart of steps for determining the upstream and downstream relationships of each node in Embodiment 1 of the present invention;
图3为本发明方法实施例二中确定各节点上下游关系的步骤流程图;Fig. 3 is a flow chart of steps for determining the upstream and downstream relationships of each node in Embodiment 2 of the method of the present invention;
图4为本发明方法实施例三中构建的以目的网络的IP地址为终点的路由有向图;Fig. 4 is the routing directed graph with the IP address of the destination network as the end point constructed in the third embodiment of the method of the present invention;
图5为本发明装置实施例四中一种路由生成装置的结构示意图。FIG. 5 is a schematic structural diagram of a route generation device in Embodiment 4 of the device of the present invention.
具体实施方式 Detailed ways
本发明实施例提供了一种路由生成方法和装置。The embodiment of the present invention provides a route generation method and device.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
在本发明方法实施例一中,参见图1,路由生成方法可以包括:In Embodiment 1 of the method of the present invention, referring to FIG. 1, the route generation method may include:
步骤101,接收邻居节点发送的更新报文;
在实施步骤101时,更新报文的内容可以包括:各个目的网络的IP地址、子网掩码、下一跳路由、到各个目的网络的距离以及路由器ID;所述路由器ID可以为当前节点的接口中最小的IP地址。When implementing
步骤102,比较当前节点同所述邻居节点的最优路由信息,更新当前节点的最优路由信息;
在实施步骤102时,更新当前节点的最优路由信息可以包括:When implementing
如果当前节点到目的网络的IP地址的路由信息不是最优路由信息时,则将同邻居节点比较得到的最优路由信息写入当前节点路由表项;将当前节点路由表项写入更新报文中发送给邻居节点。当前节点可以以每隔30秒或60秒的间隔将写入了当前节点路由表项的更新报文发给邻居节点,发送时间的设置可以根据实际情况来设,设置的时间越短,路由表更新的速度就越快,反之越慢,一般情况下为了减少网络中用于建立路由表的路由更新报文占用网络的带宽资源设置定时更新的时间为30s,这是参考了RIP协议已有30s的发送间隔,当然也可以是其它的时间。If the routing information from the current node to the IP address of the destination network is not the optimal routing information, then write the optimal routing information compared with the neighbor node into the current node routing table item; write the current node routing table item into the update message sent to neighbor nodes. The current node can send the update message written in the routing table entry of the current node to the neighbor node at an interval of 30 seconds or 60 seconds. The sending time can be set according to the actual situation. The faster the update speed is, the slower it is vice versa. In general, in order to reduce the network bandwidth resources occupied by the routing update packets used to establish the routing table in the network, the timing update time is set to 30s, which refers to the RIP protocol has been 30s Of course, it can also be other time.
在进行更新最优路由信息过程中,如果当前节点接收的更新报文中包含当前节点路由表项中没有的路由表项时,则当前节点将其没有的路由表项写入到当前节点路由表项中。In the process of updating the optimal routing information, if the update message received by the current node contains routing table items that are not in the routing table items of the current node, the current node will write the routing table items that it does not have into the routing table of the current node item.
当前节点的路由表项的内容,可以包括:目的网络的IP地址,目的网络的子网掩码,下一跳IP地址,到目的网络的距离。将包含上述内容的当前节点的路由表项的内容写入到更新报文中,所述的更新报文可以采用RIP协议报文,在该报文的头部的命令字段中启用6号标识,并在更新报文内容中增加32比特的路由器ID字段。在具体实施时,需要注意的,当路由器接入网络时,将与路由器接口直接连接的主机或局域网作为可以到达的目的地加入当前节点的路由表项中,当前节点到所述的主机或局域网的距离可以设为0。The content of the routing entry of the current node may include: the IP address of the destination network, the subnet mask of the destination network, the next-hop IP address, and the distance to the destination network. Write the content of the routing table entry of the current node containing the above content into the update message, the update message can use the RIP protocol message, and enable the No. 6 mark in the command field of the header of the message, And a 32-bit router ID field is added to the content of the update message. In the specific implementation, it should be noted that when the router is connected to the network, the host or LAN directly connected to the router interface will be added to the routing table entry of the current node as the reachable destination, and the current node will go to the host or LAN. The distance can be set to 0.
步骤103,依据各节点的路由表项中到同一目的网络的IP地址的最优距离确定各节点的上下游关系;
在实施步骤103时,参见图2,确定各节点的上下游关系可以包括:When implementing
步骤201,比较各节点的路由表项中到同一目的网络的IP地址的最优距离,最优距离大的为上游节点,最优距离小的为下游节点;Step 201, comparing the optimal distances to the IP addresses of the same destination network in the routing table entries of each node, the one with the larger optimal distance is the upstream node, and the one with the smaller optimal distance is the downstream node;
步骤202,如果不同节点的路由表项中到同一目的网络地址的最优距离相同,则比较节点的路由器ID,路由器ID大的节点为上游节点,路由器ID小的节点为下游节点。Step 202, if the optimal distances to the same destination network address in the routing table entries of different nodes are the same, compare the router IDs of the nodes, the node with the larger router ID is the upstream node, and the node with the smaller router ID is the downstream node.
在实施步骤202时,所述路由器ID可以为当前节点的接口中最小的IP地址;所述路由器ID也可以为当前节点的接口中最大的IP地址,或者所述路由器ID也可以为当前节点中任意的IP地址;总之,在设置所述路由器ID的时候要保证在整个路由生成的过程中路由器ID的值不会发生变化。When implementing step 202, the router ID can be the smallest IP address in the interface of the current node; the router ID can also be the largest IP address in the interface of the current node, or the router ID can also be the IP address in the interface of the current node Any IP address; in short, when setting the router ID, ensure that the value of the router ID does not change during the entire route generation process.
步骤104,依据各节点的上下游关系,获得至少一个到达同一目的网络的IP地址的下一跳路由信息。
在实施步骤104时,依据各节点的上下游关系,可以获得到达同一目的网络的IP地址的多个路由信息,包括较好的路由和较差的路由信息,也包括下一跳不同,出口也不同的路由信息,这些路由信息都可以保存,并在实际应用中根据情况用于转发数据。虽然最优的路由信息可能由于在获得更优的路由信息后更新,但是只要传输数据的出口与新的最优路由的出口不相同,便需要作为次优的给予保留,这样在遇到最优路由线路拥塞的时候,可以及时的将数据传输切换到其它的路由线路中。When implementing
上面的实施例一中,在步骤103介绍了确定节点上下游关系的方法,在确定各节点上下游关系时,还可以在节点的路由表项中增加势能差值,通过增加的势能差值来标示下一跳节点与当前节点的上下游关系。势能差值可以作为在数据转发的时候参数,即势能差为正值时的路由表项为下游节点,可以用于数据的转发;势能差为负的指示的是下游节点,不能用于数据的转发。In the first embodiment above, the method for determining the upstream and downstream relationship of nodes is introduced in
在传输数据时,可以规定数据只从上游节点向下游节点传输,一个上游节点可以向多个下游节点并行传输数据,还可以根据当前节点路由表项中的到目的网络的距离和势能差值的大小来区分各个输入接口的优先级和数据流量分配比例。例如:两个节点A和B,节点A的路由表项中到目的网络的距离值较节点B的大,那么节点A在数据传输时优先级较低;如果节点A和节点B的路由表项中到目的网络的距离值相等,则节点A和节点B在数据传输时优先级相同;当然如果节点A和节点B的路由表项中到目的网络的距离值相等,也可以进一步的比较节点A和节点B的势能差值,势能差值较小的节点优先级较高,势能差值较大的节点优先级较低。对数据传输时流量的分配比可以采用:将节点路由表项中到目的网络的距离值简单取相反数,然后求这些相反数的比值即为各个节点的数据流量的分配比。When transmitting data, it can be stipulated that the data is only transmitted from the upstream node to the downstream node. An upstream node can transmit data to multiple downstream nodes in parallel. It can also be based on the distance to the destination network and the potential energy difference in the current node routing entry The size is used to distinguish the priority of each input interface and the distribution ratio of data traffic. For example: two nodes A and B, the distance value to the destination network in the routing table entry of node A is larger than that of node B, then node A has a lower priority in data transmission; if the routing table entry of node A and node B If the distances to the destination network are equal, node A and node B have the same priority in data transmission; of course, if the distances to the destination network in the routing table entries of node A and node B are equal, node A can also be further compared The potential energy difference with node B, the node with a smaller potential energy difference has a higher priority, and the node with a larger potential energy difference has a lower priority. The distribution ratio of traffic during data transmission can be adopted: the distance value from the node routing table entry to the destination network is simply taken as the opposite number, and then the ratio of these opposite numbers is calculated to be the distribution ratio of the data flow of each node.
在确定各节点的上下游关系过程中,当所述当前节点接收到其没有的路由表项时,则将发送所述路由表项的邻居节点设为当前节点的下游节点,并当所述邻居节点优于原先的下游节点时,则用该邻居节点代替原先的下游节点。这里描述的邻居节点优于原先的下游节点可以是指:以该邻居作为下一跳时,当前节点到目的地的距离小于原先的下游节点作为下一跳选择时当前节点到目的网络的距离。这个距离的计算方法可以是:从接收的路由表项中提取距离信息后加上与对应的邻居相连的链路代价的结果,具体的计算方法可以参见下面实施例二。In the process of determining the upstream and downstream relationship of each node, when the current node receives a routing entry that it does not have, the neighbor node that sends the routing entry is set as the downstream node of the current node, and when the neighbor When a node is better than the original downstream node, the neighbor node is used to replace the original downstream node. The neighbor node described here is better than the original downstream node may mean: when the neighbor is used as the next hop, the distance from the current node to the destination is smaller than the distance from the current node to the destination network when the original downstream node is selected as the next hop. The calculation method of this distance may be: the result of extracting the distance information from the received routing entry and adding the link cost connected to the corresponding neighbor. For the specific calculation method, please refer to the second embodiment below.
下面本发明方法实施例二中同前述实施例一不同的是介绍了另一种确定各节点的上下游关系的方法,参见图3可以包括:The difference between the second embodiment of the method of the present invention and the first embodiment is that it introduces another method for determining the upstream and downstream relationship of each node. Referring to FIG. 3, it may include:
步骤301,预设当前节点为i,邻居节点为k,目的网络为j,接收邻居节点k发送的更新报文,获取节点i与节点k之间的链路代价,所述链路代价设为获取节点k经过节点i到目的网络j的代价信息,所述代价信息设为
步骤302,依据更新报文中包含的目的网络j的信息,查找节点i的路由表项中是否包含到目的网络j的路由信息,如果是,则转入步骤304,否则转入步骤303;Step 302, according to the information of the destination network j contained in the update message, check whether the routing table entry of node i contains the routing information to the destination network j, if yes, then go to step 304, otherwise go to step 303;
步骤303,将所述代价信息同所述链路代价之和作为节点i到目的网络j的距离写入到节点i的路由表项中,将所述链路代价取正值后作为节点i的势能差值写入节点i的路由表项中,设置下一跳IP地址为与节点k相连的接口的IP地址;Step 303, the cost information link cost The sum is written into the routing table entry of node i as the distance from node i to destination network j, and the link cost Take a positive value and write it into the routing table entry of node i as the potential energy difference of node i, and set the next-hop IP address as the IP address of the interface connected to node k;
步骤304,判断所述代价信息同所述链路代价之和是否小于节点i的路由表项中到目的网络j的最优距离,如果是,则转入步骤305,否则转入步骤306;Step 304, judging the cost information link cost Whether the sum is less than the optimal distance to the destination network j in the routing table entry of node i, if yes, then proceed to step 305, otherwise proceed to step 306;
步骤305,将节点k设为节点i的下游节点,将节点k代替节点i原来的最优下游节点,将所述节点i原来的最优下游节点设为节点i的次优下游节点;将所述代价信息同所述链路代价之和作为节点i到目的网络j的距离写入到节点i的最优路由表项中,将所述链路代价取正值后作为节点i的势能差值写入节点i的最优路由表项中,设置下一跳IP地址为与节点k相连的接口的IP地址,将节点i原来的最优路由表项设为节点i的次优路由表项;Step 305, set node k as the downstream node of node i, replace node k as the original optimal downstream node of node i, and set the original optimal downstream node of node i as the suboptimal downstream node of node i; price information link cost The sum is written into the optimal routing entry of node i as the distance from node i to destination network j, and the link cost After taking a positive value, write it into the optimal routing table item of node i as the potential energy difference of node i, set the next-hop IP address as the IP address of the interface connected to node k, and write the original optimal routing table item of node i Set as the suboptimal routing entry of node i;
步骤306,判断所述代价信息是否小于节点i路由表项中到目的网络j的最优距离,如果是,则转入步骤307,否则,转入步骤308;Step 306, judging the cost information Whether it is less than the optimal distance to the destination network j in the node i routing table entry, if yes, then proceed to step 307, otherwise, proceed to step 308;
步骤307,节点i的最优路由表项不变,将节点k设为节点i的次优下游节点,次优节点路由表项中的路由代价、势能差值以及下一跳IP的设置同步骤303;Step 307, the optimal routing entry of node i remains unchanged, and node k is set as the suboptimal downstream node of node i, and the routing cost, potential energy difference and next-hop IP in the suboptimal node routing entry are set in the same step 303;
步骤308,判断所述代价信息是否等于节点i路由表项中到目的网络j的最优距离,如果是,则转入步骤309,否则,转入步骤310;Step 308, judging the cost information Whether it is equal to the optimal distance to the destination network j in the node i routing table entry, if yes, then proceed to step 309, otherwise, proceed to step 310;
步骤309,判断节点i的路由器ID是否大于节点k的路由器ID,如果是,则转入步骤311,否则,转入步骤312;Step 309, judge whether the router ID of node i is greater than the router ID of node k, if yes, then proceed to step 311, otherwise, proceed to step 312;
步骤310,将节点k设为节点i的上游节点,节点i的势能差值为取负值,节点i的路由表项及下一跳IP地址的设置同步骤303;Step 310, set node k as the upstream node of node i, and the potential energy difference of node i is Take a negative value, the routing table entry of node i and the setting of the next hop IP address are the same as step 303;
步骤311,将节点k设为节点i的下游节点,节点i的势能差值为节点i的路由表项及下一跳IP地址的设置同步骤303;Step 311, set node k as the downstream node of node i, and the potential energy difference of node i is The routing table entry of node i and the setting of the next hop IP address are the same as step 303;
步骤312,将节点k设为节点i的上游节点,势能差值为取负值,节点i的路由表项及下一跳IP地址的设置同步骤303。Step 312, set node k as the upstream node of node i, and the potential energy difference is If the value is negative, the setting of the routing table entry and next-hop IP address of node i is the same as step 303.
上面的实施例子详细描述了如何确定各节点上下游关系的方法,在确定了各节点的上下游关系之后,在本发明方法实施例三中,还可以在确定各节点的上下游关系之后进一步包括:The above implementation examples describe in detail how to determine the upstream and downstream relationship of each node. After determining the upstream and downstream relationship of each node, in the third embodiment of the method of the present invention, after determining the upstream and downstream relationship of each node, further include :
构建邻居节点中上游节点到下游节点的有向边;将多条邻居间的有向边级连,构成以目的网络的IP地址为终点的路由有向图。在数据转发时可以沿有向图转发数据。Construct directed edges from upstream nodes to downstream nodes among neighbor nodes; cascade directed edges between multiple neighbors to form a routing directed graph with the IP address of the destination network as the end point. Data can be forwarded along the directed graph during data forwarding.
有向边是数学的图论中的一个概念名词,由于网络一般抽象为一张图(graph),路由器抽象为节点(node),链路抽象为边(edge),而有向边即具有方向的边,有向边的方向在这里即上游的节点指向下游的节点。Directed edge is a conceptual term in mathematical graph theory. Since the network is generally abstracted as a graph (graph), routers are abstracted as nodes, links are abstracted as edges, and directed edges have directions. The edge, the direction of the directed edge here is that the upstream node points to the downstream node.
构建的有向图可以参见图4所示,图中节点D可以为目的网络,其它节点S、N1-7可以为整个数据传输过程中的节点,当数据传输时,可以从上游节点S向下游节点N1、N3和N6并行传输数据,节点N6可以经下游节点N2和N7将数据传输到目的网络D,节点N6也可以直接将数据传输到目的网络D,在实际应用中,假设N6直接将数据传给目的网络D的路由代价最小,那么N6就可以选择直接将数据传给目的网络D,当这条路由发生拥塞时,那么N6就可以及时切换到经节点N2到目的网络D这条路由来传输数据,也可以切换到经节点N7到目的网络D这条路由来传输数;或者根据实际应用中带宽的情况,N6可以经上述三条路由线路并行传输数据。The constructed directed graph can be seen in Figure 4. Node D in the figure can be the destination network, and other nodes S and N1-7 can be nodes in the entire data transmission process. When data is transmitted, it can be from the upstream node S to the downstream Nodes N1, N3, and N6 transmit data in parallel. Node N6 can transmit data to destination network D via downstream nodes N2 and N7. Node N6 can also directly transmit data to destination network D. In practical applications, it is assumed that N6 directly transmits data to The cost of the route to the destination network D is the smallest, then N6 can choose to directly transfer the data to the destination network D, when this route is congested, then N6 can switch to the route via node N2 to the destination network D in time Data transmission can also be switched to the route from node N7 to destination network D to transmit data; or according to the actual application bandwidth, N6 can transmit data in parallel through the above three routing lines.
根据路由有向图,可以建立多下一跳路由表用于数据转发。在建立多下一跳路由表时,可以将同一个目的网络的IP地址的多个下一跳路由表项以链表的形式链接,链表头存储代价最优的路由表项,链表头后链接非最优路由表项,势能差值为正值的路由表项在前,势能差值为负值的路由表项在后;其次,最优路由距离小的路由表在前,最优路由距离大的路由表在后。当建立多下一跳路由表后,由于路由表中还记录着上游节点信息,即含有势能差为负的表项,因此在进行数据转发时首先要查找目的地址匹配的表项,然后再查找势能差为正的表项,最后再读取下一跳IP地址进行数据转发。According to the routing directed graph, a multi-next-hop routing table can be established for data forwarding. When establishing a multi-next-hop routing table, multiple next-hop routing table entries of the IP address of the same destination network can be linked in the form of a linked list. The head of the linked list stores the routing table item with the best cost. For the optimal routing table entry, the routing table entry with a positive potential energy difference is in front, and the routing table entry with a negative potential energy difference is in the back; secondly, the routing table with a small optimal routing distance is in the front, and the optimal routing distance is large The routing table is after. After the multi-next-hop routing table is established, because the routing table also records the upstream node information, that is, contains entries with negative potential energy differences, it is necessary to first search for the entry that matches the destination address when performing data forwarding, and then search for For entries whose potential energy difference is positive, finally read the next-hop IP address for data forwarding.
本发明还给出了一种路由生成装置实施例四,参见图5,可以包括:The present invention also provides a fourth embodiment of a route generation device, referring to Figure 5, which may include:
接收单元501,用于接收邻居节点发送的更新报文;A receiving
比较更新单元502,用于比较当前节点同所述邻居节点的最优路由信息,更新当前节点的最优路由信息;A comparing and updating
识别确定单元503,用于依据各节点的路由表项中到同一目的网络的IP地址的最优距离确定各节点的上下游关系;An identification and determination unit 503, configured to determine the upstream and downstream relationship of each node according to the optimal distance to the IP address of the same destination network in the routing table entry of each node;
获取单元504,用于依据各节点的上下游关系,获得至少一个到达同一目的网络的IP地址的下一跳路由信息。The obtaining unit 504 is configured to obtain at least one next-hop routing information to an IP address of the same destination network according to the upstream-downstream relationship of each node.
进一步的还可以包括:Further can also include:
构边单元505,用于构建邻居节点中上游节点到下游节点的有向边;An edge construction unit 505, configured to construct a directed edge from an upstream node to a downstream node in a neighbor node;
构图单元506,用于将多条邻居间的有向边级连,构成以目的网络的IP地址为终点的路由有向图,沿有向图转发数据。The graph composition unit 506 is configured to cascade the directed edges between multiple neighbors to form a directed routing graph with the IP address of the destination network as the end point, and forward data along the directed graph.
在转发数据之前,接收单元501先接收邻居节点发来的更新报文,接收单元501将更新报文发送给比较更新单元502,比较更新单元502将报文中包含的邻居节点到目的网络的最优路由信息同当前节点的路由表项中的最优路由信息比较,将比较后的最优路由信息写入当前节点的路由表项中,并将更新后的当前节点的路由表项写入到更新报文中发送给邻居节点;识别确定单元503接收比较更新单元502的信息之后,在各节点之间经过路由信息的交换之后可以根据各节点的路由表项中到同一目的网络的IP地址的最优距离确定各节点的上下游关系;获取单元504依据识别确定单元503确定的各节点的上下游关系获得至少一个到达同一目的网络的IP地址的下一跳路由信息。进一步的,构边单元505可以在收到识别确定单元503的信息之后,依据各节点的上下游关系构建各节点中上游节点到下游节点的有向边;然后构图单元506获取构边单元505的信息之后,将多条邻居间的有向边级连,构成以目的网络的IP地址为终点的路由有向图,可以沿有向图转发数据。Before forwarding the data, the receiving
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related information, please refer to the description of the method part.
专业人员可以理解,结合本文中所公开的实施例描述的各示例的单元及方法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can understand that the units and method steps described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software In the above description, the components and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
本领域普通技术人员可以理解,实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,所述程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing related hardware through computer programs, and the programs can be stored in a computer-readable storage medium, so When the above-mentioned program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM), etc.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2009101326712A CN101515899B (en) | 2009-04-01 | 2009-04-01 | Route generation method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2009101326712A CN101515899B (en) | 2009-04-01 | 2009-04-01 | Route generation method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN101515899A CN101515899A (en) | 2009-08-26 |
| CN101515899B true CN101515899B (en) | 2012-05-23 |
Family
ID=41040198
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN2009101326712A Expired - Fee Related CN101515899B (en) | 2009-04-01 | 2009-04-01 | Route generation method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN101515899B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2014048339A1 (en) * | 2012-09-26 | 2014-04-03 | 腾讯科技(深圳)有限公司 | Routing update method, switch and system |
Families Citing this family (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103685034B (en) * | 2012-09-14 | 2017-04-12 | 华为技术有限公司 | Routing management method and nodes |
| CN108259326B (en) * | 2016-12-29 | 2020-06-26 | 华为技术有限公司 | Routing table updating method, device, distribution node, and leaf message forwarding device |
| CN109688059B (en) * | 2017-10-19 | 2022-02-01 | 深圳市中兴微电子技术有限公司 | Congestion management method and device for switching network and computer storage medium |
| CN108494700B (en) * | 2018-02-02 | 2022-11-01 | 百度在线网络技术(北京)有限公司 | Cross-link data transmission method and device, computer equipment and storage medium |
| CN110062301B (en) * | 2019-01-23 | 2021-12-14 | 中通服咨询设计研究院有限公司 | Routing method, apparatus, device and storage medium |
| CN112558504B (en) * | 2019-09-10 | 2021-11-02 | 中国电信股份有限公司 | Method, device and system for forwarding critical path information based on OSPF protocol |
| CN112039785B (en) * | 2020-09-07 | 2022-06-03 | 国网四川省电力公司电力科学研究院 | Bidirectional feedback route discovery method and device suitable for power Internet of things environment |
| CN112287183A (en) * | 2020-10-30 | 2021-01-29 | 北京字节跳动网络技术有限公司 | Link topology graph display method and device and computer storage medium |
| CN114296805B (en) * | 2021-12-27 | 2025-07-29 | 天翼云科技有限公司 | Message processing method and architecture, device, storage medium and electronic equipment |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1404268A (en) * | 2002-10-25 | 2003-03-19 | 清华大学 | Simulation method and system for priority protocal of Internet large-scale route to open shortest path |
| CN1507228A (en) * | 2002-12-10 | 2004-06-23 | ����������ͨѶ�ɷ�����˾�Ϻ��ڶ� | A multi-protocol label switching routing system interface device and forwarding method |
| EP1293070B1 (en) * | 2000-06-23 | 2007-03-07 | Nokia Inc. | Method and network for propagating status information |
-
2009
- 2009-04-01 CN CN2009101326712A patent/CN101515899B/en not_active Expired - Fee Related
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP1293070B1 (en) * | 2000-06-23 | 2007-03-07 | Nokia Inc. | Method and network for propagating status information |
| CN1404268A (en) * | 2002-10-25 | 2003-03-19 | 清华大学 | Simulation method and system for priority protocal of Internet large-scale route to open shortest path |
| CN1507228A (en) * | 2002-12-10 | 2004-06-23 | ����������ͨѶ�ɷ�����˾�Ϻ��ڶ� | A multi-protocol label switching routing system interface device and forwarding method |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2014048339A1 (en) * | 2012-09-26 | 2014-04-03 | 腾讯科技(深圳)有限公司 | Routing update method, switch and system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN101515899A (en) | 2009-08-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN101515899B (en) | Route generation method and device | |
| Narra et al. | Destination-sequenced distance vector (DSDV) routing protocol implementation in ns-3. | |
| CN109981471B (en) | Method, equipment and system for relieving congestion | |
| JP5722455B2 (en) | Reducing message and computational overhead in the network | |
| JP5691703B2 (en) | Multicast network system | |
| CN113395210A (en) | Method for calculating forwarding path and network equipment | |
| CN104468351B (en) | Management method, CCN retransmission units and network controller based on SDN auxiliary CCN routes | |
| CN101567818A (en) | Large-scale network routing simulation method based on hardware | |
| WO2013006154A1 (en) | Traffic forwarding in a point multi-point link aggregation using a link selector data table | |
| CN104883304B (en) | For part entangled quantum to the method for routing of bridge communications network | |
| CN111555982B (en) | Method and system for intelligently routing message based on IPv6 extension header | |
| CN112996055B (en) | Small data message merging method for wireless ad hoc network data synchronization | |
| CN105516025B (en) | Path clustering and data transmission method, OpenFlow controller and interchanger end to end | |
| CN103929377B (en) | Wired network and wireless network combined dispatching method and system and related devices | |
| JP2015508950A (en) | Control method, control device, communication system, and program | |
| CN110881006A (en) | Method, network device and computer storage medium for sending message | |
| CN114401228A (en) | End-to-end wide area crossing deterministic transmission network architecture and method | |
| WO2023098703A1 (en) | Path notification method, topology algorithm combination generation method, path calculation method, data transmission method, electronic device, and computer-readable storage medium | |
| WO2015081735A1 (en) | Traffic offloading method, apparatus, and system | |
| CN113438182B (en) | A credit-based flow control system and flow control method | |
| CN101087240B (en) | Route selection method and device in minimum path priority protocol | |
| CN104426778B (en) | Route renewing method and routing device | |
| WO2020168982A1 (en) | Method for sending and obtaining assert message and network node | |
| CN108667731A (en) | A processing and device based on BIER information | |
| Singh et al. | A survey on TCP (transmission control protocol) and UDP (user datagram protocol) over AODV routing protocol |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20120523 Termination date: 20190401 |
|
| CF01 | Termination of patent right due to non-payment of annual fee |