[go: up one dir, main page]

CN117499295A - A message forwarding method, device, equipment and storage medium - Google Patents

A message forwarding method, device, equipment and storage medium Download PDF

Info

Publication number
CN117499295A
CN117499295A CN202311445360.8A CN202311445360A CN117499295A CN 117499295 A CN117499295 A CN 117499295A CN 202311445360 A CN202311445360 A CN 202311445360A CN 117499295 A CN117499295 A CN 117499295A
Authority
CN
China
Prior art keywords
target
path
address
identifier
message
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.)
Pending
Application number
CN202311445360.8A
Other languages
Chinese (zh)
Inventor
岳峰
徐鹍
汪硕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Network Communication and Security Zijinshan Laboratory
Original Assignee
Network Communication and Security Zijinshan Laboratory
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Network Communication and Security Zijinshan Laboratory filed Critical Network Communication and Security Zijinshan Laboratory
Priority to CN202311445360.8A priority Critical patent/CN117499295A/en
Publication of CN117499295A publication Critical patent/CN117499295A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/34Source routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/82Miscellaneous aspects
    • H04L47/825Involving tunnels, e.g. MPLS

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a message forwarding method, a message forwarding device, message forwarding equipment and a storage medium. The method comprises the following steps: receiving a target message, wherein the target message comprises: a target IP address and an instance identifier; inquiring a routing table according to the target IP address and the instance identifier to obtain a private network next-hop table; inquiring a private network next hop table to obtain an IP tunnel table and a target public network next hop group table; querying an IP tunnel table to obtain a VPNSID and a source IP address; inquiring a next hop group table of the target public network to obtain a target switching identifier; updating the target message according to the VPNSID, the source IP address and the target switching identifier to obtain an updated target message; according to the target switching identification, a target output port is determined, and the updated target message is output from the target output port.

Description

一种报文转发方法、装置、设备及存储介质A message forwarding method, device, equipment and storage medium

技术领域Technical field

本发明实施例涉及通信技术领域,尤其涉及一种报文转发方法、装置、设备及存储介质。The embodiments of the present invention relate to the field of communication technology, and in particular, to a message forwarding method, device, equipment and storage medium.

背景技术Background technique

SRV6(Segment Routing over IPv6,互联网协议第六版的段路由)的核心思想是将报文转发路径切割成不同的段,再为其分配SID(Segment Identifier,段标识符)进行标识从而以段指导报文转发。The core idea of SRV6 (Segment Routing over IPv6, Internet Protocol version 6 segment routing) is to cut the message forwarding path into different segments, and then assign SID (Segment Identifier, segment identifier) to identify them so as to guide them by segments. Message forwarding.

SRV6 TE Policy是在SRV6技术上发展的一种隧道引流技术,根据某种策略将流量引入SRV6 TE隧道。数据包被导入SRV6 TE Policy中,SID列表指示数据包的路径及行为。SRV6 TE Policy is a tunnel traffic diversion technology developed on SRV6 technology, which introduces traffic into SRV6 TE tunnels according to a certain policy. The data packet is imported into the SRV6 TE Policy, and the SID list indicates the path and behavior of the data packet.

报文转发过程中,为了避免报文传输路径中因设备故障而导致报文无法传输的问题,通常会在网络侧边缘设备上配置双向转发检测(Bidirectional ForwardingDetection,BFD),通过BFD对路径中的设备进行故障检测。During the packet forwarding process, in order to avoid the problem that packets cannot be transmitted due to equipment failure in the packet transmission path, Bidirectional Forwarding Detection (BFD) is usually configured on the network edge device. BFD is used to detect the packets in the path. The equipment performs fault detection.

但是,每个PE设备(网络侧边缘设备)会与网络中多个其他PE设备建立路径。为了保证每条路径均能快速的检测故障,彼此之间建立路径的PE设备均需要部署BFD,所以每个PE设备部署BFD的数量能够达到其与其他PE设备之间建立路径的数量,从而导致每个PE设备均需要部署较多的BFD,因而,需要进行大量消息交互,存在消息丢失,消息交互时间长以及消息交互可定位性差、可维护性差等问题。此外,在确定报文发送路径的整个过程中均需私网侧参与,路径切换性能较低,切换时间较长,且需要占用较多的CPU。However, each PE device (network-side edge device) will establish paths with multiple other PE devices in the network. In order to ensure that each path can quickly detect faults, PE devices that establish paths between each other need to deploy BFD. Therefore, the number of BFD deployed on each PE device can reach the number of paths established between it and other PE devices, resulting in Each PE device needs to deploy a large number of BFDs. Therefore, a large number of message interactions are required, and there are problems such as message loss, long message interaction time, and poor locability and maintainability of message interaction. In addition, the private network side needs to participate in the entire process of determining the packet sending path. The path switching performance is low, the switching time is long, and it requires a lot of CPU.

发明内容Contents of the invention

本发明实施例提供一种报文转发方法、装置、设备及存储介质,能够解决消息丢失,消息交互时间长以及消息交互可定位性差、可维护性差等问题,提升了路径切换性能,减少了路径切换时间和CPU占用率。Embodiments of the present invention provide a message forwarding method, device, equipment and storage medium, which can solve problems such as message loss, long message interaction time, poor message interaction locability and poor maintainability, improve path switching performance, and reduce path switching costs. Switching time and CPU usage.

根据本发明的一方面,提供了一种报文转发方法,包括:According to one aspect of the present invention, a message forwarding method is provided, including:

接收目标报文,其中,所述目标报文包括:目标IP地址和实例标识;Receive a target message, where the target message includes: a target IP address and an instance identifier;

根据所述目标IP地址和所述实例标识查询路由表,得到私网下一跳表;Query the routing table according to the target IP address and the instance identifier to obtain the private network next hop table;

查询私网下一跳表得到IP隧道表和目标公网下一跳组表;Query the private network next-hop table to obtain the IP tunnel table and target public network next-hop group table;

查询IP隧道表,得到VPNSID和源IP地址;Query the IP tunnel table to obtain the VPNSID and source IP address;

查询目标公网下一跳组表,得到目标切换标识;Query the next hop group table of the target public network to obtain the target switching identifier;

根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文;Update the target message according to the VPNSID, the source IP address and the target switching identifier to obtain an updated target message;

根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出。Determine a target egress port according to the target switching identifier, and output the updated target message from the target egress port.

根据本发明的另一方面,提供了一种报文转发装置,该报文转发装置包括:According to another aspect of the present invention, a message forwarding device is provided. The message forwarding device includes:

目标报文接收模块,用于接收目标报文,其中,所述目标报文包括:目标IP地址和实例标识;A target message receiving module, configured to receive a target message, where the target message includes: a target IP address and an instance identifier;

路由表查询模块,用于根据所述目标IP地址和所述实例标识查询路由表,得到私网下一跳表;A routing table query module is used to query the routing table according to the target IP address and the instance identifier to obtain the private network next hop table;

私网下一跳表查询模块,用于查询私网下一跳表得到IP隧道表和目标公网下一跳组表;The private network next-hop table query module is used to query the private network next-hop table to obtain the IP tunnel table and the target public network next-hop group table;

IP隧道表查询模块,用于查询IP隧道表,得到VPNSID和源IP地址;The IP tunnel table query module is used to query the IP tunnel table and obtain the VPNSID and source IP address;

目标公网下一跳组表查询模块,用于查询目标公网下一跳组表,得到目标切换标识;The target public network next-hop group table query module is used to query the target public network next-hop group table to obtain the target switching identification;

目标报文更新模块,用于根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文;A target message update module, configured to update the target message according to the VPNSID, the source IP address and the target switching identifier, and obtain an updated target message;

报文输出模块,用于根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出。A message output module, configured to determine a target egress port according to the target switching identifier, and output the updated target message from the target egress port.

根据本发明的另一方面,提供了一种电子设备,所述电子设备包括:According to another aspect of the present invention, an electronic device is provided, the electronic device including:

至少一个处理器;以及at least one processor; and

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively connected to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行本发明任一实施例所述的报文转发方法。The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor, so that the at least one processor can execute the method described in any embodiment of the present invention. Message forwarding method.

根据本发明的另一方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机指令,所述计算机指令用于使处理器执行时实现本发明任一实施例所述的报文转发方法。According to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores computer instructions. The computer instructions are used to enable a processor to implement any embodiment of the present invention when executed. message forwarding method.

本发明实施例通过接收目标报文,根据目标报文包括的目标IP地址和实例标识查询路由表,得到私网下一跳表;查询私网下一跳表得到IP隧道表和目标公网下一跳组表;查询IP隧道表,得到VPNSID和源IP地址;查询目标公网下一跳组表,得到目标切换标识;根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文;根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出,能够解决消息丢失,消息交互时间长以及消息交互可定位性差、可维护性差等问题,由于目标公网下一跳组表包括目标切换标识,目标切换标识用于表征主备切换状态,因此,路径切换过程仅是针对公网侧,私网侧不感知,进而提升了路径切换性能,减少了路径切换时间和CPU占用率。The embodiment of the present invention receives the target message, queries the routing table according to the target IP address and instance identifier included in the target message, and obtains the private network next hop table; queries the private network next hop table to obtain the IP tunnel table and the target public network One-hop group table; query the IP tunnel table to obtain the VPNSID and source IP address; query the next-hop group table of the target public network to obtain the target switching identifier; perform all the steps according to the VPNSID, the source IP address and the target switching identifier. The target message is updated to obtain the updated target message; the target egress port is determined according to the target switching identifier, and the updated target message is output from the target egress port, which can solve the problem of message loss and message interaction. There are problems such as long time and poor message interaction locability and maintainability. Since the next hop group table of the target public network includes the target switching identifier, the target switching identifier is used to represent the active and backup switching status. Therefore, the path switching process is only for the public network. side, the private network side is not aware of it, thus improving path switching performance and reducing path switching time and CPU usage.

应当理解,本部分所描述的内容并非旨在标识本发明的实施例的关键或重要特征,也不用于限制本发明的范围。本发明的其它特征将通过以下的说明书而变得容易理解。It should be understood that what is described in this section is not intended to identify key or important features of the embodiments of the invention, nor is it intended to limit the scope of the invention. Other features of the present invention will become easily understood from the following description.

附图说明Description of the drawings

为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to explain the technical solutions of the embodiments of the present invention more clearly, the drawings required to be used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and therefore do not It should be regarded as a limitation of the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without exerting creative efforts.

