

技术领域technical field
本发明涉及计算机网络领域,特别涉及计算机网络领域中网络路由的实现。The invention relates to the field of computer networks, in particular to the realization of network routing in the field of computer networks.
背景技术Background technique
在说明书附图1中描述了一个常见的网络应用环境,用户在与因特网连接时,首先通过一个路由器连接到网关上,然后经由网关实现与因特网的连接。由此可见,路由设备在网络数据通信中必不可少,而基于网络处理器或者ASIC(ApplicationSpecific Intergrated Circuits)的路由器是一种常见的网络路由设备。如图2所示,它按逻辑可划分为控制平面和数据平面两部分。其中,控制平面负责维护非实时的协议处理操作,如运行路由协议、网络管理等;数据平面负责对数据报文进行转发操作。一般来说,控制平面的非实时操作由通用CPU执行;而数据平面,尤其是负责高速数据转发部分,则运行在网络处理器或者ASIC上。A common network application environment is described in Figure 1 of the specification. When a user connects to the Internet, he first connects to the gateway through a router, and then realizes the connection to the Internet through the gateway. It can be seen that routing devices are indispensable in network data communication, and routers based on network processors or ASICs (Application Specific Integrated Circuits) are a common network routing device. As shown in Figure 2, it can be logically divided into two parts, the control plane and the data plane. Among them, the control plane is responsible for maintaining non-real-time protocol processing operations, such as running routing protocols, network management, etc.; the data plane is responsible for forwarding data packets. Generally speaking, the non-real-time operation of the control plane is performed by a general-purpose CPU; while the data plane, especially the part responsible for high-speed data forwarding, runs on the network processor or ASIC.
在路由器中,路由器根据自身存储的路由表进行数据转发,路由表由各个路由表项组成,一般来说,每个路由表项至少应当包括以下字段:前缀、下一跳MAC地址、接口。利用路由表实现路由转发的基本操作过程如下:当路由器收到IP报文后,根据目的IP地址查询路由表(常见的路由查询算法为最长前缀匹配算法),如果查到匹配的路由表项并且该路由表项的内容表明为非本机路由,则根据路由表项中的下一跳MAC地址对IP报文中的以太网首部进行重新封装,然后从路由表项的接口字段所表示的接口发送IP报文。In the router, the router performs data forwarding according to the routing table stored by itself. The routing table is composed of various routing table entries. Generally speaking, each routing table entry should include at least the following fields: prefix, next-hop MAC address, and interface. The basic operation process of using the routing table to realize routing forwarding is as follows: when the router receives the IP packet, it queries the routing table according to the destination IP address (the common routing query algorithm is the longest prefix matching algorithm), if a matching routing table entry is found And the content of the routing table item shows that it is a non-local route, then according to the next hop MAC address in the routing table item, the Ethernet header in the IP message is re-encapsulated, and then from the interface field of the routing table item. The interface sends IP packets.
要完成上述的路由转发过程,首先需要控制平面将路由协议产生的路由下发至数据平面,形成数据平面的路由表,从而使得网络处理器能够根据数据平面的路由表获得路由信息。但对于控制平面的某些路由条目(如缺省路由),最开始配置时只配置了下一跳网关的IPv6地址,没有对应的下一跳MAC地址。而从上述的路由转发过程可知,在转发数据报文时,只有获得下一跳MAC地址才能够对报文进行封装、转发。因此,在实现路由转发操作前,一般的实现方法如下:To complete the above route forwarding process, firstly, the control plane needs to send the route generated by the routing protocol to the data plane to form a data plane routing table, so that the network processor can obtain routing information according to the data plane routing table. However, for some routing entries (such as default routes) on the control plane, only the IPv6 address of the next-hop gateway is configured at the beginning of configuration, and there is no corresponding next-hop MAC address. It can be seen from the above routing and forwarding process that when forwarding a data message, the message can be encapsulated and forwarded only after the next-hop MAC address is obtained. Therefore, before implementing routing and forwarding operations, the general implementation method is as follows:
1、在路由器的数据平面接收到IP报文后,查询路由表,如果路由表正常,则进行正常的数据转发操作,但如果在路由表中所查询到的下一跳网关的二层信息不完全,则将IP报文发送到控制平面;1. After the data plane of the router receives the IP message, it queries the routing table. If the routing table is normal, it performs normal data forwarding operations. However, if the second-hop gateway information in the routing table is not Complete, send the IP packet to the control plane;
2、控制平面缓存该IP报文,并向下一跳网关发送邻居请求报文;2. The control plane caches the IP packet and sends a neighbor solicitation packet to the next-hop gateway;
3、下一跳网关收到邻居请求报文后,回复邻居应答报文;3. After receiving the Neighbor Solicitation message, the next-hop gateway replies with a Neighbor Reply message;
4、路由器的控制平面根据邻居应答报文中可得到下一跳MAC地址,形成一条完整的路由表项后,再将完整的路由表项发送到数据平面,由数据平面完成路由查询、数据转发等后续工作。4. The control plane of the router can obtain the next-hop MAC address according to the neighbor response message, and after forming a complete routing table entry, it sends the complete routing table entry to the data plane, and the data plane completes routing query and data forwarding Wait for the follow-up work.
上述获取下一跳MAC地址的操作被称为控制平面被动学习过程。这种方法的缺点在于,在被动学习MAC地址的过程中,数据平面的网络处理器需要向控制平面的CPU发送大量的报文,直到被动学习过程结束,控制平面向数据平面返回完整的路由表项,这一操作会耗费控制平面中的CPU资源,影响路由器的执行效率。The above operation of acquiring the next-hop MAC address is called a passive learning process of the control plane. The disadvantage of this method is that in the process of passively learning the MAC address, the network processor of the data plane needs to send a large number of packets to the CPU of the control plane, until the passive learning process is over, and the control plane returns a complete routing table to the data plane This operation consumes CPU resources in the control plane and affects the execution efficiency of the router.
发明内容Contents of the invention
本发明的目的是克服现有的下一跳MAC地址被动学习方法在被动学习过程中需要向路由器发送大量的报文,耗费CPU资源,影响路由器执行效率的缺陷,从而提供一种高效的下一跳MAC地址探测方法。The purpose of the present invention is to overcome the defect that the existing next-hop MAC address passive learning method needs to send a large number of messages to the router during the passive learning process, consumes CPU resources, and affects the execution efficiency of the router, thereby providing an efficient next-hop MAC address. Jump MAC address detection method.
为了实现上述目的,本发明提供了一种探测下一跳MAC地址的方法,包括以下步骤:In order to achieve the above object, the present invention provides a method for detecting the next-hop MAC address, comprising the following steps:
步骤1)、路由器在配置网络路由时,探测到路由表中的路由表项不具备下一跳MAC地址信息;Step 1), the router detects that the routing table entry in the routing table does not have the next-hop MAC address information when configuring network routing;
步骤2)、路由器的控制平面主动构造一个邻居请求报文,并发送到互联网中与路由器相连接的下一跳网关上;Step 2), the control plane of the router actively constructs a neighbor solicitation message, and sends it to the next-hop gateway connected to the router in the Internet;
步骤3)、下一跳网关接收到所述的邻居请求报文后,向所述路由器回复邻居公告报文;Step 3), after the next-hop gateway receives the neighbor solicitation message, it replies the neighbor advertisement message to the router;
步骤4)、路由器接收到所述的邻居公告报文后,根据所述的邻居报文将路由表项中的下一跳MAC地址信息填写完整,并向数据平面中的路由表下发路由表项。Step 4), after the router receives the neighbor announcement message, fills in the next-hop MAC address information in the routing table entry according to the neighbor message, and sends the routing table to the routing table in the data plane item.
上述技术方案中,当路由器没有接收到所述的邻居公告报文时,重新发送邻居请求报文,直至所述的路由器收到所述的邻居公告报文或重新发送邻居请求报文的次数超过一个阈值。In the above technical solution, when the router does not receive the Neighbor Advertisement message, it resends the Neighbor Solicitation message until the router receives the Neighbor Advertisement message or resends the Neighbor Solicitation message for more than a threshold.
上述技术方案中,在所述的邻居请求报文中,IPv6首部的目的IPv6地址字段为下一跳网关对应的请求节点组播地址,在邻居请求消息首部的目标地址字段为下一跳网关的IPv6地址。In the above technical solution, in the neighbor solicitation message, the destination IPv6 address field of the IPv6 header is the request node multicast address corresponding to the next-hop gateway, and the target address field of the neighbor solicitation message header is the address of the next-hop gateway. IPv6 address.
上述技术方案中,在所述的邻居公告报文中,邻居公告消息首部的目标地址字段为下一跳网关的IPv6地址,目标链路层地址字段为下一跳网关的MAC地址。In the above technical solution, in the Neighbor Advertisement message, the target address field of the Neighbor Advertisement message header is the IPv6 address of the next-hop gateway, and the target link layer address field is the MAC address of the next-hop gateway.
所述的阈值可以取值为3。The threshold may be 3.
本发明的优点在于:The advantages of the present invention are:
本发明通过发送邻居请求报文主动探测网络路由的下一跳MAC地址,减小了路由器控制平面CPU的消耗,提高了路由器的效率。The invention actively detects the next-hop MAC address of the network route by sending the neighbor request message, reduces the consumption of the router control plane CPU, and improves the efficiency of the router.
附图说明Description of drawings
图1为一个常见的网络应用环境的示意图;FIG. 1 is a schematic diagram of a common network application environment;
图2为路由器按逻辑划分的示意图;Fig. 2 is a schematic diagram of routers logically divided;
图3为本发明的探测下一跳MAC地址的方法的流程图。FIG. 3 is a flowchart of a method for detecting a next-hop MAC address in the present invention.
具体实施方式Detailed ways
下面结合附图和具体实施方式对本发明作进一步详细描述:Below in conjunction with accompanying drawing and specific embodiment the present invention is described in further detail:
本发明可应用于任何基于网络处理器或者ASIC的硬件路由器。下面以网络处理器为例,结合附图3,介绍本发明方法的一个最佳实施例:The present invention is applicable to any network processor or ASIC based hardware router. Take network processor as example below, in conjunction with accompanying drawing 3, introduce a preferred embodiment of the inventive method:
步骤10、路由器在转发IP报文前,首先配置网络路由,在配置过程中,检查路由表中的路由表项是否具备下一跳MAC地址信息,若路由表中的路由表项不具备下一跳MAC地址信息,则执行下一步,否则按照正常下发路由的方法执行。Step 10, before the router forwards the IP message, at first configure the network route, in the configuration process, check whether the routing table entry in the routing table has the next-hop MAC address information, if the routing table entry in the routing table does not have the next-hop MAC address information, If the MAC address information is missing, go to the next step; otherwise, go to the method of delivering the route normally.
步骤20、路由器的控制平面主动构造一个邻居请求NS(NeighbourSolicitation)报文,并发送到互联网中与路由器相连接的下一跳网关上;同时还要设定一个重发次数,并初始化该重发次数为0;Step 20, the control plane of the router actively constructs a Neighbor Solicitation NS (NeighbourSolicitation) message, and sends it to the next-hop gateway connected to the router in the Internet; at the same time, a number of retransmissions must be set, and the retransmission will be initialized The number of times is 0;
在本步骤中,所采用的NS报文格式与RFC2461中定义的一致,在NS报文中,IPv6首部的目的IPv6地址字段为该下一跳网关对应的请求节点组播地址(Solicited-node Multicast Address),另外,在NS消息首部中,目标地址(TargetAddress)字段为下一跳网关的IPv6地址;In this step, the adopted NS message format is consistent with that defined in RFC2461. In the NS message, the destination IPv6 address field of the IPv6 header is the request node multicast address (Solicited-node Multicast Address) corresponding to the next-hop gateway. Address), in addition, in the NS message header, the target address (TargetAddress) field is the IPv6 address of the next-hop gateway;
步骤30、下一跳网关接收到邻居请求报文后,向路由器回复邻居公告NA(Neighbour Advertisement)报文;在NA消息首部中,目标地址(Target Address)字段为下一跳网关的IPv6地址,在目标链路层地址(Target link-layer Address)字段为下一跳网关的MAC地址。Step 30, after the next-hop gateway receives the Neighbor Solicitation message, it replies to the router with a Neighbor Advertisement NA (Neighbour Advertisement) message; in the NA message header, the target address (Target Address) field is the IPv6 address of the next-hop gateway, In the target link layer address (Target link-layer Address) field is the MAC address of the next-hop gateway.
步骤40、判断路由器是否收到了邻居公告报文,若收到,则根据邻居公告NA报文将路由表项中的下一跳MAC地址信息填写完整,并向数据平面中的路由表下发该路由表项,然后执行步骤70;若没有收到,则执行下一步;Step 40, determine whether the router has received the neighbor advertisement message, and if so, fill in the next-hop MAC address information in the routing table entry according to the neighbor advertisement NA message, and send the message to the routing table in the data plane. Routing entry, then execute step 70; if not received, then execute the next step;
步骤50、重新向下一跳网关发送NS报文;Step 50, resending the NS message to the next-hop gateway;
步骤60、将重发次数值加1,若当前的重发次数高于一个预先设定的阈值,则标注网络路由不可达,并且不向数据平面的路由表下发相应的路由表项,否则,重新执行步骤40;例如,假设在本实施例中,所设定的阈值为3次,则当前的重发次数到达3次,就可标注网络路由不可达。Step 60: Add 1 to the number of retransmissions, if the current number of retransmissions is higher than a preset threshold, mark the network route as unreachable, and do not send the corresponding routing entry to the routing table of the data plane, otherwise , re-execute step 40; for example, assuming that in this embodiment, the set threshold is 3 times, then the current number of retransmissions reaches 3 times, and the network route can be marked as unreachable.
步骤70、路由器的控制平面完成下发路由表项操作后,路由器数据平面的网络处理器就可以根据该路由表项对相应的IP报文进行数据转发,而不再将IP报文上送控制平面的CPU。Step 70: After the control plane of the router completes the operation of delivering the routing table entry, the network processor of the data plane of the router can forward the corresponding IP message according to the routing table entry, instead of sending the IP message to the control Flat CPU.
最后所应说明的是,以上实施例仅用以说明本发明的技术方案而非限制。尽管参照实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,对本发明的技术方案进行修改或者等同替换,都不脱离本发明技术方案的精神和范围,其均应涵盖在本发明的权利要求范围当中。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than limit them. Although the present invention has been described in detail with reference to the embodiments, those skilled in the art should understand that modifications or equivalent replacements to the technical solutions of the present invention do not depart from the spirit and scope of the technical solutions of the present invention, and all of them should be included in the scope of the present invention. within the scope of the claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNA200710117667XACN101330447A (en) | 2007-06-21 | 2007-06-21 | A Method of Detecting Next Hop MAC Address |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNA200710117667XACN101330447A (en) | 2007-06-21 | 2007-06-21 | A Method of Detecting Next Hop MAC Address |
| Publication Number | Publication Date |
|---|---|
| CN101330447Atrue CN101330447A (en) | 2008-12-24 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CNA200710117667XAPendingCN101330447A (en) | 2007-06-21 | 2007-06-21 | A Method of Detecting Next Hop MAC Address |
| Country | Link |
|---|---|
| CN (1) | CN101330447A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2010145472A1 (en)* | 2009-06-19 | 2010-12-23 | 中兴通讯股份有限公司 | Method for processing messages and network device |
| CN102857427A (en)* | 2012-08-27 | 2013-01-02 | 上海斐讯数据通信技术有限公司 | Method for detecting next hop MAC (Media Access Control) address and route device thereof |
| CN104618242A (en)* | 2015-02-12 | 2015-05-13 | 杭州华三通信技术有限公司 | Method and device for transferring message |
| WO2017124886A1 (en)* | 2016-01-18 | 2017-07-27 | 华为技术有限公司 | Method and gateway for acquiring route as required |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2010145472A1 (en)* | 2009-06-19 | 2010-12-23 | 中兴通讯股份有限公司 | Method for processing messages and network device |
| US9112143B2 (en) | 2009-06-19 | 2015-08-18 | Zte Corporation | Method for processing messages and network device |
| CN102857427A (en)* | 2012-08-27 | 2013-01-02 | 上海斐讯数据通信技术有限公司 | Method for detecting next hop MAC (Media Access Control) address and route device thereof |
| CN104618242A (en)* | 2015-02-12 | 2015-05-13 | 杭州华三通信技术有限公司 | Method and device for transferring message |
| CN104618242B (en)* | 2015-02-12 | 2018-06-15 | 新华三技术有限公司 | A kind of message forwarding method and device |
| WO2017124886A1 (en)* | 2016-01-18 | 2017-07-27 | 华为技术有限公司 | Method and gateway for acquiring route as required |
| US10447593B2 (en) | 2016-01-18 | 2019-10-15 | Huawei Technologies Co., Ltd. | Method and gateway for obtaining route according to requirement |
| CN113162857A (en)* | 2016-01-18 | 2021-07-23 | 华为技术有限公司 | Method and gateway for acquiring route on demand |
| CN113162857B (en)* | 2016-01-18 | 2023-01-13 | 华为技术有限公司 | Method and gateway for acquiring route on demand |
| Publication | Publication Date | Title |
|---|---|---|
| CN107204867B (en) | Information transmission method, device and system | |
| US6845091B2 (en) | Mobile ad hoc extensions for the internet | |
| US7698463B2 (en) | System and method for disseminating topology and link-state information to routing nodes in a mobile ad hoc network | |
| US7031288B2 (en) | Reduced-overhead protocol for discovering new neighbor nodes and detecting the loss of existing neighbor nodes in a network | |
| US7327683B2 (en) | Method and apparatus for disseminating topology information and for discovering new neighboring nodes | |
| US20010040895A1 (en) | An IPv6-IPv4 compatibility aggregatable global unicast address format for incremental deployment of IPv6 nodes within IPv4 | |
| CN103430149B (en) | Virtual machine migration notification method and system | |
| CN101394333B (en) | Method, device and network system for forwarding message | |
| WO2022041916A1 (en) | Message header processing method and apparatus, storage medium and electronic device | |
| CN112491706B (en) | Data message processing method and device, storage medium and electronic device | |
| JP5519710B2 (en) | Maximum transmission unit (MTU) size detection mechanism and method for data link layer | |
| WO2018032962A1 (en) | Method, device and system for information synchronization | |
| WO2009111959A1 (en) | Method and device for route installation and distribution | |
| WO2021121065A1 (en) | Bier packet forwarding method, device, apparatus, and storage medium | |
| CN103763750B (en) | Method for fast achieving packet forwarding in wireless ad hoc network of TDMA protocol | |
| WO2018121257A1 (en) | Method, apparatus and system for sending message, and storage medium | |
| WO2018141215A1 (en) | Method for updating routing in network, network device and system | |
| CN101616078A (en) | A method for discovering the maximum transmission unit of a path, a router and a node device | |
| US12058027B2 (en) | Packet transmission method, correspondence obtaining method, apparatus, and system | |
| CN101252524A (en) | Method, system and device for message transmission | |
| US20210029020A1 (en) | System and method for interior gateway protocol (igp) fast convergence | |
| CN101330447A (en) | A Method of Detecting Next Hop MAC Address | |
| US11870683B2 (en) | 3GPP network function set adaptation for pre-5G network elements | |
| CN100561971C (en) | Table entry fast convergence method and message fast forwarding method according to the table entry | |
| CN108667731A (en) | A processing and device based on BIER information |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| ASS | Succession or assignment of patent right | Owner name:WUXI ZHONGKE INTELLIGENT INFORMATION TREATMENT RES Free format text:FORMER OWNER: ACOUSTICS INST., CHINESE ACADEMY OF SCIENCES Effective date:20110722 | |
| C41 | Transfer of patent application or patent right or utility model | ||
| COR | Change of bibliographic data | Free format text:CORRECT: ADDRESS; FROM: 100080 NO. 21, NORTH 4TH RING ROAD WEST, HAIDIAN DISTRICT, BEIJING TO: 214135 TOWER C, CHINA MICRO/NANO SENSOR NETWORK INTERNATIONAL INNOVATION PARK, NO. 200, LINGHU AVENUE, T-PARK, WUXI NEW DISTRICT, JIANGSU PROVINCE | |
| TA01 | Transfer of patent application right | Effective date of registration:20110722 Address after:214135 Jiangsu New District of Wuxi, Taihu international science and Technology Parks Linghu Road No. 200 China micro nano Sensor Network International Innovation Park building C Applicant after:Wuxi Zhongke R&D Center of Intelligent Information Processing Technologies Co., Ltd. Address before:100080, No. 21 West Fourth Ring Road, Beijing, Haidian District Applicant before:Institute of acoustics, Chinese Academy of Sciences | |
| C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
| WD01 | Invention patent application deemed withdrawn after publication | Application publication date:20081224 |