Data packet processing method, device, central node and storage medium

By adding outbound interface matching information to the security policy, it ensures that the central node can find the correct forwarding path of data packets, solves the problem of data packet forwarding errors in the network, and achieves safe and accurate forwarding of data packets.

CN115941290BActive Publication Date: 2024-09-17MAIPU COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211429427.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-15
Publication Date
2024-09-17
Estimated Expiration
2042-11-15

AI Technical Summary

Technical Problem

In the network, when the central node faces a large number of branch nodes, how to ensure the safe processing and correct forwarding of IP data packets is a challenge. In the existing technology, security policies are bound to IPSec tunnels, but there is no guarantee that data packets are forwarded through the correct tunnel. leading to possible transmission errors.

Method used

Add outbound interface matching information to the security policy, search the routing table to determine the outbound interface through the destination IP address of the data packet, ensure that the target security policy that matches the forwarded data packet is found, and transmit it through the IPSec tunnel of the policy.

Benefits of technology

When a candidate security policy exists, the only matching target security policy is found to ensure that data packets are forwarded to the destination through the correct IPSec tunnel to avoid incorrect transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115941290B
    Figure CN115941290B
Patent Text Reader

Abstract

The present invention provides a data packet processing method, device, central node and storage medium. After receiving a data packet to be forwarded, the central node determines the corresponding forwarding interface. If there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded, a target security policy whose outgoing interface matching information matches the forwarding interface is found from all candidate security policies. Finally, the data packet to be forwarded is processed using the IPSec SA corresponding to the target security policy and then transmitted through the IPSec tunnel corresponding to the target security policy. In this scheme, the security policy includes the outgoing interface matching information, which enables the target security policy whose outgoing interface matching information uniquely matches the forwarding interface to be found when a candidate security policy exists, ensuring that the data packet to be forwarded can be processed using the IPSec SA corresponding to the target security policy and then correctly forwarded through the corresponding IPSec tunnel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a data packet processing method, device, central node and storage medium. Background Art

[0002] IPSec (Internet Protocol Security) is a collection of protocols and services that provide security for IP networks. It is a commonly used technology in VPN (Virtual Private Network). Since IP messages themselves do not integrate any security features, IP data packets may be at risk of being forged, stolen, or tampered with when transmitted in public networks such as the Internet. When the communicating parties establish an IPSec tunnel through IPSec and negotiate the IPsec SA (Internet Protocol Security Security Association) corresponding to the IPSec tunnel, IP data packets are encrypted and transmitted through the IPSec tunnel, which can effectively ensure the security of data transmission in an insecure network environment. IPsec SA includes some information used by the communicating parties when encrypting and transmitting data. One of the communicating parties can configure a security policy to limit the data stream that needs to be protected, and bind the IPSec tunnel corresponding to the data stream that needs to be protected.

[0003] For a central node in a network, when the central node is faced with establishing IPSec tunnels with a large number of branch nodes, how to securely process and correctly forward IP data packets that need to be protected is a problem that needs to be solved. Summary of the invention

[0004] The purpose of the present invention is to provide a data packet processing method, device, central node and storage medium to improve the problems existing in the prior art.

[0005] The embodiments of the present invention can be implemented as follows:

[0006] In a first aspect, the present invention provides a data packet processing method, which is applied to a central node, wherein the central node includes multiple outbound interfaces, the central node is connected to a branch node through one of the outbound interfaces, and an IPSec tunnel is established between the central node and each of the branch nodes; the central node stores a security policy and an IPSec SA corresponding to each of the IPSec tunnels, the security policy includes global five-tuple matching information and outbound interface matching information; the method includes:

[0007] Receive a data packet to be forwarded, and determine a forwarding interface corresponding to the data packet to be forwarded;

[0008] If there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded, then determine a target security policy whose outbound interface matching information matches the forwarding outbound interface from all the candidate security policies;

[0009] The data packet to be forwarded is processed using the IPSec SA corresponding to the target security policy, and the processed data packet to be forwarded is transmitted through the IPSec tunnel corresponding to the target security policy.

[0010] In an optional embodiment, the method further comprises:

[0011] If the candidate security policy does not exist, the data packet to be forwarded is directly forwarded.

[0012] In an optional implementation manner, the central node maintains a local routing table, and the local routing table includes a correspondence between a destination address and an outbound interface;

[0013] The step of determining the forwarding outgoing interface corresponding to the data packet to be forwarded comprises:

[0014] Obtaining the destination IP address of the data packet to be forwarded;

[0015] According to the destination IP address of the data packet to be forwarded, the forwarding outgoing interface is found from the local routing table.