图1是本发明实施例中的一种报文转发方法的流程图;Figure 1 is a flow chart of a message forwarding method in an embodiment of the present invention;

图2是本发明实施例中的SRV6 Policy HSB组网结构示意图;Figure 2 is a schematic diagram of the SRV6 Policy HSB networking structure in the embodiment of the present invention;

图3是本发明实施例中的SRV6 HSB主路径转发示意图;Figure 3 is a schematic diagram of SRV6 HSB main path forwarding in the embodiment of the present invention;

图4是本发明实施例中的SRV6 HSB备路径转发示意图;Figure 4 is a schematic diagram of SRV6 HSB backup path forwarding in the embodiment of the present invention;

图5是本发明实施例中的一种报文转发装置的结构示意图;Figure 5 is a schematic structural diagram of a message forwarding device in an embodiment of the present invention;

图6是本发明实施例中的一种电子设备的结构示意图。Figure 6 is a schematic structural diagram of an electronic device in an embodiment of the present invention.

具体实施方式Detailed ways

为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only These are some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts should fall within the scope of protection of the present invention.

需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances so that the embodiments of the invention described herein are capable of being practiced in sequences other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus that encompasses a series of steps or units and need not be limited to those explicitly listed. Those steps or elements may instead include other steps or elements not expressly listed or inherent to the process, method, product or apparatus.

可以理解的是,在使用本公开各实施例公开的技术方案之前,均应当依据相关法律法规通过恰当的方式对本公开所涉及个人信息的类型、使用范围、使用场景等告知用户并获得用户的授权。It can be understood that before using the technical solutions disclosed in the embodiments of this disclosure, users should be informed of the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations and obtain the user's authorization. .

实施例一Embodiment 1

图1为本发明实施例提供的一种报文转发方法的流程图,本实施例可适用于报文转发的情况,该方法可以由本发明实施例中的报文转发装置来执行,该装置可采用软件和/或硬件的方式实现,如图1所示,该方法具体包括如下步骤:Figure 1 is a flow chart of a message forwarding method provided by an embodiment of the present invention. This embodiment can be applied to the situation of message forwarding. The method can be executed by the message forwarding device in the embodiment of the present invention. The device can It is implemented using software and/or hardware, as shown in Figure 1. The method specifically includes the following steps:

S110,接收目标报文,其中,所述目标报文包括:目标IP地址和实例标识。S110. Receive a target message, where the target message includes: a target IP address and an instance identifier.

其中,所述实例标识为目标报文包括的实例标识,目标报文包括的实例标识是目标报文通过接口的配置将目标报文打上具体某个实例的标识,是目标报文携带的转发信息。The instance identifier is the instance identifier included in the target message. The instance identifier included in the target message is the identifier of a specific instance that is marked on the target message through the configuration of the interface. It is the forwarding information carried by the target message. .

需要说明的是,进入网络侧边缘PE设备的目标报文包括:目标IP地址和实例标识。例如可以是,若PE设备与CE(Customer Edge,用户侧边缘)设备连接的接口绑定了某个VPN实例,那么从这个接口进来的目标报文就包括了接口绑定的VPN实例的实例标识。It should be noted that the target packets entering the edge PE device on the network side include: target IP address and instance identifier. For example, if the interface connecting the PE device and the CE (Customer Edge) device is bound to a VPN instance, then the target packet coming in from this interface will include the instance identifier of the VPN instance bound to the interface. .

具体的,在接收目标报文之前,在控制平面:对于PE设备,SRV6 Policy可以通过IGP协议、BGP协议以及控制器规划出SRV6 Policy候选路径或者通过手动配置SRV6 Policy候选路径(即包括:SID列表,出端口,下一跳IP地址等);对于每条SRV6 Policy候选路径都配置对应的BFD会话,当有多个SRV6Policy候选路径有效时,控制平面会根据优先级选择两路SRV6 Policy候选路径作为SRV6 HSB保护组的主路径和备路径。控制平面下发BFD信息至Redis AppDB数据库中的BFD表。控制平面下发SRV6 HSB信息至Redis AppDB数据库中的保护组表。控制平面下发路由信息至Redis AppDB数据库中路由集合表。在转发平面:转发平面订阅数据库中的BFD表,记录BFD索引(也就是BFD会话标识)以及BFD状态。转发平面订阅数据库中的保护组表,保护组表中有主备路径信息,包括:主备路径下一跳地址、出端口标识、sidlist(即SID列表)以及主路径BFD索引。在获取主路径BFD索引后,将该保护组表的索引记录到BFD对应的软件表中,将保护组表与BFD信息(BFD信息包括:BFD会话标识和BFD状态)关联起来。需要说明的是,在创建保护组的时候,通过将保护组表的索引记录到BFD的软件表中,来确定具体的某个BFD会话是检测哪个保护组,当BFD状态变化时,可以直接通知保护组,进行切换。PE设备预先创建公网侧的表项,后创建私网侧的表项,以便于私网侧在创建表项时可以获取到公网侧公网下一跳组表索引。其中,私网侧的表项有:路由表、私网下一跳表以及IP隧道表。公网侧的表项有:公网下一跳组表、NEXTHOP表、ARP表、L3_INTF表以及SRV6_TUNNEL表。所述路由表包括:IP地址、实例标识以及私网下一跳表索引,所述私网下一跳表包括:IP隧道表索引和公网下一跳组表索引,所述IP隧道表包括:VPNSID和源IP地址,所述公网下一跳组表包括:切换标识、主路径下一跳表索引以及备路径下一跳表索引,所述NEXTHOP表包括:主路径NEXTHOP表和备路径NEXTHOP表,主路径NEXTHOP表包括:主路径出端口标识、主路径ARP表索引以及主路径SRV6_TUNNEL表索引,所述主路径ARP表包括:主路径下一跳地址对应的MAC和主路径L3_INTF表索引,所述主路径L3_INTF表包括:本设备MAC。备路径NEXTHOP表包括:备路径出端口标识、备路径ARP表索引以及备路径SRV6_TUNNEL表索引,所述备路径ARP表包括:备路径下一跳地址对应的MAC和备路径L3_INTF表索引,所述备路径L3_INTF表包括:本设备MAC。主路径SRV6_TUNNEL表包括:主路径对应的公网SIDLIST(即SID0~SIDn),备路径SRV6_TUNNEL表包括:备路径对应的公网SIDLIST(即SID0~SIDn),其中,SIDLIST为段标识符列表,也即SID列表。Specifically, before receiving the target message, on the control plane: For PE equipment, SRV6 Policy can plan SRV6 Policy candidate paths through IGP protocol, BGP protocol and controller, or manually configure SRV6 Policy candidate paths (that is, including: SID list , egress port, next hop IP address, etc.); for each SRV6 Policy candidate path, a corresponding BFD session is configured. When multiple SRV6 Policy candidate paths are valid, the control plane will select two SRV6 Policy candidate paths according to priority. The primary path and backup path of the SRV6 HSB protection group. The control plane delivers BFD information to the BFD table in the Redis AppDB database. The control plane delivers SRV6 HSB information to the protection group table in the Redis AppDB database. The control plane delivers routing information to the routing collection table in the Redis AppDB database. On the forwarding plane: The forwarding plane subscribes to the BFD table in the database and records the BFD index (that is, the BFD session identifier) and BFD status. The forwarding plane subscribes to the protection group table in the database. The protection group table contains the primary and secondary path information, including: the next hop address of the primary and secondary paths, the egress port identifier, the sidlist (that is, the SID list), and the primary path BFD index. After obtaining the main path BFD index, record the index of the protection group table into the software table corresponding to BFD, and associate the protection group table with BFD information (BFD information includes: BFD session identifier and BFD status). It should be noted that when creating a protection group, the index of the protection group table is recorded in the BFD software table to determine which protection group a specific BFD session detects. When the BFD status changes, it can be directly notified Protection group, switch. The PE device pre-creates table entries on the public network side, and then creates table entries on the private network side, so that the private network side can obtain the public network next-hop group table index when creating table entries. Among them, the table items on the private network side include: routing table, private network next-hop table, and IP tunnel table. The table entries on the public network side include: public network next hop group table, NEXTHOP table, ARP table, L3_INTF table and SRV6_TUNNEL table. The routing table includes: IP address, instance identifier and private network next hop table index. The private network next hop table includes: IP tunnel table index and public network next hop group table index. The IP tunnel table includes :VPNSID and source IP address, the public network next hop group table includes: handover identification, main path next hop table index and backup path next hop table index, the NEXTHOP table includes: main path NEXTHOP table and backup path NEXTHOP table. The main path NEXTHOP table includes: the main path egress port identifier, the main path ARP table index, and the main path SRV6_TUNNEL table index. The main path ARP table includes: the MAC corresponding to the main path next hop address and the main path L3_INTF table index. , the main path L3_INTF table includes: MAC of this device. The backup path NEXTHOP table includes: the backup path egress port identifier, the backup path ARP table index, and the backup path SRV6_TUNNEL table index. The backup path ARP table includes: the MAC corresponding to the next hop address of the backup path and the backup path L3_INTF table index. The backup path L3_INTF table includes: MAC of this device. The main path SRV6_TUNNEL table includes: the public network SIDLIST (i.e., SID0~SIDn) corresponding to the main path, and the backup path SRV6_TUNNEL table includes: the public network SIDLIST (i.e., SID0~SIDn) corresponding to the backup path, where SIDLIST is the segment identifier list, also That is the SID list.

S120,根据所述目标IP地址和所述实例标识查询路由表,得到私网下一跳表。S120: Query the routing table according to the target IP address and the instance identifier to obtain a private network next hop table.

其中,所述路由表包括:IP地址、实例标识以及私网下一跳表索引。其中,所述路由表的创建方式可以为:获取与当前PE设备相关的路由集合,将路由集合中的每个路由的IP地址、实例标识、路由迭代到的公网标识、路由对应的保护组表索引、实例标识对应的VPNSID以及源IP地址存储至数据库中的路由集合表中,根据路由集合表中的每个路由的IP地址、实例标识、路由迭代到的公网标识、路由对应的保护组表索引、实例标识对应的VPNSID以及源IP地址生成至少一个路由表。Wherein, the routing table includes: IP address, instance identifier and private network next hop table index. The routing table may be created by: obtaining a routing set related to the current PE device, and adding the IP address, instance identifier, public network identifier of each route in the routing set, the public network identifier to which the route is iterated, and the protection group corresponding to the route. The table index, the VPNSID corresponding to the instance identifier, and the source IP address are stored in the routing collection table in the database. According to the IP address of each route in the routing collection table, the instance identifier, the public network identifier to which the route is iterated, and the protection corresponding to the route The group table index, the VPNSID corresponding to the instance identifier, and the source IP address generate at least one routing table.