[0016] In an optional implementation manner, the central node maintains a local routing table, and the local routing table includes a correspondence between a next hop address and an outbound interface;

[0017] The central node obtains the IPSec SA in a manner including:

[0018] For each branch node, establish the IPSec tunnel between the branch node and the branch node, and obtain the IPSec SA corresponding to the IPSec tunnel;

[0019] The central node obtains the security policy in the following manner:

[0020] For each branch node, according to the IP address of the branch node, find out the outbound interface corresponding to the branch node from the local routing table;

[0021] Generate outbound interface matching information of the outbound interface, and obtain a security policy corresponding to the IPSec tunnel associated with the branch node;

[0022] The security policy includes global five-tuple matching information and the outbound interface matching information, and the global five-tuple matching information is obtained in response to a configuration operation of a user.

[0023] In an optional embodiment, the method further comprises:

[0024] After obtaining the IPSec SA corresponding to any of the IPSec tunnels, updating the security policy corresponding to the IPSec tunnel; or,

[0025] The security policy corresponding to each IPSec tunnel is updated according to a predetermined period.

[0026] In an optional implementation manner, the step of updating the security policy corresponding to each of the IPSec tunnels includes:

[0027] According to the IP address of the central node and the IP address of each branch node, searching the outbound interface corresponding to each branch node from the local routing table;

[0028] For each of the branch nodes, if the outbound interface corresponding to the branch node does not match the outbound interface matching information in the security policy associated with the branch node, the security policy is updated using the outbound interface corresponding to the branch node.

[0029] In an optional implementation manner, the IPSec SA further includes an encryption key and a key lifetime of the encryption key; and the method further includes:

[0030] When it is detected that the key lifetime in the IPSec SA corresponding to any one of the IPSec tunnels has expired, the branch node associated with the IPSec tunnel renegotiates to obtain a new IPSec SA, and updates the security policy corresponding to the IPSec tunnel.

[0031] In a second aspect, the present invention provides a data packet processing device, which is applied to a central node, wherein the central node includes multiple outbound interfaces, the central node is connected to a branch node through one of the outbound interfaces, and an IPSec tunnel is established between the central node and each of the branch nodes; the central node stores a security policy and an IPSec SA corresponding to each of the IPSec tunnels, wherein the security policy includes global five-tuple matching information and outbound interface matching information; the device includes:

[0032] A search module, used for receiving a data packet to be forwarded, and determining a forwarding interface corresponding to the data packet to be forwarded;

[0033] The search module is further used to determine, from all the candidate security policies, a target security policy whose outbound interface matching information matches the forwarding outbound interface if there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded;

[0034] The processing module is used to process the data packet to be forwarded by using the IPSec SA corresponding to the target security policy, and transmit the processed data packet to be forwarded through the IPSec tunnel corresponding to the target security policy.

[0035] In a third aspect, the present invention provides a central node, comprising: a memory and a processor, wherein the memory stores machine-readable instructions executable by the processor, and when the central node is running, the processor executes the machine-readable instructions to implement a data packet processing method as described in any one of the aforementioned embodiments.

[0036] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data packet processing method described in any one of the aforementioned embodiments is implemented.

[0037] Compared with the prior art, the embodiment of the present invention provides a data packet processing method, device, central node and storage medium, wherein the central node receives the data packet to be forwarded and determines its corresponding forwarding outbound interface. If there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded, then a target security policy whose outbound interface matching information matches the forwarding outbound interface is found from all candidate security policies. The data packet to be forwarded is processed using the IPSec SA corresponding to the target security policy and then transmitted through the IPSec tunnel corresponding to the target security policy. Its beneficial effect is that the security policy in this scheme includes the outbound interface matching information, which can ensure that when there is a candidate security policy, the target security policy whose outbound interface matching information uniquely matches the forwarding outbound interface can be found, further ensuring that the data packet to be forwarded can be processed using the IPSec SA corresponding to the target security policy and then correctly forwarded through the corresponding IPSec tunnel. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0039] Figure 1One of the application scenario schematic diagrams provided by an embodiment of the present invention.

[0040] Figure 2 One of the flow charts of a data packet processing method provided in an embodiment of the present invention.

[0041] Figure 3 The present invention provides a second flowchart of a method for processing data packets according to an embodiment of the present invention.

[0042] Figure 4 The present invention provides a second application scenario diagram of an embodiment of the present invention.

[0043] Figure 5 A schematic diagram of the structure of a data packet processing device provided by an embodiment of the present invention.