具体的,根据所述目标IP地址和所述实例标识查询路由表,得到私网下一跳表的方式可以为:根据所述目标IP地址和所述实例标识查询路由表,得到私网下一跳表索引。Specifically, the method of querying the routing table according to the target IP address and the instance identifier to obtain the private network next hop table may be: querying the routing table according to the target IP address and the instance identifier to obtain the private network next hop table. Skip table index.

S130,查询私网下一跳表得到IP隧道表和目标公网下一跳组表。S130: Query the private network next hop table to obtain the IP tunnel table and the target public network next hop group table.

其中,所述私网下一跳表包括:IP隧道表索引和目标公网下一跳组表索引。所述私网下一跳表的创建方式可以为:获取与当前PE设备相关的路由集合,将路由集合中的每个路由的IP地址、实例标识、路由迭代到的公网标识、路由对应的保护组表索引、实例标识对应的VP NSID以及源IP地址存储至数据库中的路由集合表中,根据路由集合表中的每个路由对应的VPNSID以及源IP地址生成IP隧道表索引,根据路由集合表中的每个路由迭代到的公网标识和路由对应的保护组表索引确定目标公网下一跳组表索引。Wherein, the private network next hop table includes: IP tunnel table index and target public network next hop group table index. The private network next-hop table can be created by: obtaining a route set related to the current PE device, and adding the IP address, instance ID, public network ID of each route in the route set, the public network ID to which the route is iterated, and the corresponding IP address of the route. The protection group table index, the VP NSID corresponding to the instance ID, and the source IP address are stored in the routing collection table in the database. The IP tunnel table index is generated based on the VPNSID and source IP address corresponding to each route in the routing collection table. According to the routing collection The public network identifier that each route iterates to in the table and the protection group table index corresponding to the route determine the next hop group table index of the target public network.

具体的,查询私网下一跳表得到IP隧道表和目标公网下一跳组表的方式可以为:根据私网下一跳表索引查询私网下一跳表,得到IP隧道表索引和目标公网下一跳组表索引。Specifically, the method of querying the private network next hop table to obtain the IP tunnel table and the target public network next hop group table can be: query the private network next hop table according to the private network next hop table index, and obtain the IP tunnel table index and Target public network next hop group table index.

S140,查询IP隧道表,得到VPNSID和源IP地址。S140: Query the IP tunnel table to obtain the VPNSID and source IP address.

其中,所述IP隧道表包括:VPNSID和源IP地址。所述VPNSID为路由所在VPN实例对应的VPNSID。源IP地址为目标报文转发出去所带的源IP地址。Wherein, the IP tunnel table includes: VPNSID and source IP address. The VPNSID is the VPNSID corresponding to the VPN instance where the route is located. The source IP address is the source IP address carried by the destination packet when it is forwarded.

具体的,查询IP隧道表,得到VPNSID和源IP地址的方式可以为:根据IP隧道表索引查询IP隧道表,得到VPNSID和源IP地址。Specifically, the method of querying the IP tunnel table to obtain the VPNSID and source IP address may be: querying the IP tunnel table according to the IP tunnel table index to obtain the VPNSID and source IP address.

S150,查询目标公网下一跳组表,得到目标切换标识。S150: Query the next hop group table of the target public network to obtain the target switching identifier.

其中,所述目标公网下一跳组表包括:切换标识、主路径下一跳表索引和备路径下一跳表索引。所述切换标识可以为:switch开关,例如可以是,当目标切换标识为第一标识时,查询主路径下一跳表;当目标切换标识为第二标识时,查询备路径下一跳表。Wherein, the target public network next hop group table includes: a handover identification, a primary path next hop table index and a backup path next hop table index. The switch identifier may be a switch. For example, when the target switch identifier is the first identifier, the main path next hop table is queried; when the target switch identifier is the second identifier, the backup path next hop table is queried.

具体的,查询目标公网下一跳组表,得到目标切换标识的方式可以为:根据目标公网下一跳组表索引查询目标公网下一跳组表,得到目标切换标识。Specifically, the method of querying the next-hop group table of the target public network to obtain the target switching identifier may be: querying the next-hop group table of the target public network according to the index of the next-hop group table of the target public network to obtain the target switching identifier.

S160,根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文。S160: Update the target message according to the VPNSID, the source IP address and the target switching identifier to obtain an updated target message.

具体的,根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文的方式可以为:根据目标切换标识确定下一跳地址对应的MAC、本设备MAC地址、源IP地址、SIDn对应的IP地址、VPNSID、公网SIDLIST;根据下一跳地址对应的MAC、本设备MAC地址、源IP地址、SIDn对应的IP地址、VPNSID、公网SIDLIST对所述目标报文进行更新,得到更新后的目标报文,其中,SIDn为SIDLIST中的最外层SID,也代表PE下一跳设备对应的SID,作为目的IP封装在报文中;SIDn对应的IP地址为根据SIDLIST中SIDn确定的目的IP地址。Specifically, the target message is updated according to the VPNSID, the source IP address and the target switching identifier. The updated target message may be obtained by: determining the next hop address corresponding to the target switching identifier. MAC, the MAC address of this device, the source IP address, the IP address corresponding to SIDn, VPNSID, and public network SIDLIST; according to the MAC corresponding to the next hop address, the MAC address of this device, the source IP address, the IP address corresponding to SIDn, VPNSID, The public network SIDLIST updates the target message and obtains the updated target message. SIDn is the outermost SID in SIDLIST, which also represents the SID corresponding to the PE next-hop device. It is encapsulated in the message as the destination IP. Medium; the IP address corresponding to SIDn is the destination IP address determined based on SIDn in SIDLIST.

以L3VPN为例,对于某个VPN实例下的路由,进入PE设备的报文格式为:Taking L3VPN as an example, for a route under a certain VPN instance, the format of the packet entering the PE device is:

DMAC1 SMAC1 SIP1 DIP1 Payload;DMAC1 SMAC1 SIP1 DIP1 Payload;

当经过SRV6 Polciy出来后的报文格式为:The format of the packet after passing through SRV6 Polciy is:

DMAC2 SMAC2 SIP2 DIP2 VPNSID SID0 SID1…SID n SIP1DIP1 Payload;DMAC2 SMAC2 SIP2 DIP2 VPNSID SID0 SID1…SID n SIP1DIP1 Payload;

相比于入口报文,主要在报文外添加了IP地址、VPNSID、公网SIDLIST(即SID0~SIDn),并替换了MAC地址。Compared with the ingress packet, the IP address, VPNSID, and public network SIDLIST (i.e., SID0~SIDn) are mainly added to the packet, and the MAC address is replaced.

当工作在主路径时,报文从主路径出端口出来,DMAC2为主路径下一跳地址对应的MAC,可根据保护组表中的主路径下一跳地址获取。SMAC2为本设备MAC地址,可在本设备查到。DIP2为主路径SIDn对应的IP地址,SIP2为本设备配置的SRV6 Policy源IP地址。When working on the main path, packets come out from the egress port of the main path. The MAC corresponding to the next hop address of the main path in DMAC2 can be obtained based on the next hop address of the main path in the protection group table. SMAC2 is the MAC address of this device, which can be found on this device. DIP2 is the IP address corresponding to the main path SIDn, and SIP2 is the SRV6 Policy source IP address configured on this device.

上述信息都可以通过数据库的保护组表中的信息直接或者间接获取。The above information can be obtained directly or indirectly through the information in the protection group table of the database.

当工作在备路径时,报文从备路径出端口出来,DMAC2为备路径下一跳地址对应的MAC,可根据SRV6_HSB_TABLE表中的备路径下一跳地址获取。SMAC2为本设备MAC地址,可在本设备(接收到目标报文的PE设备)查到。DIP2为备路径SIDn对应的IP地址,SIP2为本机配置的SRV6 Policy源IP地址。When working on the backup path, the packet comes out from the egress port of the backup path. DMAC2 is the MAC corresponding to the next hop address of the backup path, which can be obtained according to the next hop address of the backup path in the SRV6_HSB_TABLE table. SMAC2 is the MAC address of this device, which can be found on this device (the PE device that received the target message). DIP2 is the IP address corresponding to SIDn of the backup path, and SIP2 is the SRV6 Policy source IP address configured on this machine.

VPNSID对应具体的某个VPN实例,不区分主备,在某条L3VPN路由进入SRV6转发流程前便已经确定。The VPNSID corresponds to a specific VPN instance, does not distinguish between active and standby, and is determined before a certain L3VPN route enters the SRV6 forwarding process.

S170,根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出。S170: Determine a target egress port according to the target switching identifier, and output the updated target message from the target egress port.

具体的,根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出的方式可以为:若所述目标切换标识为第一标识,则查询主路径下一跳表得到主路径出端口标识,将所述更新后的目标报文从所述主路径出端口标识对应的目标出端口输出;若所述目标切换标识为第二标识,则查询备路径下一跳表,得到备路径出端口标识,将所述更新后的目标报文从所述备路径出端口标识对应的目标出端口输出。Specifically, the target egress port is determined according to the target switching identifier, and the method of outputting the updated target message from the target egress port may be: if the target switching identifier is the first identifier, query the main path The next hop table obtains the main path egress port identifier, and outputs the updated target message from the target egress port corresponding to the main path egress port identifier; if the target switch identifier is the second identifier, query the backup path The next hop table is used to obtain the backup path egress port identifier, and the updated target message is output from the target egress port corresponding to the backup path egress port identifier.

可选的,在接收目标报文之前,还包括:Optionally, before receiving the target message, it also includes:

当订阅到数据库中的保护组表时,根据保护组表创建保护组表对应的公网下一跳组表,其中,所述公网下一跳组表包括:主路径下一跳表索引、备路径下一跳表索引以及切换标识。When subscribing to the protection group table in the database, a public network next-hop group table corresponding to the protection group table is created according to the protection group table. The public network next-hop group table includes: main path next-hop table index, The next hop table index and handover identification of the backup path.

需要说明的是,控制平面生成保护组表后,将保护组表存储至数据库。It should be noted that after the control plane generates the protection group table, it stores the protection group table in the database.

具体的,转发平面订阅数据库的变更,当转发平面订阅到数据库中的保护组表变更时,根据变更的保护组创建保护组对应的公网下一跳组表。Specifically, the forwarding plane subscribes to changes in the database. When the forwarding plane subscribes to changes in the protection group table in the database, it creates a public network next-hop group table corresponding to the protection group based on the changed protection group.

需要说明的是,预先创建保护组对应的公网下一跳组表,再根据保护组对应的公网下一跳组表创建私网侧的表项。It should be noted that the public network next-hop group table corresponding to the protection group is created in advance, and then the private network side entries are created based on the public network next-hop group table corresponding to the protection group.

转发平面可以通过订阅数据库变更的方式获取数据库中的保护组表和BFD表,其中,所述保护组表和BFD表为控制平面生成后存储至数据库中的表。控制平面和转发平面之间通过数据库交互,相较于传统的控制平面和转发平面之间通过消息接口交互,实现了控制平面和转发平面的解耦。The forwarding plane can obtain the protection group table and BFD table in the database by subscribing to database changes, where the protection group table and BFD table are tables that are stored in the database after being generated by the control plane. The control plane and the forwarding plane interact through the database. Compared with the traditional interaction between the control plane and the forwarding plane through the message interface, the control plane and the forwarding plane are decoupled.

可选的,在当订阅到数据库中的保护组表时,根据保护组表创建保护组表对应的公网下一跳组表之前,还包括:Optionally, before subscribing to the protection group table in the database and creating the public network next-hop group table corresponding to the protection group table based on the protection group table, the following is also included:

生成至少两条SRV6 Policy候选路径;Generate at least two SRV6 Policy candidate paths;

获取每条SRV6 Policy候选路径对应的BFD会话;Obtain the BFD session corresponding to each SRV6 Policy candidate path;

基于每条SRV6 Policy候选路径对应的BFD会话确定每条SRV6 Policy候选路径对应的BFD状态,将BFD状态和BFD会话标识存储至数据库的BFD表;Determine the BFD status corresponding to each SRV6 Policy candidate path based on the BFD session corresponding to each SRV6 Policy candidate path, and store the BFD status and BFD session ID in the BFD table of the database;

将BFD状态为第一状态的SRV6 Policy候选路径确定为有效候选路径;Determine the SRV6 Policy candidate path whose BFD status is the first state as a valid candidate path;

根据有效候选路径和有效候选路径的优先级确定主路径和备路径;Determine the main path and backup path according to the effective candidate path and the priority of the effective candidate path;

根据主路径和备路径生成保护组;Generate protection groups based on the primary path and backup path;

将所述保护组的主备信息存储至数据库的保护组表,其中,所述保护组的主备信息包括:保护组标识、主路径出端口标识、主路径下一跳地址、主路径SID列表、备路径出端口标识、备路径下一跳地址、备路径SID列表以及主路径BFD会话索引。Store the active and backup information of the protection group in the protection group table of the database, where the active and backup information of the protection group includes: protection group identification, main path egress port identification, main path next hop address, main path SID list , the backup path egress port identification, the backup path next hop address, the backup path SID list, and the main path BFD session index.

其中,所述保护组表包括:主备路径下一跳地址、出端口标识、sidlist(即SID列表),以及主路径BFD会话索引。在获取主路径BFD会话索引后,将保护组表的索引记录到BFD对应的软件表中,将保护组与BFD信息关联起来。The protection group table includes: the next hop address of the primary and secondary paths, the egress port identifier, the sidlist (ie, the SID list), and the BFD session index of the primary path. After obtaining the main path BFD session index, record the index of the protection group table into the software table corresponding to BFD, and associate the protection group with BFD information.

具体的,生成至少两条SRV6 Policy候选路径的方式可以为:通过静态配置或者通过协议动态生成至少两条SRV6 Policy候选路径。Specifically, the method of generating at least two SRV6 Policy candidate paths may be: static configuration or dynamically generating at least two SRV6 Policy candidate paths through a protocol.

其中,所述第一状态可以为UP状态,具体的,将BFD状态为UP的SRV6Policy候选路径确定为有效候选路径。The first state may be an UP state. Specifically, the SRV6Policy candidate path whose BFD state is UP is determined as a valid candidate path.

在一个具体的例子中,控制平面可通过静态配置或者通过协议动态生成的多个SRV6 Policy候选路径。针对每条SRV6 Policy候选路径可以配置SBFD会话,也可以配置BFD会话。SBFD会话或者BFD会话用于检测路径有效性。由于SBFD是BFD的一种,后续简称BFD;若某条SRV6 Policy候选路径的BFD状态为up,则将该SRV6 Policy候选路径确定为有效候选路径;根据路径优先级及路径有效性形成主路径和Hot-Standby路径(后续简称为备路径),优先级最高的有效候选路径为主路径,优先级次高的有效候选路径为备路径。如图2所示,当主路径和备路径都选出来以后,生成SRV6 HSB保护组,当有且仅有1条有效候选路径时,无法形成SRV6 HSB保护组,走单条路径转发。控制平面将BFD状态和BFD会话标识存储至数据库的BFD表,将所述保护组的主备信息存储至数据库的保护组表。转发平面订阅数据库的变更。In a specific example, the control plane can be statically configured or multiple SRV6 Policy candidate paths dynamically generated through the protocol. You can configure an SBFD session or a BFD session for each SRV6 Policy candidate path. SBFD session or BFD session is used to detect path validity. Since SBFD is a type of BFD, it will be referred to as BFD in the following; if the BFD status of a certain SRV6 Policy candidate path is up, the SRV6 Policy candidate path is determined to be a valid candidate path; the main path and path are formed based on the path priority and path validity. Hot-Standby path (hereinafter referred to as backup path for short), the valid candidate path with the highest priority is the primary path, and the valid candidate path with the second highest priority is the backup path. As shown in Figure 2, after both the primary path and the backup path are selected, an SRV6 HSB protection group is generated. When there is and is only one valid candidate path, the SRV6 HSB protection group cannot be formed and a single path is used for forwarding. The control plane stores the BFD status and BFD session identifier in the BFD table of the database, and stores the primary and backup information of the protection group in the protection group table of the database. The forwarding plane subscribes to changes in the database.

可选的,在当订阅到数据库中的保护组表时,根据保护组表创建保护组表对应的公网下一跳组表之后,还包括:Optionally, after subscribing to the protection group table in the database and creating the public network next-hop group table corresponding to the protection group table based on the protection group table, it also includes:

当订阅到数据库中的BFD表时,若根据BFD表确定BFD状态为第二状态,则获取与所述BFD表中携带的BFD会话标识对应的目标保护组;When subscribing to the BFD table in the database, if the BFD state is determined to be the second state according to the BFD table, obtain the target protection group corresponding to the BFD session identifier carried in the BFD table;

将所述目标保护组对应的公网下一跳组表中的切换标识更新为第二状态对应的切换标识。Update the handover identification in the public network next hop group table corresponding to the target protection group to the handover identification corresponding to the second state.

具体的,转发平面订阅数据库中的BFD表和保护组表。Specifically, the forwarding plane subscribes to the BFD table and protection group table in the database.

需要说明的是,在创建保护组表对应的公网下一跳组表之后,若订阅到数据库中的BFD表变更,且BFD表中的BFD状态为down,则查询BFD会话标识与保护组的对应关系,得到BFD状态为down的BFD会话对应的目标保护组,将目标保护组对应的公网下一跳组表中的切换标识更新为第二状态对应的切换标识。It should be noted that after creating the public network next hop group table corresponding to the protection group table, if the BFD table in the database is subscribed to change and the BFD status in the BFD table is down, query the BFD session ID and protection group. According to the corresponding relationship, the target protection group corresponding to the BFD session in the BFD state is down is obtained, and the handover identification in the public network next hop group table corresponding to the target protection group is updated to the handover identification corresponding to the second state.

在一个具体的例子中,当转发平面订阅到数据库中BFD信息变更后,会记录BFD会话标识和BFD状态等信息,数据库中的BFD表结构如下:In a specific example, when the forwarding plane subscribes to changes in the BFD information in the database, it will record information such as the BFD session ID and BFD status. The BFD table structure in the database is as follows:

说明:illustrate:

1、BFD_TABLE为AppDB表名称,100为BFD ID,用来表示具体某个BFD会话。1. BFD_TABLE is the name of the AppDB table, and 100 is the BFD ID, which is used to represent a specific BFD session.

2、state表示该BFD状态,可以为up或者down。2. State indicates the BFD status, which can be up or down.

保护组表结构如下:The structure of the protection group table is as follows:

说明:illustrate:

1、SRV6_HSB_TABLE为AppDB表名称,ab::2表示该表的key,是SRV6Policy的bind_sid,用于标识某一组SRV6 Policy HSB;1. SRV6_HSB_TABLE is the name of the AppDB table, ab::2 represents the key of the table, which is the bind_sid of SRV6Policy, used to identify a certain group of SRV6 Policy HSB;

2、ifname表示主路径出端口名称是ens40;2. ifname indicates that the main path egress port name is ens40;

3、nexthop表示主路径下一跳地址为40::73;3. nexthop indicates that the next hop address of the main path is 40::73;

4、sidlist即SID列表,表示主路径segment SID list为:4. sidlist is the SID list, indicating that the main path segment SID list is:

100:100::1100:0:0|200:200::2200:0:0,其中,“|”用于分隔多个SID。100:100::1100:0:0|200:200::2200:0:0, where "|" is used to separate multiple SIDs.

5、backup_ifname、backup_nexthop、backup_sidlist分别代表与主路径对应的备路径相关信息。5. backup_ifname, backup_nexthop, and backup_sidlist respectively represent the backup path-related information corresponding to the primary path.

7、bfd_id表示该保护组主路径BFD会话索引。7. bfd_id indicates the BFD session index of the protection group's main path.

当转发平面订阅到数据库中保护组表表更后,会根据主备路径信息创建保护组,同时根据保护组中的BFD会话索引将该保护组与BFD会话索引进行关联。When the forwarding plane subscribes to the protection group table in the database, it creates a protection group based on the primary and secondary path information, and associates the protection group with the BFD session index based on the BFD session index in the protection group.