[0044] Figure 6 A schematic diagram of the structure of a central node provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0046] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0048] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0049] When the central node in the network faces a large number of branch nodes that need to establish IPSEC tunnels with them, if the central node configures the corresponding flow of interest for each branch node, and then each IPSEC tunnel associated with the branch node corresponds to its own security policy, the large number of branch nodes will make the configuration work extremely cumbersome.

[0050] If a classification method is adopted to group data flows with the same security processing method together and separate data flows with different security processing methods, it is necessary to arrange data with the same security processing method in close network segments as much as possible when networking in advance, and then configure the flow of interest for the branch node of this network segment to obtain the corresponding security policy. Although this method adaptively reduces the configuration work, it adds an additional burden on the networking work.

[0051] Therefore, for the convenience of management, another processing method in the prior art is to pre-configure a unified flow of interest at the central node (the traffic that needs to be transmitted through the IPSec tunnel is usually called an "interest flow"). After completing the negotiation of the IPSec tunnel and the IPSec SA, for any IPSec tunnel associated with a branch node, the unified flow of interest will be referenced in the security policy of the IPSec tunnel and bound to the IPSec tunnel.

[0052] When the central node receives an IP data packet, it will match the corresponding security policy. Since all security policies in the prior art refer to the same flow of interest, the IP data packet matches each security policy. The prior art will directly use the first security policy that matches as the security policy to be used for the IP data packet.

[0053] If the first security policy happens to be the security policy of the IPSec tunnel associated with the next hop node of the IP data packet, then the IP data packet can be correctly forwarded to the next hop node after encryption and encapsulation, so that the IP data packet can be correctly sent to the destination.

[0054] However, there is a high probability that the first security policy is not the security policy of the IPSec tunnel associated with the next-hop node of the IP data packet. In this case, after the IP data packet is encrypted and encapsulated, it will be sent to the wrong next-hop node through the wrong IPSec tunnel, causing the IP data packet to be transmitted incorrectly in the network and be discarded.

[0055] Based on the discovery of the above technical problems, the inventors have proposed the following technical solutions to solve or improve the above problems through creative work. It should be noted that the defects in the solutions in the above prior art are the results obtained by the inventors after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed in the embodiments of the present application for the above problems below should all be the contributions made by the inventors to the present application in the process of invention and creation, and should not be understood as technical contents known to those skilled in the art.

[0056] The inventor has found through long-term observation and research that in the above-described process, it is precisely because the security policy only binds the IPSec tunnel, and then the IPSec tunnel is associated with the branch node. After the IP data packet matches the first security policy, it is completely impossible to guarantee that the IP data packet can be correctly forwarded according to its own forwarding path. Therefore, if you want to ensure that the IP data packet can be sent to the correct next-hop branch node, you must ensure that the IPSec tunnel bound in the security policy that the IP data packet matches is associated with the correct next-hop branch node.

[0057] Using the destination IP address of the IP data packet, the routing table can be searched to find the outbound interface of the IP data packet (the outbound interface can correspond to its correct next-hop branch node). As long as the first security policy contains the information of the outbound interface, it can be guaranteed that the first security policy is exactly the security policy of the IPSec tunnel associated with the next-hop node of the IP data packet, thereby achieving correct forwarding of the IP data packet.

[0058] In view of this, an embodiment of the present invention provides a data packet processing method, which adds outbound interface matching information to a security policy, so that when there is a candidate security policy, a target security policy whose outbound interface matching information uniquely matches the forwarding outbound interface can be found, thereby ensuring that the data packet to be forwarded can be processed using the IPSec SA corresponding to the target security policy and then correctly forwarded through the corresponding IPSec tunnel. The following is a detailed description through an embodiment and in conjunction with the attached drawings.

[0059] Here, we first introduce the application scenarios of this solution. Figure 1 , Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present invention. In the Internet network, an IPSec tunnel is established between the central node and each branch node, for example, an IPSec tunnel 1 is established between the central node and branch node 1, an IPSec tunnel 2 is established between the central node and branch node 2, and an IPSec tunnel n is established between the central node and branch node n.

[0060] The central node and each branch node can encrypt and transmit IP data packets through their associated IPSec tunnels to ensure data security. Accordingly, the central node and each branch node have their own IP addresses. For example, the IP addresses of the central node, branch node 1, and branch node 2 are 2.2.0.0 / 16, 1.1.1.0 / 24, and 1.1.2.0 / 24, respectively.

[0061] The central node may be, but is not limited to, a router or a gateway supporting the IPSec function. Each branch node may be, but is not limited to, a gateway or a host supporting the IPSec function.

[0062] It should be noted that the number of branch nodes that establish IPSec tunnels with the central node depends on the actual application. Figure 1 Shown are examples only.

[0063] Please refer to Figure 2 , Figure 2 A flow chart of a data packet processing method provided by an embodiment of the present invention, the execution subject of the method may be the central node mentioned above, the central node includes multiple outbound interfaces, the central node is connected to a branch node through an outbound interface, and an IPSec tunnel is established between the central node and each branch node. The method includes the following steps:

[0064] S140: Receive a data packet to be forwarded, and determine an outgoing interface corresponding to the data packet to be forwarded.

[0065] In this embodiment, the data packet to be forwarded can be an IP data packet received by the central node. After determining the forwarding interface corresponding to the data packet to be forwarded, the IP data packet can be further subjected to an IPSec security policy check. The security policy check can represent the following process of searching for the target security policy corresponding to the IP data packet.

[0066] S150: If there are candidate security policies, determine a target security policy whose outgoing interface matching information matches the forwarding outgoing interface from all candidate security policies.

[0067] In this embodiment, the central node stores the security policy and IPSec SA corresponding to each IPSec tunnel, and the security policy includes global five-tuple matching information and outbound interface matching information. The candidate security policy is the security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded.

[0068] The five-tuple information of the data packet to be forwarded can be used to match the candidate security policy (in order to determine whether the data is transmitted through the IPSec tunnel). If the candidate security policy can be matched, the forwarding interface will be used to match each candidate security policy in turn until the target security policy whose outbound interface matching information matches the forwarding interface is found.

[0069] It can be understood that if no candidate security policy is matched, that is, there is no candidate security policy corresponding to the data packet to be forwarded, it means that the data packet to be forwarded does not need to be security processed and can be directly forwarded.

[0070] S160: Process the data packet to be forwarded by using the IPSec SA corresponding to the target security policy, and transmit the processed data packet to be forwarded through the IPSec tunnel corresponding to the target security policy.

[0071] Among them, IPSec SA is an agreement established through negotiation between two IPSec entities (central node and branch node). The content includes the IPSec protocol (AH (Authentication Header) or ESP (encapsulating Security Payload)), operation mode (transmission mode or tunnel mode), verification algorithm, encryption algorithm, encryption key, key lifetime, anti-replay window, counter, etc., which determines what to protect, how to protect and who will protect.

[0072] Security Policy (SP) is located in the Security Policy Database (SPD), which is a list of all SPs stored in a data structure by the central node. IPSec SA is located in the Security Association Database (SAD), which is a list of all IPSec SAs stored in a data structure by the central node.

[0073] In this embodiment, after determining the target security policy corresponding to the data packet to be forwarded, the corresponding IPSec SA can be found from the SAD, and then the data packet to be forwarded is encrypted and encapsulated based on the IPSec SA and transmitted through the IPSec tunnel bound in the target security policy.

[0074] The data packet processing method provided by the embodiment of the present invention determines the corresponding forwarding outbound interface after receiving the data packet to be forwarded. If there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded, then find the target security policy whose outbound interface matching information matches the forwarding outbound interface from all the candidate security policies. Finally, the data packet to be forwarded is processed using the IPSec SA corresponding to the target security policy and then transmitted through the IPSec tunnel corresponding to the target security policy. In this scheme, the security policy includes the outbound interface matching information, which enables the target security policy whose outbound interface matching information uniquely matches the forwarding outbound interface to be found when there is a candidate security policy, ensuring that the data packet to be forwarded can be processed using the IPSec SA corresponding to the target security policy and then forwarded to the correct next-hop branch node through the corresponding IPSec tunnel.

[0075] In an optional implementation, the central node maintains a local routing table, which consists of multiple routing table entries, each of which includes a destination address and mask, a next hop address, a shape description of forwarding information, an outbound interface, etc. Correspondingly, the sub-steps of the above step S140 may include:

[0076] S141. Obtain the destination IP address of the data packet to be forwarded.

[0077] S142. According to the destination IP address of the data packet to be forwarded, find out the forwarding interface from the local routing table.

[0078] It can be understood that a routing table entry with a destination address identical to the destination IP address of the data packet to be forwarded can be found in the local routing table, and the outbound interface included in the routing table entry is the outbound interface for forwarding the data packet to be forwarded.

[0079] Combination Figure 3 ,The following introduces the relevant configuration process on the central node.

[0080] First, the process for the central node to obtain IPSec SA is as follows:

[0081] S110 . For each branch node, establish an IPSec tunnel with the branch node, and obtain an IPSec SA corresponding to the IPSec tunnel.

[0082] It is understandable that after the central node and the branch node establish an IPSec tunnel, the central node can negotiate with the branch node to obtain the IPSec SA corresponding to the IPSec tunnel. And the process of S110 can adopt the current IPSec tunnel establishment method and IPSec SA negotiation method, which will not be described in detail here.