对于迭代到SRV6 Policy HSB上的业务可以是L3VPN/L2VPN/EVPN(后续简称Overlay业务)中的一种或多种,对于不同种类以及不同规模的业务,当进行主备切换时,均不需要感知,大大提升了切换性能。本发明实施例以L3VPN迭代到SRV6 Policy HSB为例进行描述,实际应用中包括但不限于L3VPN、L2VPN、EVPN。The services iterated to the SRV6 Policy HSB can be one or more of L3VPN/L2VPN/EVPN (hereinafter referred to as Overlay services). For different types and different scales of services, no awareness is required when performing active/standby switching. , greatly improving switching performance. The embodiment of the present invention is described by taking L3VPN iteration to SRV6 Policy HSB as an example. Practical applications include but are not limited to L3VPN, L2VPN, and EVPN.

当根据BFD状态确定主路径出现故障时,控制平面将BFD状态(down)写入数据库中的BFD表,转发平面订阅BFD表,通过之前已记录的BFD会话索引与保护组的关联信息,可以快速进行路径切换,将业务切换到备路径转发。通过数据库直接通知转发平面的方式,减少了控制平面与转发平面之间的交互,缩短了切换时间。When it is determined that the main path fails based on the BFD status, the control plane writes the BFD status (down) to the BFD table in the database, and the forwarding plane subscribes to the BFD table. Through the previously recorded BFD session index and the association information of the protection group, it can quickly Perform path switching and switch services to the backup path for forwarding. Directly notifying the forwarding plane through the database reduces the interaction between the control plane and the forwarding plane and shortens the switching time.

当切换以后,如果存在多个候选路径可以形成新的主备关系时,会将新的路径信息更新至保护组,同时回切到主路径,该过程所有迭代到该SRV6 Policy HSB的Overlay业务也不需要感知。After the switchover, if there are multiple candidate paths that can form a new active-standby relationship, the new path information will be updated to the protection group, and at the same time it will switch back to the main path. In this process, all overlay services iterated to the SRV6 Policy HSB will also be updated. No perception is required.

可选的,还包括:Optional, also includes:

获取路由集合;Get the route collection;

将路由集合中的每个路由的IP地址、实例标识、路由迭代到的公网标识、路由对应的保护组表索引、实例标识对应的VPNSID以及源IP地址存储至数据库中的路由集合表;Store the IP address, instance ID, public network ID of the route iteration to, the protection group table index corresponding to the route, the VPNSID corresponding to the instance ID, and the source IP address of each route in the route set into the route set table in the database;

根据数据库中的路由集合表创建路由表、IP隧道表以及私网下一跳表。Create routing tables, IP tunnel tables, and private network next-hop tables based on the routing set table in the database.

其中,所述路由集合为与当前PE设备相关的路由集合。Wherein, the route set is a route set related to the current PE device.

具体的,根据数据库中的路由集合表创建路由表、IP隧道表以及私网下一跳表的方式可以为:根据VPNSID和源IP地址创建IP隧道表,根据IP隧道表的索引、路由对应的保护组表索引以及路由迭代到的公网标识创建私网下一跳表,根据私网下一跳表索引、IP地址以及实例标识创建路由表。Specifically, the routing table, IP tunnel table, and private network next-hop table can be created based on the route set table in the database by: creating an IP tunnel table based on the VPNSID and source IP address, and creating an IP tunnel table based on the index of the IP tunnel table and the corresponding route. Create a private network next-hop table based on the protection group table index and the public network identifier that the route iterates to, and create a routing table based on the private network next-hop table index, IP address, and instance identifier.

在一个具体的例子中,控制平面下发L3VPN信息至Redis AppDB数据库中的路由集合表,路由集合表的结构如下:In a specific example, the control plane delivers L3VPN information to the routing set table in the Redis AppDB database. The structure of the routing set table is as follows:

说明:illustrate:

1、ROUTE_TABLE为AppDB表名称,Vrf100:80::/64为该表的key,表示L3VPN实例为Vrf100,路由为80::/64;1. ROUTE_TABLE is the name of the AppDB table, and Vrf100:80::/64 is the key of the table, indicating that the L3VPN instance is Vrf100 and the route is 80::/64;

2、type表示该路由迭代到的公网是SRV6:HSB;2. Type indicates that the public network to which the route is iterated is SRV6:HSB;

3、srv6key表示该路由对应的公网srv6数据库表的key;3. srv6key represents the key of the public network srv6 database table corresponding to the route;

4、根据type及srv6key可以找的迭代是公网SRV6_HSB_TABLE:ab::2;4. The iteration that can be found based on type and srv6key is public network SRV6_HSB_TABLE:ab::2;

5、vpnsid表示该路由所在L3VPN实例对应vpnsid;5. vpnsid indicates the vpnsid corresponding to the L3VPN instance where the route is located;

6、sip为报文转发出去所带的源ip地址。6. SIP is the source IP address carried by the packet when it is forwarded.

可选的,根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文,包括:Optionally, update the target message according to the VPNSID, the source IP address and the target switching identifier to obtain an updated target message, including:

若所述目标切换标识为第一标识,则查询主路径下一跳表,得到主路径下一跳地址对应的MAC、本设备MAC以及主路径SID列表,根据所述VPNSID、所述源IP地址、所述主路径下一跳地址对应的MAC、所述本设备MAC以及所述主路径SID列表对所述目标报文进行更新,得到更新后的目标报文;If the target switching identifier is the first identifier, query the main path next hop table to obtain the MAC corresponding to the main path next hop address, the device MAC and the main path SID list. According to the VPNSID, the source IP address , update the target message with the MAC corresponding to the next hop address of the main path, the MAC of the local device and the main path SID list, and obtain the updated target message;

若所述目标切换标识为第二标识,则根据备路径下一跳表索引查询备路径下一跳表,得到备路径下一跳地址对应的MAC、本设备MAC以及备路径SID列表,根据所述VPNSID、所述源IP地址、所述备路径下一跳地址对应的MAC、所述本设备MAC以及所述备路径SID列表对所述目标报文进行更新,得到更新后的目标报文。If the target switching identifier is the second identifier, the backup path next hop table is queried according to the backup path next hop table index, and the MAC corresponding to the backup path next hop address, the device MAC and the backup path SID list are obtained. The VPNSID, the source IP address, the MAC corresponding to the next hop address of the backup path, the MAC of the local device, and the backup path SID list are used to update the target packet to obtain an updated target packet.

其中,目标报文格式为:DMAC1 SMAC1 SIP1 DIP1 Payload;Among them, the target message format is: DMAC1 SMAC1 SIP1 DIP1 Payload;

更新后的目标报文格式为:DMAC2 SMAC2 SIP2 DIP2 VPNSID SID0 SID1…SID nSIP1 DIP1 Payload。The updated target message format is: DMAC2 SMAC2 SIP2 DIP2 VPNSID SID0 SID1…SID nSIP1 DIP1 Payload.

具体的,若所述目标切换标识为第一标识,则查询主路径下一跳表,得到主路径出端口标识、主路径ARP表索引以及主路径SRV6_TUNNEL表索引,根据主路径ARP表索引查询主路径ARP表,得到主路径下一跳地址对应的MAC和主路径L3_INTF表索引,根据主路径L3_INTF表索引查询主路径L3_INTF表,得到本设备MAC,根据主路径SRV6_TUNNEL表索引查询主路径SRV6_TUNNEL表,得到主路径SID列表。Specifically, if the target switching identifier is the first identifier, query the main path next hop table to obtain the main path egress port identifier, the main path ARP table index and the main path SRV6_TUNNEL table index, and query the main path based on the main path ARP table index. Path ARP table, obtain the MAC corresponding to the next hop address of the main path and the main path L3_INTF table index. Query the main path L3_INTF table according to the main path L3_INTF table index to obtain the MAC of the device. Query the main path SRV6_TUNNEL table according to the main path SRV6_TUNNEL table index. Get the main path SID list.

具体的,若所述目标切换标识为第二标识,则查询备路径下一跳表,得到备路径出端口标识、备路径ARP表索引以及备路径SRV6_TUNNEL表索引,根据备路径ARP表索引查询备路径ARP表,得到备路径下一跳地址对应的MAC和备路径L3_INTF表索引,根据备路径L3_INTF表索引查询备路径L3_INTF表,得到本设备MAC,根据备路径SRV6_TUNNEL表索引查询备路径SRV6_TUNNEL表,得到备路径SID列表。Specifically, if the target switching identifier is the second identifier, the backup path next hop table is queried to obtain the backup path egress port identifier, the backup path ARP table index, and the backup path SRV6_TUNNEL table index, and the backup path is queried according to the backup path ARP table index. Path ARP table, obtain the MAC corresponding to the next hop address of the backup path and the backup path L3_INTF table index. Query the backup path L3_INTF table according to the backup path L3_INTF table index to obtain the MAC of the device. Query the backup path SRV6_TUNNEL table based on the backup path SRV6_TUNNEL table index. Get the backup path SID list.

可选的,根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出,包括:Optionally, determining a target egress port according to the target switching identifier, and outputting the updated target message from the target egress port includes:

若所述目标切换标识为第一标识,则查询主路径下一跳表,得到主路径出端口标识,将所述更新后的目标报文从所述主路径出端口标识对应的目标出端口输出;If the target switching identifier is the first identifier, query the main path next hop table to obtain the main path egress port identifier, and output the updated target message from the target egress port corresponding to the main path egress port identifier. ;

若所述目标切换标识为第二标识,则查询备路径下一跳表,得到备路径出端口标识,将所述更新后的目标报文从所述备路径出端口标识对应的目标出端口输出。If the target switching identifier is the second identifier, query the backup path next hop table to obtain the backup path egress port identifier, and output the updated target message from the target egress port corresponding to the backup path egress port identifier. .

其中,所述第一标识为将主路径确定为转发路径,所述第二标识为将转发路径切换到备路径。Wherein, the first identification is to determine the main path as the forwarding path, and the second identification is to switch the forwarding path to the backup path.

在一个具体的例子中,当从数据库中获取了BFD表、保护组表以及路由集合表之后,可以基于已经获取的表构建公网侧表项和私网侧表项。In a specific example, after the BFD table, protection group table, and route set table are obtained from the database, public network side table entries and private network side table entries can be constructed based on the obtained tables.