[0083] Next, the central node obtains the security policy in the following ways:

[0084] S120 . For each branch node, according to the IP address of the branch node, find out the outbound interface corresponding to the branch node from the local routing table.

[0085] For a certain branch node, a routing table entry whose next hop address is the same as the IP address of the branch node can be found from the local routing table, and the outbound interface included in the routing table entry is the outbound interface corresponding to the branch node.

[0086] S130: Generate outbound interface matching information associated with the outbound interface corresponding to the branch node, and obtain a security policy corresponding to the IPSec tunnel associated with the branch node.

[0087] In this embodiment, the security policy includes global five-tuple matching information and generated outbound interface matching information. The user can pre-configure the flow of interest of the central node (limit the data flow to be protected), and the flow of interest is set through the five-tuple information of the data packet. Accordingly, the global five-tuple matching information is obtained in response to the user's configuration operation.

[0088] That is, the security policy corresponding to an IPSec tunnel references the global five-tuple matching information and the outbound interface matching information corresponding to the branch node associated with the IPSec tunnel.

[0089] The following uses a simple example to introduce the process of the central node obtaining a security policy based on the user-configured flow of interest and the process of matching the security policy.

[0090] Combination Figure 4 , Figure 4 The IP addresses of the central node, branch node 1, and branch node 2 are shown in FIG. 2 , 2.2.0.0 / 16, 1.1.1.0 / 24, and 1.1.2.0 / 24, respectively. Table 1 below shows part of the content in the local routing table updated by the central node.

[0091] Table 1

[0092] Destination Address Next hop address Outbound interface 1.1.1.10 1.1.1.0 / 24 Interface 1 1.1.2.10 1.1.2.0 / 24 Interface 2

[0093] Assume that the flow of interest uniformly configured on the central node is a network segment: 1.1.0.0 / 16-2.2.0.0 / 16, and the security associations corresponding to the negotiated IPSec tunnel 1 and IPSec tunnel 2 are: IPSec SA1 and IPSec SA2 respectively.

[0094] Then, the process of the central node generating the security policies corresponding to IPSec tunnel 1 and IPSec tunnel 2 is as follows:

[0095] By searching Table 1 above, it can be determined that the outbound interface to branch node 1 is Interface 1, and the outbound interface to branch node 2 is Interface 2. Correspondingly, in the security policies corresponding to IPSec tunnel 1 and IPSec tunnel 2, the global five-tuple matching information and the outbound interface matching information are defined as follows:

[0096] SP1:2.2.0.0 / 16-1.1.0.0 / 16:Interface1;

[0097] SP2: 2.2.0.0 / 16-1.1.0.0 / 16:Interface2.

[0098] It can be seen that since the interested flows are configured uniformly, the contents defined in the global five-tuple matching information of SP1 and SP2 are the same, both 2.2.0.0 / 16-1.1.0.0 / 16. However, the contents defined in the outbound interface matching information of SP1 and SP2 are different, the former is Interface1 and the latter is Interface2.

[0099] When the central node receives data packet P1 (source IP address is 2.2.1.10, destination IP address is 1.1.1.10), it uses the destination IP address of P1 to search Table 1 above, and can determine that the forwarding interface of P1 is Interface 1. Then, the IPSec security policy check is performed on data packet P1: first, the security policy is searched according to the five-tuple information of P1, and the two candidate security policies SP1 and SP2 are matched. Then, the forwarding interface Interface 1 of P1 is compared with the outbound interface matching information in SP1 and SP2, and SP1 is matched. SP1 is the target security policy of P1. Since IPSec tunnel 1 is bound to SP1, P1 is encrypted and encapsulated based on the IPSec SA1 corresponding to SP1, and then forwarded to branch node 1 through IPSec tunnel 1.

[0100] When the central node receives data packet P2 (source IP address is 2.2.1.10, destination IP address is 1.1.2.10), it uses the destination IP address of P2 to search Table 1 above, and can determine that the forwarding interface of P2 is Interface 2. Then, the IPSec security policy check is performed on data packet P2: first, the security policy is searched according to the five-tuple information of P2, and the two candidate security policies SP1 and SP2 are matched. Then, the forwarding interface Interface 2 of P2 is compared with the outbound interface matching information in SP1 and SP2, and SP2 is matched. SP2 is the target security policy of P2. Since IPSec tunnel 2 is bound to SP2, P2 is encrypted and encapsulated based on the IPSec SA2 corresponding to SP2, and then forwarded to branch node 2 through IPSec tunnel 2.

[0101] It should be noted that in the above examples, the presentation form of the security policy (SP) and the configuration of the interested flow as a network segment are only examples. In actual applications, the content limited by the global five-tuple matching information in the security policy shall be subject to the actual application. In the optional examples, the interested flow in the global five-tuple matching information can be limited to any one or combination of IP address, port, and protocol.

[0102] In an optional implementation, once the outbound interface associated with the branch node changes, but the outbound interface matching information in the security policy is not updated in time, the changed forwarding outbound interface cannot match the target security policy. Therefore, the outbound interface matching information in the security policy needs to be updated in time.

[0103] The following are the methods for updating the outbound interface matching information in the two security policies.

[0104] The first method is to update the security policy corresponding to any IPSec tunnel after obtaining the IPSec SA corresponding to the IPSec tunnel.

[0105] That is, after each negotiation to obtain an IPSec SA corresponding to an IPSec tunnel, the security policy corresponding to the IPSec tunnel may be updated once.

[0106] It can be understood that one method is to negotiate the corresponding IPSec SA after the IPSec tunnel is established, and then obtain the security policy corresponding to the IPSec tunnel; the other method is to renegotiate a new IPSecSA when the key lifetime in the IPSec SA expires, and then update the corresponding security policy: when it is detected that the key lifetime in the IPSec SA corresponding to any IPSec tunnel has expired, the branch node associated with the IPSec tunnel renegotiates to obtain a new IPSec SA, and updates the security policy corresponding to the IPSec tunnel.

[0107] The second method is to update the security policy corresponding to each IPSec tunnel according to a predetermined period.

[0108] In the second method, the predetermined period can be set according to the actual situation. After each predetermined period, the security policy corresponding to each IPSec tunnel is updated as follows:

[0109] (1) Based on the IP address of the central node and the IP address of each branch node, search the local routing table for the outbound interface corresponding to each branch node;

[0110] (2) For each branch node, if the outbound interface corresponding to the branch node does not match the outbound interface matching information in the security policy associated with the branch node, the outbound interface matching information in the corresponding security policy is updated using the outbound interface corresponding to the branch node.

[0111] The following introduces a special scenario in which this solution is applied, in which Layer Two Tunneling Protocol (L2TP for short) is used.

[0112] In the IPSec OVER L2TP scenario, an IPSec tunnel is first established between two communication entities, and then an L2TP tunnel is established based on the IPSec tunnel (similar to the IPSec tunnel being nested inside the L2TP tunnel). Accordingly, during the security processing, the data packet will be encrypted and then encapsulated with IPSEC before being transmitted after being encapsulated with L2TP.

[0113] In this scenario, the outbound interface associated with each IPSec tunnel of the central node is not a physical interface, but a different virtual interface (Virtual-Access). Accordingly, the outbound interface matching information in the security policy is also a limited virtual interface. In this way, a target security policy can be uniquely determined based on the five-tuple information of the data packet and the virtual interface obtained by searching the local routing table to achieve correct forwarding of the data packet.

[0114] It should be noted that the execution order of each step in the above method embodiment is not limited to that shown in the drawings, and the execution order of each step shall be based on the actual application situation.

[0115] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0116] (1) In this solution, the central node uniformly configures the globally applied IPSec interest flows, that is, the same interest flows are configured for all branch nodes, avoiding the need to divide each branch node into fine network segments to configure interest flows, thus simplifying the configuration process of the central node.

[0117] (2) The central node generates global five-tuple matching information based on the uniformly configured flow of interest. The central node can issue a sub-security policy including the global five-tuple matching information to each branch node, simplifying the management and configuration of the central node. The central node's security policy adds outbound interface matching information, so that when there are candidate security policies, it can find the target security policy whose outbound interface matching information uniquely matches the forwarding outbound interface, ensuring that the IPSec SA corresponding to the target security policy can be used to process the data packet to be forwarded, and then forwarded to the correct next-hop branch node through the corresponding IPSec tunnel.

[0118] In order to execute the corresponding steps in the above method embodiment and each possible implementation mode, an implementation mode of a data packet processing device is respectively given below.

[0119] See also Figure 5 , Figure 5 The schematic diagram of the structure of the data packet processing device provided by the embodiment of the present invention is shown. The device is applied to a central node, the central node includes multiple outbound interfaces, the central node is connected to a branch node through an outbound interface, and an IPSec tunnel is established between the central node and each branch node; the central node stores the security policy and IPSec SA corresponding to each IPSec tunnel, and the security policy includes global five-tuple matching information and outbound interface matching information. The data packet processing device 200 includes: a search module 220 and a processing module 230.