如图3所示,以L3VPN为例,私网侧可以是L3VPN也可以是EVPN/L2VPN。不管私网侧是何种类型业务,均可以通过保护组对应的公网下一跳组NHG表索引srv6_nhg_idx与公网侧相连。公网侧以及私网侧的信息发生变化,只需要保持NHG表的索引srv6_nhg_idx不变,便可以实现公私网的互不感知,达到公私网解耦的效果。As shown in Figure 3, taking L3VPN as an example, the private network side can be L3VPN or EVPN/L2VPN. Regardless of the type of service on the private network side, it can be connected to the public network side through the NHG table index srv6_nhg_idx of the public network next hop group corresponding to the protection group. If the information on the public network side and the private network side changes, you only need to keep the index srv6_nhg_idx of the NHG table unchanged, so that the public and private networks can be unaware of each other and achieve the effect of decoupling the public and private networks.

私网侧表项包括:ROUTE表,NEXTHOP表以及IP_TUNNEL表。ROUTE表用于查找L3VPN路由,路由信息通过数据库路由集合表的key获取。NEXTHOP表包括:ip_tunnel_idx字段及srv6_nhg_idx字段。ip_tunnel_idx字段用于索引IP_TUNNEL表,IP_TUNNEL表中填入了VPNSID以及sip。可以通过数据库路由集合表获取。srv6_nhg_idx用于与公网进行级联,为公网NHG表的索引,该表在公网侧创建,L3VPN通过SRV6_HSB_TABLE的key从公网侧创建的表项获取。Private network side table entries include: ROUTE table, NEXTHOP table and IP_TUNNEL table. The ROUTE table is used to find L3VPN routes, and routing information is obtained through the key of the database route collection table. The NEXTHOP table includes: ip_tunnel_idx field and srv6_nhg_idx field. The ip_tunnel_idx field is used to index the IP_TUNNEL table, which is filled with VPNSID and sip. It can be obtained through the database routing collection table. srv6_nhg_idx is used to cascade with the public network and is the index of the public network NHG table. This table is created on the public network side. L3VPN obtains it from the table entry created on the public network side through the key of SRV6_HSB_TABLE.

公网侧:在转发平面获取到主备路径信息以后,会创建主备路径以及保护组相关转发表项,公网侧表项主要有NHG(NEXTHOP GROUP)表、NEXTHOP表、ARP表、L3_INTF表以及SRV6_TUNNEL表。主路径与备路径的信息是对称的,分别填入主路径转发信息以及备路径转发信息;以主路径为例,NEXTHOP表中填入主路径出端口port字段,即图2中所示PE1至P1的出端口,arp_index用以索引ARP表,srv6_tunnel_idx用以索引SRV6_TUNNEL表;ARP表中填入dmac,也就是输出报文中的DMAC2,l3_intf_idx用以索引L3_INTF表;L3_INTF中填入smac,也就是输出报文中的SMAC2;SRV6_TUNNEL表中填入SIDLIST信息,SID0~SID n,SID n也就是输出报文中的DIP2;NHG中有主备两路NEXTHOP表的索引以及切换标识;BFD表中的状态用于指导NHG的工作路径,图3中,BFD状态是up,当前工作在主路径。Public network side: After the forwarding plane obtains the information about the primary and backup paths, it will create forwarding tables related to the primary and backup paths and protection groups. The public network side table entries mainly include NHG (NEXTHOP GROUP) table, NEXTHOP table, ARP table, and L3_INTF table. And the SRV6_TUNNEL table. The information of the main path and the backup path is symmetrical. The forwarding information of the main path and the forwarding information of the backup path are filled in respectively. Taking the main path as an example, the main path egress port port field is filled in the NEXTHOP table, that is, PE1 to PE1 shown in Figure 2. For the egress port of P1, arp_index is used to index the ARP table, srv6_tunnel_idx is used to index the SRV6_TUNNEL table; the ARP table is filled with dmac, which is the DMAC2 in the output message, l3_intf_idx is used to index the L3_INTF table; L3_INTF is filled with smac, that is, SMAC2 in the output message; fill in the SIDLIST information in the SRV6_TUNNEL table, SID0 ~ SID n, SID n is the DIP2 in the output message; NHG has the index of the NEXTHOP table and the switching identifier of the active and backup channels; the BFD table The status is used to guide the working path of NHG. In Figure 3, the BFD status is up, and it is currently working on the main path.

在上述转发模型中,需要先创建公网侧的表项,后创建私网侧的表项,便于私网侧在创建表项时可以获取到公网侧NHG表索引。In the above forwarding model, it is necessary to create table entries on the public network side first, and then create table entries on the private network side, so that the private network side can obtain the NHG table index on the public network side when creating table entries.

当控制平面BFD检测到主路径down时,会将数据库BFD表中的BFD状态置为down;如图4所示,转发平面订阅到BFD down,根据该BFD对应的保护组,通知该保护组进行切换,将转发路径切换到备路径,封装备路径的SIDLIST信息,备路径DIP2,备路径的SMAC2、DMAC2等信息,并从备路径的出端口转发出去。由于整个切换过程均是在NHG表以后进行,即使私网侧有大容量的Overlay业务迭代到SRV6 HSB,也可以做到私网侧的表项不需要感知,即切换一次即可完成,极大提升了切换性能,缩短了切换时间。当BFD检测周期配置为3*10ms时,可以实现<50ms的电信级切换。When control plane BFD detects that the main path is down, it will set the BFD status in the database BFD table to down. As shown in Figure 4, the forwarding plane subscribes to BFD down and notifies the protection group according to the protection group corresponding to the BFD. Switch, switch the forwarding path to the backup path, seal the SIDLIST information of the backup path, DIP2 of the backup path, SMAC2, DMAC2 and other information of the backup path, and forward them out from the egress port of the backup path. Since the entire handover process is performed after the NHG table, even if there are large-capacity overlay services on the private network side iterated to SRV6 HSB, the table entries on the private network side do not need to be sensed, that is, the handover can be completed once, which greatly Improved switching performance and shortened switching time. When the BFD detection period is configured as 3*10ms, carrier-grade switching of <50ms can be achieved.

可选的,还包括:Optional, also includes:

若根据SRV6 Policy候选路径对应的BFD状态确定目标保护组的主备信息变更,则根据变更后的主备信息对保护组表中的目标保护组的主备信息进行更新,并保持所述保护组表中的目标保护组的索引不变。If the active and backup information of the target protection group is determined to be changed based on the BFD status corresponding to the SRV6 Policy candidate path, update the active and backup information of the target protection group in the protection group table based on the changed active and backup information, and maintain the protection group. The index on the target protection group in the table is unchanged.

具体的,若根据目标保护组的公网下一跳组表中的切换标识确定路径A(主路径)故障,则切换至路径B(备路径),基于SRV6 Policy候选路径对应的BFD状态确定目标保护组的主备信息变更(发现路径C),也就是将路径B确定为主路径,路径C确定为备路径,对数据库的保护组表中的目标保护组的主备信息进行更新,并保持保护组表中的目标保护组的索引不变。Specifically, if it is determined that path A (main path) fails based on the switching identifier in the public network next hop group table of the target protection group, it will switch to path B (standby path), and the target will be determined based on the BFD status corresponding to the SRV6 Policy candidate path. The primary and secondary information of the protection group is changed (path C is discovered), that is, path B is determined as the primary path and path C is determined as the secondary path. The primary and secondary information of the target protection group in the protection group table of the database is updated and maintained. The index of the target protection group in the protection group table remains unchanged.

需要说明的是,当上述的保护组有新的有效主备路径时,控制平面生成新的保护组以后,会将新的主备信息写入数据库中的保护组表,转发平面订阅到数据库中的保护组表的变更,进行信息更新。对同一个保护组进行更新,数据库中保护组的key不变化,只需进行保护组内容的更新,即对主备路径上的表项内容进行更新,即图3的公网侧表项进行更新,私网侧不需要感知。It should be noted that when the above protection group has new effective active and backup paths, after the control plane generates a new protection group, it will write the new active and backup information into the protection group table in the database, and the forwarding plane will subscribe to the database. Update the information based on changes to the protection group table. When updating the same protection group, the key of the protection group in the database does not change. Only the content of the protection group needs to be updated, that is, the table entries on the primary and backup paths are updated, that is, the public network side table entries in Figure 3 are updated. , the private network side does not need to be aware.

通过本发明实施例公开的技术方案,控制平面跟转发平面不进行直接交互,通过订阅数据库,获取BFD表和保护组表,利用数据库存储清晰、准确、稳定的特点,减少了大量消息交互时存在的消息丢失、消息交互时间长、以及消息交互存在的可定位性差、可维护性差等问题;通过转发平面直接订阅BFD表,可以使转发平面快速感知BFD状态变化,减少了控制平面内部交互,实现了快速切换的目的;通过公私网解耦的设计,公私网更新互不影响,达到了主备路径切换私网不感知,保护组更新私网不感知的效果,能够提升切换性能,减少切换时间和CPU占用率。Through the technical solutions disclosed in the embodiments of the present invention, the control plane does not directly interact with the forwarding plane. By subscribing to the database, the BFD table and the protection group table are obtained, and the clear, accurate and stable characteristics of the database storage are used to reduce the problem of interacting with a large number of messages. Problems such as message loss, long message interaction time, and poor locability and maintainability of message interaction; directly subscribing to the BFD table through the forwarding plane can make the forwarding plane quickly sense BFD status changes, reduce internal interactions in the control plane, and achieve It achieves the purpose of fast switching; through the design of public and private network decoupling, public and private network updates do not affect each other, achieving the effect that the private network is not aware of the primary and backup path switching, and the private network is not aware of the protection group update, which can improve switching performance and reduce switching time. and CPU usage.

本实施例的技术方案,通过接收目标报文,根据目标报文包括的目标IP地址和实例标识查询路由表,得到私网下一跳表;查询私网下一跳表得到IP隧道表和目标公网下一跳组表;查询IP隧道表,得到VPNSID和源IP地址;查询目标公网下一跳组表,得到目标切换标识;根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文;根据所述目标切换标识确定目标出端口,能够解决消息丢失,消息交互时间长以及消息交互可定位性差、可维护性差等问题,由于目标公网下一跳组表包括目标切换标识,目标切换标识用于表征主备切换状态,因此,路径切换过程仅是针对公网侧,私网侧不感知,进而提升了路径切换性能,减少了路径切换时间和CPU占用率。The technical solution of this embodiment is to receive the target message, query the routing table according to the target IP address and instance identifier included in the target message, and obtain the private network next hop table; query the private network next hop table to obtain the IP tunnel table and target Public network next hop group table; query the IP tunnel table to obtain the VPNSID and source IP address; query the target public network next hop group table to obtain the target switching identifier; switch based on the VPNSID, the source IP address, and the target switching The target message is updated with the identifier to obtain the updated target message; the target egress port is determined based on the target switching identifier, which can solve problems such as message loss, long message interaction time, and poor message interaction locability and maintainability. , since the target public network next hop group table includes the target switching identifier, and the target switching identifier is used to represent the active and backup switching status. Therefore, the path switching process is only for the public network side, and the private network side is not aware of it, thus improving the path switching performance. , reducing path switching time and CPU usage.