[0120] A search module 220, configured to receive a data packet to be forwarded and determine a forwarding interface corresponding to the data packet to be forwarded;

[0121] The search module 220 is further used to determine the target security policy whose outgoing interface matching information matches the forwarding outgoing interface from all the candidate security policies if there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded;

[0122] The processing module 230 is used to process the data packet to be forwarded by using the IPSec SA corresponding to the target security policy, and transmit the processed data packet to be forwarded through the IPSec tunnel corresponding to the target security policy.

[0123] In an optional embodiment, the processing module is further configured to directly forward the data packet to be forwarded when the candidate security policy does not exist.

[0124] In an optional embodiment, the central node maintains a local routing table, and the local routing table includes a correspondence between a destination address and an outgoing interface. The search module 220 can be specifically used to: obtain the destination IP address of the data packet to be forwarded; and search the outgoing interface from the local routing table according to the destination IP address of the data packet to be forwarded.

[0125] In an optional embodiment, the central node maintains a local routing table, and the local routing table includes a correspondence between a next hop address and an outbound interface. The data packet processing device 200 also includes a configuration module 210, which can be used to: for each branch node, establish the IPSec tunnel between the branch node and the branch node, and obtain the IPSec SA corresponding to the IPSec tunnel; for each branch node, according to the IP address of the branch node, find the outbound interface corresponding to the branch node from the local routing table; generate the outbound interface matching information of the outbound interface, and obtain the security policy corresponding to the IPSec tunnel associated with the branch node; wherein the security policy includes the global five-tuple matching information and the outbound interface matching information, and the global five-tuple matching information is obtained in response to the user's configuration operation.

[0126] In an optional embodiment, the processing module 230 may also be used to: after obtaining the IPSec SA corresponding to any of the IPSec tunnels, update the security policy corresponding to the IPSec tunnel; or, according to a predetermined period, update the security policy corresponding to each of the IPSec tunnels.

[0127] In an optional embodiment, the processing module 230 can be specifically used to: search the output interface corresponding to each branch node from the local routing table according to the IP address of the central node and the IP address of each branch node according to a predetermined period; for each branch node, if the output interface corresponding to the branch node does not match the output interface matching information in the security policy associated with the branch node, update the security policy using the output interface corresponding to the branch node.

[0128] In an optional embodiment, the IPSec SA also includes an encryption key and a key lifetime of the encryption key. The processing module 230 can be specifically used to: when it is detected that the key lifetime in the IPSec SA corresponding to any of the IPSec tunnels has ended, the branch node associated with the IPSec tunnel renegotiates to obtain a new IPSec SA, and updates the security policy corresponding to the IPSec tunnel.

[0129] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the data packet processing device 200 described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0130] See also Figure 6 , Figure 6 The central node 300 includes a processor 310 , a memory 320 and a bus 330 , and the processor 310 is connected to the memory 320 via the bus 330 .

[0131] The memory 320 may be used to store software programs, for example, Figure 6 The data packet processing device shown. The memory 320 may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a flash memory (Flash), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The processor 310 may be an integrated circuit chip having a signal processing capability.

[0132] The processor 310 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0133] The memory 320 stores machine-readable instructions executable by the processor 310. When the processor 310 executes the machine-readable instructions, the data packet processing method disclosed in the above embodiment is implemented.

[0134] Understandably, Figure 6 The structure shown is for illustration only. The central node 300 may also include Figure 6 More or fewer components as shown, or with Figure 6 Different configurations shown. Figure 6 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0135] The embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the data packet processing method disclosed in the above embodiment is implemented. The readable storage medium can be, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a PROM, an EPROM, an EEPROM, a FLASH disk, or an optical disk.

[0136] In summary, the embodiments of the present invention provide a data packet processing method, device, central node and storage medium, which determine the corresponding forwarding interface after receiving the data packet to be forwarded. If there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded, then find the target security policy whose outgoing interface matching information matches the forwarding interface from all candidate security policies. Finally, the data packet to be forwarded is processed using the IPSec SA corresponding to the target security policy and then transmitted through the IPSec tunnel corresponding to the target security policy. In this scheme, the security policy includes the outgoing interface matching information, which enables the target security policy whose outgoing interface matching information uniquely matches the forwarding interface to be found when there is a candidate security policy, ensuring that the data packet to be forwarded can be processed using the IPSec SA corresponding to the target security policy, and then forwarded to the correct next-hop branch node through the corresponding IPSec tunnel.

[0137] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A data packet processing method, It is characterized in that Applied to a central node, the central node includes multiple outbound interfaces, the central node is connected to a branch node through one outbound interface, and an IPSec tunnel is established between the central node and each branch node; the central node stores a security policy and an IPSec SA corresponding to each IPSec tunnel, the security policy includes global five-tuple matching information and outbound interface matching information; the method includes: Receive a data packet to be forwarded, and determine a forwarding interface corresponding to the data packet to be forwarded; If there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded, then determine a target security policy whose outbound interface matching information matches the forwarding outbound interface from all the candidate security policies; Processing the data packet to be forwarded by using the IPSec SA corresponding to the target security policy, and transmitting the processed data packet to be forwarded through the IPSec tunnel corresponding to the target security policy; The central node maintains a local routing table, which includes a correspondence between a next-hop address and an outbound interface; the central node obtains the IPSec SA in a manner that includes: for each branch node, establishing the IPSec tunnel between the branch node and the branch node, and obtaining the IPSec SA corresponding to the IPSec tunnel; The manner in which the central node obtains the security policy comprises: for each branch node, searching the output interface corresponding to the branch node from the local routing table according to the IP address of the branch node; generating output interface matching information of the output interface, and obtaining the security policy corresponding to the IPSec tunnel associated with the branch node; wherein the security policy comprises global five-tuple matching information and the output interface matching information, and the global five-tuple matching information is obtained in response to the user's configuration operation.

2. The method according to claim 1, It is characterized in that The method further comprises: If the candidate security policy does not exist, the data packet to be forwarded is directly forwarded.

3. The method according to claim 1, It is characterized in that The local routing table also includes a correspondence between a destination address and an outbound interface; The step of determining the forwarding outgoing interface corresponding to the data packet to be forwarded comprises: Obtaining the destination IP address of the data packet to be forwarded; According to the destination IP address of the data packet to be forwarded, the forwarding outgoing interface is found from the local routing table.

4. The method according to claim 1, It is characterized in that The method further comprises: After obtaining the IPSec SA corresponding to any of the IPSec tunnels, updating the security policy corresponding to the IPSec tunnel; or, The security policy corresponding to each IPSec tunnel is updated according to a predetermined period.

5. The method according to claim 4, It is characterized in that The local routing table also includes a correspondence between a destination address and an outbound interface; The step of updating the security policy corresponding to each IPSec tunnel comprises: According to the IP address of the central node and the IP address of each branch node, searching the outbound interface corresponding to each branch node from the local routing table; For each of the branch nodes, if the outbound interface corresponding to the branch node does not match the outbound interface matching information in the security policy associated with the branch node, the security policy is updated using the outbound interface corresponding to the branch node.

6. The method according to claim 1, It is characterized in that The IPSec SA also includes an encryption key and a key lifetime of the encryption key; the method further includes: When it is detected that the key lifetime in the IPSec SA corresponding to any one of the IPSec tunnels has expired, the branch node associated with the IPSec tunnel renegotiates to obtain a new IPSec SA, and updates the security policy corresponding to the IPSec tunnel.

7. A data packet processing device, It is characterized in that Applied to a central node, the central node includes multiple outbound interfaces, the central node is connected to a branch node through one outbound interface, and an IPSec tunnel is established between the central node and each branch node; the central node stores a security policy and an IPSec SA corresponding to each IPSec tunnel, the security policy includes global five-tuple matching information and outbound interface matching information; the device includes: A search module, used for receiving a data packet to be forwarded, and determining a forwarding interface corresponding to the data packet to be forwarded; The search module is further used to determine, from all the candidate security policies, a target security policy whose outbound interface matching information matches the forwarding outbound interface if there is a candidate security policy whose global five-tuple matching information matches the five-tuple information of the data packet to be forwarded; A processing module, used to process the data packet to be forwarded by using the IPSec SA corresponding to the target security policy, and transmit the processed data packet to be forwarded through the IPSec tunnel corresponding to the target security policy; A configuration module, used to: for each branch node, establish the IPSec tunnel between the branch node and the branch node, and obtain the IPSec SA corresponding to the IPSec tunnel; according to the IP address of the branch node, find the output interface corresponding to the branch node from the local routing table; generate the output interface matching information of the output interface, and obtain the security policy corresponding to the IPSec tunnel associated with the branch node; wherein the central node maintains the local routing table, and the local routing table includes the correspondence between the next hop address and the output interface; the security policy includes the global five-tuple matching information and the output interface matching information, and the global five-tuple matching information is obtained in response to the user's configuration operation.

8. A central node, It is characterized in that include: A memory and a processor, wherein the memory stores machine-readable instructions executable by the processor, and when the central node is running, the processor executes the machine-readable instructions to implement the data packet processing method according to any one of claims 1 to 6.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data packet processing method according to any one of claims 1 to 6 is implemented.