实施例二Embodiment 2

图5为本发明实施例提供的一种报文转发装置的结构示意图。本实施例可适用于报文转发的情况,该装置可采用软件和/或硬件的方式实现,该装置可集成在任何提供报文转发功能的设备中,如图5所示,所述报文转发装置具体包括:目标报文接收模块210、路由表查询模块220、私网下一跳表查询模块230、IP隧道表查询模块240、目标公网下一跳组表查询模块250、目标报文更新模块260和报文输出模块270。Figure 5 is a schematic structural diagram of a message forwarding device provided by an embodiment of the present invention. This embodiment can be applied to the situation of message forwarding. The device can be implemented in the form of software and/or hardware. The device can be integrated in any device that provides the message forwarding function. As shown in Figure 5, the message The forwarding device specifically includes: a target message receiving module 210, a routing table query module 220, a private network next hop table query module 230, an IP tunnel table query module 240, a target public network next hop group table query module 250, and a target message Update module 260 and message output module 270.

其中,目标报文接收模块,用于接收目标报文,其中,所述目标报文包括:目标IP地址和实例标识;Wherein, the target message receiving module is used to receive the target message, wherein the target message includes: target IP address and instance identifier;

路由表查询模块,用于根据所述目标IP地址和所述实例标识查询路由表,得到私网下一跳表;A routing table query module is used to query the routing table according to the target IP address and the instance identifier to obtain the private network next hop table;

私网下一跳表查询模块,用于查询私网下一跳表得到IP隧道表和目标公网下一跳组表;The private network next-hop table query module is used to query the private network next-hop table to obtain the IP tunnel table and the target public network next-hop group table;

IP隧道表查询模块,用于查询IP隧道表,得到VPNSID和源IP地址;The IP tunnel table query module is used to query the IP tunnel table and obtain the VPNSID and source IP address;

目标公网下一跳组表查询模块,用于查询目标公网下一跳组表,得到目标切换标识;The target public network next-hop group table query module is used to query the target public network next-hop group table to obtain the target switching identification;

目标报文更新模块,用于根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文;A target message update module, configured to update the target message according to the VPNSID, the source IP address and the target switching identifier, and obtain an updated target message;

报文输出模块,用于根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出。A message output module, configured to determine a target egress port according to the target switching identifier, and output the updated target message from the target egress port.

上述产品可执行本发明任意实施例所提供的方法,具备执行方法相应的功能模块和有益效果。The above-mentioned products can execute the method provided by any embodiment of the present invention, and have corresponding functional modules and beneficial effects for executing the method.

实施例三Embodiment 3

图6示出了可以用来实施本发明的实施例的电子设备10的结构示意图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备(如头盔、眼镜、手表等)和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本发明的实现。FIG. 6 shows a schematic structural diagram of an electronic device 10 that can be used to implement embodiments of the present invention. Electronic devices are intended to refer to various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (eg, helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are examples only and are not intended to limit the implementation of the invention described and/or claimed herein.

如图6所示,电子设备10包括至少一个处理器11,以及与至少一个处理器11通信连接的存储器,如只读存储器(ROM)12、随机访问存储器(RAM)13等,其中,存储器存储有可被至少一个处理器执行的计算机程序,处理器11可以根据存储在只读存储器(ROM)12中的计算机程序或者从存储单元18加载到随机访问存储器(RAM)13中的计算机程序,来执行各种适当的动作和处理。在RAM 13中,还可存储电子设备10操作所需的各种程序和数据。处理器11、ROM 12以及RAM 13通过总线14彼此相连。输入/输出(I/O)接口15也连接至总线14。As shown in Figure 6, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores There is a computer program that can be executed by at least one processor. The processor 11 can perform the operation according to the computer program stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. Perform various appropriate actions and processing. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via the bus 14. An input/output (I/O) interface 15 is also connected to bus 14 .

电子设备10中的多个部件连接至I/O接口15,包括:输入单元16,例如键盘、鼠标等;输出单元17,例如各种类型的显示器、扬声器等;存储单元18,例如磁盘、光盘等;以及通信单元19,例如网卡、调制解调器、无线通信收发机等。通信单元19允许电子设备10通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Multiple components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc. etc.; and communication unit 19, such as network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices through computer networks such as the Internet and/or various telecommunications networks.

处理器11可以是各种具有处理和计算能力的通用和/或专用处理组件。处理器11的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的处理器、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。处理器11执行上文所描述的各个方法和处理,例如报文转发方法。Processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processing processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the message forwarding method.

在一些实施例中,报文转发方法可被实现为计算机程序,其被有形地包含于计算机可读存储介质,例如存储单元18。在一些实施例中,计算机程序的部分或者全部可以经由ROM 12和/或通信单元19而被载入和/或安装到电子设备10上。当计算机程序加载到RAM 13并由处理器11执行时,可以执行上文描述的报文转发方法的一个或多个步骤。备选地,在其他实施例中,处理器11可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行报文转发方法。In some embodiments, the message forwarding method may be implemented as a computer program, which is tangibly included in a computer-readable storage medium, such as the storage unit 18 . In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19 . When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the message forwarding method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the message forwarding method in any other suitable manner (eg, by means of firmware).

本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described above may be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip implemented in a system (SOC), load programmable logic device (CPLD), computer hardware, firmware, software, and/or a combination thereof. These various embodiments may include implementation in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor The processor, which may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device. An output device.

用于实施本发明的方法的计算机程序可以采用一个或多个编程语言的任何组合来编写。这些计算机程序可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器,使得计算机程序当由处理器执行时使流程图和/或框图中所规定的功能/操作被实施。计算机程序可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Computer programs for implementing the methods of the invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that the computer program, when executed by the processor, causes the functions/operations specified in the flowcharts and/or block diagrams to be implemented. A computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.

在本发明的上下文中,计算机可读存储介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的计算机程序。计算机可读存储介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。备选地,计算机可读存储介质可以是机器可读信号介质。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of this invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.

为了提供与用户的交互,可以在电子设备上实施此处描述的系统和技术,该电子设备具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给电子设备。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display)) for displaying information to the user monitor); and a keyboard and pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and may be provided in any form, including Acoustic input, voice input or tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)、区块链网络和互联网。The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., A user's computer having a graphical user interface or web browser through which the user can interact with implementations of the systems and technologies described herein), or including such backend components, middleware components, or any combination of front-end components in a computing system. The components of the system may be interconnected by any form or medium of digital data communication (eg, a communications network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.

计算系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务中,存在的管理难度大,业务扩展性弱的缺陷。Computing systems may include clients and servers. Clients and servers are generally remote from each other and typically interact over a communications network. The relationship of client and server is created by computer programs running on corresponding computers and having a client-server relationship with each other. The server can be a cloud server, also known as cloud computing server or cloud host. It is a host product in the cloud computing service system to solve the problems of difficult management and weak business scalability in traditional physical hosts and VPS services. defect.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发明中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本发明的技术方案所期望的结果,本文在此不进行限制。It should be understood that various forms of the process shown above may be used, with steps reordered, added or deleted. For example, each step described in the present invention can be executed in parallel, sequentially, or in different orders. As long as the desired results of the technical solution of the present invention can be achieved, there is no limitation here.

上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the scope of the present invention. It will be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions are possible depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.

Claims (11)

1.一种报文转发方法,其特征在于,由网络侧边缘设备执行,所述报文转发方法包括:1. A message forwarding method, characterized in that it is executed by a network-side edge device. The message forwarding method includes: 接收目标报文,其中,所述目标报文包括:目标IP地址和实例标识;Receive a target message, where the target message includes: a target IP address and an instance identifier; 根据所述目标IP地址和所述实例标识查询路由表,得到私网下一跳表;Query the routing table according to the target IP address and the instance identifier to obtain the private network next hop table; 查询私网下一跳表得到IP隧道表和目标公网下一跳组表;Query the private network next-hop table to obtain the IP tunnel table and target public network next-hop group table; 查询IP隧道表,得到VPNSID和源IP地址;Query the IP tunnel table to obtain the VPNSID and source IP address; 查询目标公网下一跳组表,得到目标切换标识;Query the next hop group table of the target public network to obtain the target switching identifier; 根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文;Update the target message according to the VPNSID, the source IP address and the target switching identifier to obtain an updated target message; 根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出。Determine a target egress port according to the target switching identifier, and output the updated target message from the target egress port. 2.根据权利要求1所述的方法,其特征在于,根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文,包括:2. The method according to claim 1, characterized in that, the target message is updated according to the VPNSID, the source IP address and the target switching identifier to obtain an updated target message, including: 若所述目标切换标识为第一标识,则查询主路径下一跳表,得到主路径下一跳地址对应的MAC、本设备MAC以及主路径SID列表,根据所述VPNSID、所述源IP地址、所述主路径下一跳地址对应的MAC、所述本设备MAC以及所述主路径SID列表对所述目标报文进行更新,得到更新后的目标报文;If the target switching identifier is the first identifier, query the main path next hop table to obtain the MAC corresponding to the main path next hop address, the device MAC and the main path SID list. According to the VPNSID, the source IP address , update the target message with the MAC corresponding to the next hop address of the main path, the MAC of the local device and the main path SID list, and obtain the updated target message; 若所述目标切换标识为第二标识,则根据备路径下一跳表索引查询备路径下一跳表,得到备路径下一跳地址对应的MAC、本设备MAC以及备路径SID列表,根据所述VPNSID、所述源IP地址、所述备路径下一跳地址对应的MAC、所述本设备MAC以及所述备路径SID列表对所述目标报文进行更新,得到更新后的目标报文。If the target switching identifier is the second identifier, the backup path next hop table is queried according to the backup path next hop table index, and the MAC corresponding to the backup path next hop address, the device MAC and the backup path SID list are obtained. The VPNSID, the source IP address, the MAC corresponding to the next hop address of the backup path, the MAC of the local device, and the backup path SID list are used to update the target packet to obtain an updated target packet. 3.根据权利要求1所述的方法,其特征在于,根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出,包括:3. The method according to claim 1, characterized in that determining a target egress port according to the target switching identifier, and outputting the updated target message from the target egress port includes: 若所述目标切换标识为第一标识,则查询主路径下一跳表,得到主路径出端口标识,将所述更新后的目标报文从所述主路径出端口标识对应的目标出端口输出;If the target switching identifier is the first identifier, query the main path next hop table to obtain the main path egress port identifier, and output the updated target message from the target egress port corresponding to the main path egress port identifier. ; 若所述目标切换标识为第二标识,则查询备路径下一跳表,得到备路径出端口标识,将所述更新后的目标报文从所述备路径出端口标识对应的目标出端口输出。If the target switching identifier is the second identifier, query the backup path next hop table to obtain the backup path egress port identifier, and output the updated target message from the target egress port corresponding to the backup path egress port identifier. . 4.根据权利要求1所述的方法,其特征在于,在接收目标报文之前,还包括:4. The method according to claim 1, characterized in that, before receiving the target message, it further includes: 当订阅到数据库中的保护组表时,根据保护组表创建保护组表对应的公网下一跳组表,其中,所述公网下一跳组表包括:主路径下一跳表索引、备路径下一跳表索引以及切换标识。When subscribing to the protection group table in the database, a public network next-hop group table corresponding to the protection group table is created according to the protection group table. The public network next-hop group table includes: main path next-hop table index, The next hop table index and handover identification of the backup path. 5.根据权利要求4所述的方法,其特征在于,在当订阅到数据库中的保护组表时,根据保护组表创建保护组表对应的公网下一跳组表之前,还包括:5. The method according to claim 4, characterized in that, before subscribing to the protection group table in the database and before creating the public network next hop group table corresponding to the protection group table according to the protection group table, it also includes: 生成至少两条SRV6 Policy候选路径;Generate at least two SRV6 Policy candidate paths; 获取每条SRV6 Policy候选路径对应的BFD会话;Obtain the BFD session corresponding to each SRV6 Policy candidate path; 基于每条SRV6 Policy候选路径对应的BFD会话确定每条SRV6 Policy候选路径对应的BFD状态,将BFD状态和BFD会话标识存储至数据库的BFD表;Determine the BFD status corresponding to each SRV6 Policy candidate path based on the BFD session corresponding to each SRV6 Policy candidate path, and store the BFD status and BFD session ID in the BFD table of the database; 将BFD状态为第一状态的SRV6 Policy候选路径确定为有效候选路径;Determine the SRV6 Policy candidate path whose BFD status is the first state as a valid candidate path; 根据有效候选路径和有效候选路径的优先级确定主路径和备路径;Determine the main path and backup path according to the effective candidate path and the priority of the effective candidate path; 根据主路径和备路径生成保护组;Generate protection groups based on the primary path and backup path; 将所述保护组的主备信息存储至数据库的保护组表,其中,所述保护组的主备信息包括:保护组标识、主路径出端口标识、主路径下一跳地址、主路径SID列表、备路径出端口标识、备路径下一跳地址、备路径SID列表以及主路径BFD会话索引。Store the active and backup information of the protection group in the protection group table of the database, where the active and backup information of the protection group includes: protection group identification, main path egress port identification, main path next hop address, main path SID list , the backup path egress port identification, the backup path next hop address, the backup path SID list, and the main path BFD session index. 6.根据权利要求5所述的方法,其特征在于,在当订阅到数据库中的保护组表时,根据保护组表创建保护组表对应的公网下一跳组表之后,还包括:6. The method according to claim 5, characterized in that, after subscribing to the protection group table in the database and creating the public network next hop group table corresponding to the protection group table according to the protection group table, it also includes: 当订阅到数据库中的BFD表时,若根据BFD表确定BFD状态为第二状态,则获取与所述BFD表中携带的BFD会话标识对应的目标保护组;When subscribing to the BFD table in the database, if the BFD state is determined to be the second state according to the BFD table, obtain the target protection group corresponding to the BFD session identifier carried in the BFD table; 将所述目标保护组对应的公网下一跳组表中的切换标识更新为第二状态对应的切换标识。Update the handover identification in the public network next hop group table corresponding to the target protection group to the handover identification corresponding to the second state. 7.根据权利要求5所述的方法,其特征在于,还包括:7. The method of claim 5, further comprising: 获取路由集合;Get the route collection; 将路由集合中的每个路由的IP地址、实例标识、路由迭代到的公网标识、路由对应的保护组表索引、实例标识对应的VPNSID以及源IP地址存储至数据库中的路由集合表;Store the IP address, instance ID, public network ID of the route iteration to, the protection group table index corresponding to the route, the VPNSID corresponding to the instance ID, and the source IP address of each route in the route set into the route set table in the database; 根据数据库中的路由集合表创建路由表、IP隧道表以及私网下一跳表。Create routing tables, IP tunnel tables, and private network next-hop tables based on the routing set table in the database. 8.根据权利要求1所述的方法,其特征在于,还包括:8. The method of claim 1, further comprising: 若根据SRV6 Policy候选路径对应的BFD状态确定目标保护组的主备信息变更,则根据变更后的主备信息对保护组表中的目标保护组的主备信息进行更新,并保持所述保护组表中的目标保护组的索引不变。If the active and backup information of the target protection group is determined to be changed based on the BFD status corresponding to the SRV6 Policy candidate path, update the active and backup information of the target protection group in the protection group table based on the changed active and backup information, and maintain the protection group. The index on the target protection group in the table is unchanged. 9.一种报文转发装置,其特征在于,配置在网络侧边缘设备中,所述报文转发装置包括:9. A message forwarding device, characterized in that it is configured in a network-side edge device, and the message forwarding device includes: 目标报文接收模块,用于接收目标报文,其中,所述目标报文包括:目标IP地址和实例标识;A target message receiving module, configured to receive a target message, where the target message includes: a target IP address and an instance identifier; 路由表查询模块,用于根据所述目标IP地址和所述实例标识查询路由表,得到私网下一跳表;A routing table query module is used to query the routing table according to the target IP address and the instance identifier to obtain the private network next hop table; 私网下一跳表查询模块,用于查询私网下一跳表得到IP隧道表和目标公网下一跳组表;The private network next-hop table query module is used to query the private network next-hop table to obtain the IP tunnel table and the target public network next-hop group table; IP隧道表查询模块,用于查询IP隧道表,得到VPNSID和源IP地址;The IP tunnel table query module is used to query the IP tunnel table and obtain the VPNSID and source IP address; 目标公网下一跳组表查询模块,用于查询目标公网下一跳组表,得到目标切换标识;The target public network next-hop group table query module is used to query the target public network next-hop group table to obtain the target switching identification; 目标报文更新模块,用于根据所述VPNSID、所述源IP地址以及所述目标切换标识对所述目标报文进行更新,得到更新后的目标报文;A target message update module, configured to update the target message according to the VPNSID, the source IP address and the target switching identifier, and obtain an updated target message; 报文输出模块,用于根据所述目标切换标识确定目标出端口,将所述更新后的目标报文从所述目标出端口输出。A message output module, configured to determine a target egress port according to the target switching identifier, and output the updated target message from the target egress port. 10.一种电子设备,其特征在于,所述电子设备包括:10. An electronic device, characterized in that the electronic device includes: 至少一个处理器;以及at least one processor; and 与所述至少一个处理器通信连接的存储器;其中,a memory communicatively connected to the at least one processor; wherein, 所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-8中任一项所述的报文转发方法。The memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor, so that the at least one processor can execute any one of claims 1-8 Described message forwarding method. 11.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,所述计算机指令用于使处理器执行时实现权利要求1-8中任一项所述的报文转发方法。11. A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the method of any one of claims 1-8 when executed by a processor. Message forwarding method.
CN202311445360.8A 2023-11-01 2023-11-01 A message forwarding method, device, equipment and storage medium Pending CN117499295A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311445360.8A CN117499295A (en) 2023-11-01 2023-11-01 A message forwarding method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311445360.8A CN117499295A (en) 2023-11-01 2023-11-01 A message forwarding method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117499295A true CN117499295A (en) 2024-02-02

Family

ID=89666991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311445360.8A Pending CN117499295A (en) 2023-11-01 2023-11-01 A message forwarding method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117499295A (en)

Similar Documents

Publication Publication Date Title
US11611509B2 (en) Communication method, communications device, and communications system
CN112491636B (en) Data processing method and device and computer storage medium
CN113132229B (en) Segment identifier determination method and device
CN105009523A (en) Method and apparatus for IP/MPLS fast reroute
US12034631B2 (en) Loop avoidance communications method, device, and system
CN113542128B (en) Method and device for sending routing information
CN111937355B (en) Establishing virtual network routing in a computer network
US7715395B2 (en) System and method for expanding the range of a mesh network
WO2021077971A1 (en) Communication method and device
US20230353479A1 (en) Edge Computing Data and Service Discovery Using an Interior Gateway Protocol (IGP)
US20230015922A1 (en) Mac address sending method, apparatus, and system, and related device
CN115225634B (en) Data forwarding method, device and computer program product under virtual network
CN106302076A (en) Set up the method in VXLAN tunnel, system and SDN controller
US20230006917A1 (en) Route Determining Method and Apparatus and Network Device
CN103139068B (en) The method E-Packeted, router and system
CN110380966B (en) Method for discovering forwarding path and related equipment thereof
CN112866107B (en) IP address notification method, traffic guidance method and network equipment
WO2022257773A1 (en) Routing detection method, device, system, and storage medium
CN117499295A (en) A message forwarding method, device, equipment and storage medium
CN116016448A (en) Service network access method, device, equipment and storage medium
US11398970B2 (en) Internet last-mile outage detection using IP-route clustering
CN115865844A (en) SDN and NDN-based virtual and real combined dynamic traffic scheduling method and device
CN112583720B (en) Inter-autonomous system traceroute messages
CN114338277A (en) Method, device, equipment and readable medium for protecting VPN (virtual private network) network node in Anycast scene
CN111988221A (en) Data transmission method, data transmission device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: No. 9 Mozhou East Road, Nanjing City, Jiangsu Province, 211111

Applicant after: Zijinshan Laboratory

Address before: No. 9 Mozhou East Road, Jiangning Economic Development Zone, Jiangning District, Nanjing City, Jiangsu Province

Applicant before: Purple Mountain Laboratories

Country or region before: China