Data forwarding method and device applied to gateway equipment, equipment and medium
By splitting the fully connected table in the central processor, generating smaller preset session tables and storing them in the ASIC chip, the problem of limited memory in the ASIC chip in the white box switch is solved, and packet forwarding efficiency and network communication are improved. reliability.
Patent Information
- Application Number
- CN202310538953.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-12
- Publication Date
- 2024-11-12
AI Technical Summary
The ASIC chips in white box switches have limited memory and cannot store large-scale session table entries, resulting in low packet forwarding efficiency, and existing expansion methods increase costs or reduce data transmission speed.
Save the fully connected table in the central processor, and split the repeated fields to generate a smaller preset session table, which is saved in the ASIC chip to improve the table lookup efficiency.
It reduces the storage pressure of integrated circuit chips, improves packet forwarding efficiency, and ensures the smoothness and reliability of network communication.
Smart Images

Figure CN118945108A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a data forwarding method, apparatus, device and computer-readable storage medium applied to a gateway device. Background Art
[0002] A white box switch is a network switch based on open hardware and software that can quickly and accurately forward data packets based on network topology and traffic characteristics. A white box switch can use ASIC (Application Specific Integrated Circuit) chips to parse, match, and forward data packets. During these processes, the session table stored in the memory of the ASIC chip is needed to query different information.
[0003] However, the memory in the ASIC chip is limited and cannot store a session table with large-scale entries. In the related art, a method of using an external expansion card to store some entries or a method of using the CPU of the switch to store some entries not only increases the cost, but also reduces the efficiency of the ASIC chip in forwarding data packets due to the low bandwidth of the communication channel between the external expansion card and the CPU and the ASIC chip.
[0004] Therefore, how to improve the forwarding efficiency of data packets is an urgent problem to be solved. Summary of the invention
[0005] Embodiments of the present application provide a data forwarding method applied to a gateway device, a data forwarding device applied to a gateway device, a gateway device, a computer-readable storage medium, and a computer program product.
[0006] In a first aspect, an embodiment of the present application provides a data forwarding method applied to a gateway device, comprising: obtaining a preset session table, wherein the preset session table is obtained by splitting repeated fields in a fully connected table stored in a central processing unit, and the fully connected table is used to record the conversion address used by the gateway device when forwarding a data packet; based on the header information of the received data packet, querying the preset session table to obtain a target conversion address; and forwarding the data packet based on the target conversion address.
[0007] In the second aspect, an embodiment of the present application provides a data forwarding device applied to a gateway device, including: an acquisition unit, used to obtain a preset session table, wherein the preset session table is obtained by splitting repeated fields in a fully connected table stored in a central processing unit, and the fully connected table is used to record the conversion address used by the gateway device when forwarding a data packet; a query unit, used to query the preset session table based on the header information of the received data packet to obtain a target conversion address; and a forwarding unit, used to perform forwarding processing of the data packet based on the target conversion address.
[0008] In one embodiment of the present application, based on the aforementioned scheme, the preset session table includes a first session table, a second session table, a third session table and a fourth session table, and the target conversion address includes a target conversion IP address and a target conversion port address; the query unit is also used to query the output address identification information and the input address identification information from the first session table and the second session table in sequence based on the packet header information; query the target conversion identification information and the target conversion port address in the third session table based on the output address identification information, the input address identification information and the packet header information; query the target conversion identification information and the target conversion port address in the fourth session table based on the target conversion identification information.
[0009] In one embodiment of the present application, based on the aforementioned scheme, the packet header information includes a destination IP address, a destination port address, protocol information and a source IP address; the query unit is also used to query the first session table to obtain output address identification information that matches the destination IP address and the destination port address; and query the second session table to obtain input address identification information that matches the protocol information and the source IP address.
[0010] In one embodiment of the present application, based on the aforementioned scheme, the processing unit is used to change the output address identification information corresponding to the data packet to a first preset value if the output address identification information matching the destination IP address and the destination port address is not queried in the first session table; if the input address identification information matching the protocol information and the source IP address is not queried in the second session table, the input address identification information corresponding to the data packet is changed to a second preset value.
[0011] In one embodiment of the present application, based on the aforementioned scheme, the packet header information includes a source port address; the query unit is also used to query the third session table to obtain target conversion identification information and target conversion port address that match the output address identification information, the input address identification information and the source port address.
[0012] In one embodiment of the present application, based on the aforementioned scheme, the processing unit is also used to send the data packet to the central processor if the target conversion identification information and the target conversion port address are not obtained by querying the third session table, so that the central processor updates the packet header information to obtain updated packet header information, and the updated packet header information includes the target conversion address.
[0013] In one embodiment of the present application, based on the aforementioned scheme, the central processor updates the packet header information, and the process of obtaining the updated packet header information includes: querying the fully connected table to obtain the target conversion address corresponding to the packet header information; updating the packet header information according to the forwarding direction corresponding to the data packet and the target conversion address to obtain the updated packet header information.
[0014] In one embodiment of the present application, based on the aforementioned scheme, the central processor updates the packet header information, and the process of obtaining the updated packet header information also includes: if the target conversion address corresponding to the packet header information is not obtained by querying the fully connected table, generating a fully connected table entry for the packet header information; adding the fully connected table entry to the fully connected table to obtain an updated fully connected table; and querying the updated fully connected table to obtain the target conversion address corresponding to the packet header information.
[0015] In one embodiment of the present application, based on the aforementioned solution, after the central processor adds the full connection table entry to the full connection table to obtain an updated full connection table, it also includes: generating a preset session table entry corresponding to the packet header information based on the updated full connection table, so as to update the preset session table based on the preset session table entry.
[0016] In one embodiment of the present application, based on the above-mentioned solution, the processing unit is further used to discard the data packet if the target conversion IP address is not obtained by querying the fourth session table based on the target conversion identification information.
[0017] In one embodiment of the present application, based on the aforementioned scheme, the packet header information is updated according to the forwarding direction corresponding to the data packet and the target conversion address to obtain updated packet header information; and the data packet is forwarded according to the updated packet header information.
[0018] In one embodiment of the present application, based on the aforementioned scheme, the processing unit is also used to update the destination IP address in the packet header information to the target conversion IP address, and update the destination port address in the packet header information to the target conversion port address if the data packet is sent from the public network to the intranet, so as to obtain the updated packet header information; if the data packet is sent from the intranet to the public network, then the source IP address in the packet header information is updated to the target conversion IP address, and the source port address in the packet header information is updated to the target conversion port address, so as to obtain the updated packet header information.
[0019] In a third aspect, an embodiment of the present application provides a gateway device, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the data forwarding method applied to the gateway device as described above is implemented.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer-readable instructions stored thereon. When the computer-readable instructions are executed by a processor of a computer, the computer executes the above-mentioned data forwarding method applied to a gateway device.
[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, including computer-readable instructions, which, when executed by a processor, implement the above-mentioned data forwarding method applied to a gateway device.
[0022] In the technical solution provided by the embodiment of the present application, on the one hand, a preset session table is stored in the integrated circuit chip, and the fully connected table is stored in the central processing unit. The central processing unit can split the repeated fields in the fully connected table to obtain the preset session table. Therefore, the preset session table can represent the same content as the fully connected table, but it has fewer table items and occupies less storage space, which can reduce the storage pressure of the integrated circuit chip; on the other hand, the preset session table represents the content of the fully connected table through fewer table items, so that the efficiency of the integrated circuit chip to query the target conversion address based on the preset session table will be improved, thereby improving the efficiency of data packet forwarding.
[0023] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a schematic diagram of an implementation environment involved in this application;
[0025] Figure 2 is a schematic diagram of the structure of a white box switch according to an exemplary embodiment;
[0026] Figure 3is a flow chart showing a data forwarding method applied to a gateway device according to an exemplary embodiment;
[0027] Figure 4 is a flow chart of a data forwarding method applied to a gateway device according to another exemplary embodiment;
[0028] Figure 5 is a flow chart of a data forwarding method applied to a gateway device according to another exemplary embodiment;
[0029] Figure 6 is a flow chart of a data forwarding method applied to a gateway device according to another exemplary embodiment;
[0030] Figure 7 is a flow chart of a data forwarding method applied to a gateway device according to another exemplary embodiment;
[0031] Figure 8 is a flow chart of a data forwarding method applied to a gateway device according to another exemplary embodiment;
[0032] Fig. 9 is a flow chart of a data forwarding method applied to a gateway device according to another exemplary embodiment;
[0033] Fig.10 is a flow chart of a data forwarding method applied to a gateway device according to another exemplary embodiment;
[0034] Fig.11 is a flow chart of a data forwarding method applied to a gateway device according to another exemplary embodiment;
[0035] Fig.12 is a block diagram of a data forwarding device applied to a gateway device according to an exemplary embodiment;
[0036] Fig.13 The diagram is a schematic diagram of the hardware structure of a data forwarding device applied to a gateway device according to an exemplary embodiment. DETAILED DESCRIPTION
[0037] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments that are the same as the present application. Instead, they are only examples of devices and methods that are the same as some aspects of the present application as detailed in the attached claims.
[0038] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0039] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0040] It should be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.
[0041] It should be noted that in the specific implementation of this application, user-related data is involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0042] Before introducing the technical solutions of the embodiments of the present application, the technical terms involved in the embodiments of the present application are first introduced here.
[0043] Network Address Translation (NAT) is a network protocol and technology used to translate network addresses in an IP network. It is mainly used to translate the Internet Protocol (IP) addresses of the intranet into public IP addresses so that devices in the LAN can communicate with the public Internet. The main function of NAT is to translate IP addresses at the network boundary. It enables communication between the internal private network and the external public network by performing address mapping between the source IP address and the destination IP address of the network packet. In this way, devices in the LAN can communicate with the Internet by sharing a public IP address without assigning a separate public IP address to each device.
[0044] White Box Switch, also known as White Box Programmable Switch, is a network switch that has higher customizability and flexibility than traditional commercial switches. The main advantages of white box switches are customizability and programmability. They can be customized according to specific needs and adapt to various network scenarios and application requirements. White box switches are widely used in data centers, enterprise networks, and service provider networks, providing high-performance, flexible, and scalable network solutions.
[0045] A stateful gateway is a network device or software used to implement network address translation (NAT) and firewall functions. Unlike a traditional stateless gateway, a stateful gateway can maintain session state information related to packet forwarding. In an embodiment of the present application, a stateful gateway can be deployed in a white box switch, so the present application embodiment is described with a white box switch as the main body.
[0046] Application-Specific Integrated Circuit (ASIC) chip, also known as integrated circuit chip, is a customized integrated circuit chip designed and manufactured to implement specific functions or applications. ASIC chip is designed and customized according to specific needs. It integrates various digital circuits, analog circuits and other specific function circuits to achieve specific computing, control, communication or processing tasks. Compared with general integrated circuits (such as processors, memories, etc.), ASIC chips have the characteristics of high customization, high performance, low power consumption and high integration. In the embodiment of the present application, ASIC chips can be used to forward data packets and store preset session tables.
[0047] The Central Processing Unit (CPU) is one of the main components in a computer system and is also known as a microprocessor. It is an integrated circuit chip that is responsible for executing the instruction set of a computer program and controlling various operations of the computer system.
[0048] The five-tuple information refers to the five key attributes used to uniquely identify a network connection or data flow in a computer network, including the source IP address, source port address, destination IP address, destination port address, and protocol type. These five attributes combined together can uniquely identify a network communication session.
[0049] Specifically, the five-tuple information includes:
[0050] Source IP Address (src_ip): indicates the source IP address of the data stream, used to identify the sender of the data packet.
[0051] Source port address (Source Port, src_port): indicates the source port number of the data stream, which is used to identify the sender's application or service.
[0052] Destination IP Address (dst_ip): indicates the destination IP address of the data flow, used to identify the receiver of the data packet.
[0053] Destination Port Address (dst_port): indicates the destination port number of the data stream, which is used to identify the receiving application or service.
[0054] Protocol Type, also known as protocol information: indicates the transmission protocol used by the data stream, such as TCP (Transmission Control Protocol) or UDP (User Datagram Protocol).
[0055] Through these five attributes, network devices can uniquely distinguish and identify different network connections or data flows, and perform corresponding forwarding and processing operations. The importance of quintuple information in the network is reflected in aspects such as network routing, firewall rules, traffic control, and network monitoring.
[0056] Public network and private network are two commonly used concepts in the network, which are used to describe different areas or ranges in the network. The public network refers to the part of the network that is connected to the global Internet. It is an open and public network infrastructure. The public network is connected through various Internet Service Providers (ISPs) and provides wide area network coverage. The IP address of the public network is unique in the world and is assigned to each network by the Internet Assigned Numbers Authority (IANA) and its subordinate organizations.
[0057] Intranet refers to a local area network (LAN) or a private network within an enterprise. It is usually established within an organization, company, institution, etc. for internal communication and resource sharing. Devices in the intranet use private IP addresses, which are allocated and managed by the organization. These private IP addresses are not routable in the public network. Intranets are usually composed of routers, switches and other network devices to provide local network connections.
[0058] There are boundaries and connection points between the public network and the intranet, and communication is usually carried out through technologies such as Network Address Translation (NAT). Devices in the intranet can use NAT to convert private IP addresses to public IP addresses and communicate with devices on the public network. In this way, devices in the intranet can access public network resources, and devices on the public network can also communicate with devices in the intranet through NAT.
[0059] In the related art, in a cloud computing network, a stateful gateway can match packet header information according to rules and generate sessions, and then maintain and process sessions. In order to support high-performance forwarding processing, white box switches are usually used to carry a large amount of business traffic, in which session information is mainly stored through integrated circuit chips. However, the memory capacity of integrated circuit chips is limited. If too much session information needs to be processed, the scale will be limited. At present, the two main solutions for expanding more session information are to use an external field programmable gate array (Field-Programmable Gate Array, FPGA) card and to use the CPU memory expansion table entry of the white box switch. However, the external FPGA card requires additional gateway costs, and although the method of using CPU memory expansion table entries does not increase costs, due to the low-bandwidth peripheral component interconnect Express (Peripheral Component Interconnect Express, PCIe) interconnection, the data transmission speed between the white box switch and the CPU will be slowed down, thereby reducing the overall packet forwarding performance.
[0060] Based on this, the embodiments of the present application respectively propose a data forwarding method applied to a gateway device, a data forwarding device applied to a gateway device, a gateway device, a computer-readable storage medium, and a computer program product. In these embodiments, the full connection table is stored in a central processing unit, and the central processing unit splits the repeated fields of the full connection table to obtain a smaller preset session table, and the preset session table is stored in an integrated circuit chip, so that the storage pressure of the integrated circuit chip can be reduced, and the table lookup efficiency of the integrated circuit chip is improved, thereby improving the efficiency of data packet forwarding.
[0061] It should be noted that the present application can be applied to stateful gateways in cloud computing scenarios, such as NAT gateways. In this scenario, a programmable white box switch can be included to carry the forwarding requirements of the state gateway in a language. The white box switch can support secondary development capabilities, for example, programmable packet forwarding processes. In addition, in this scenario, the central processing unit needs to support secondary development capabilities and support container deployment, that is, have certain storage capabilities.
[0062] See also Figure 1 , Figure 1 It is a schematic diagram of an implementation environment involved in this application.
[0063] Figure 1 The implementation environment shown includes a white box switch 110 , an intranet 120 , and a public network 130 .
[0064] The white box switch 110 establishes a communication connection with the intranet 120 and the public network 130. The intranet 120 can perform network address translation through the white box switch 110 to communicate with the public network 130. Similarly, the public network 130 can perform network address translation through the white box switch 110 to communicate with the intranet 120. In the embodiment of the present application, an Ethernet connection can be used between the intranet 120 and the white box switch 110, and the intranet device is connected through the port of the switch. An external connection, such as an optical fiber or other physical line, can be used between the white box switch 110 and the public network 130 to connect the switch to the public network.
[0065] The intranet 120 may include multiple intranet addresses, such as intranet device 1, intranet device 2, and intranet device 3, etc. Each intranet device may correspond to an intranet address, and multiple ports may be deployed on each intranet device. Similarly, the public network 130 may also include multiple public network devices. The embodiment of the present application takes the intranet 120 including three intranet devices as an example, and takes the public network 130 including one public network device as an example for explanation.
[0066] Both the intranet 120 and the public network 130 can send data packets through the white box switch 110 .
[0067] When a data packet is sent from the intranet 120 to the public network 130, the intranet devices in the intranet 120 are connected to the public network 130 through the white box switch 110. As a boundary device, the white box switch 110 plays the role of a switching point and a connection point between the intranet 120 and the public network 130. It is responsible for forwarding the data packets generated by the intranet devices to the public network 130, and converting and routing the data packets. The white box switch 110 uses network address translation technology to convert the source address of the intranet 120 device into an address recognizable by the public network 130 so as to communicate with the public network 130.
[0068] When a data packet is sent from the public network 130 to the intranet 120, the public network device communicates with the intranet device of the intranet 110 through the white box switch 110. The white box switch 110 receives the data packet sent by the public network device and forwards it according to the target address. It resolves the target address into an intranet address recognizable by the intranet device, and then forwards the data packet to the corresponding intranet address. In this process, the white box switch 110 can perform routing and forwarding functions to ensure that the data packet can correctly reach the target device of the intranet 120.
[0069] See also Figure 2 , Figure 2 Schematic diagram of the structure of a white box switch involved in this application. Figure 2 As shown, the white box switch may include an integrated circuit chip (ASIC chip) 210 and a central processing unit (CPU) 220. The integrated circuit chip 210 belongs to the data plane, and the central processing unit 220 belongs to the control plane. In addition, the integrated circuit chip 210 includes at least a packet processing module 211 and a table matching module 212, and the integrated circuit chip 210 may store a preset session table. The central processing unit 220 includes at least a table adding module 221, a table deleting module 222, and other operations modules.
[0070] The integrated circuit chip 210 is located in the data layer and is mainly responsible for the actual data packet processing task. It includes multiple modules, among which the data packet processing module 211 is used to process the received data packets, and can be responsible for extracting the packet header information, performing the data packet forwarding operation and updating the packet header information. In addition, the table entry matching module 212 in the integrated circuit chip 210 is used to match the packet header information with the preset session table entry to determine the target conversion address required when the integrated circuit chip 210 forwards the data packet. The integrated circuit chip 210 can also store the preset session table, and these table entries are used to guide the forwarding process of the data packet.
[0071] The central processor 220 is located in the control layer and is responsible for the control and management functions of the switch. The central processor 220 includes multiple modules, among which the table entry adding module 221 is used to add new table entries to the session table of the integrated circuit chip 210 to update the forwarding rules and actions. The table entry deleting module 222 is used to delete no longer needed table entries from the full connection table to update the forwarding rules. In addition, the central processor 220 also includes other modules for performing other operations related to the switch data packet forwarding control, such as configuration management, statistical information collection, etc. The central processor 220 stores a full connection table, and can generate a preset session table based on the full connection table, or update the packet header information based on the full connection table.
[0072] Through the collaborative work of the integrated circuit chip 210 and the central processor 220, the white box switch can achieve efficient packet forwarding and control between the data layer and the control layer. The integrated circuit chip 210 is responsible for processing data packets, matching table entries and executing corresponding actions, while the central processor 220 is responsible for managing and updating forwarding rules. This hierarchical structure and functional division can improve the performance and scalability of the switch and adapt it to different network environments and requirements.
[0073] See also Figure 3 , Figure 3 is a flow chart of a data forwarding method applied to a gateway device according to an exemplary embodiment. The method can be applied to Figure 1 The implementation environment shown and by Figure 2 The integrated circuit chip 210 in the white box switch shown in the figure is specifically implemented. Of course, the method can also be applied to other implementation environments, and the execution subject of the method is not limited here.
[0074] The data forwarding method applied to the gateway device will be described in detail below by taking an integrated circuit chip as an exemplary execution subject.
[0075] like Figure 3 As shown, in an exemplary embodiment, the method comprises at least the following steps:
[0076] S310, obtaining a preset session table, wherein the preset session table is obtained by splitting repeated fields in a fully connected table stored in a central processor, and the fully connected table is used to record the conversion address used by the gateway device when forwarding a data packet.
[0077] The preset session table may be stored in an integrated circuit chip. The central processing unit splits the repeated fields in the stored fully connected table to obtain the preset session table. The fully connected table, which may also be called a state session table, is a table used to record the conversion address used by the gateway device when forwarding a data packet, and includes the five-tuple information in the packet header information, such as protocol information, source address, destination address, source port and destination port, as well as the conversion address and conversion port address corresponding to different five-tuple information.
[0078] In the embodiment of the present application, the fully connected table can be split into a first session table, a second session table, a third session table and a fourth session table. Among them, the first session table can be called a pre-session table 1 (pre-session table 1), the second session table can be called a pre-session table 2 (pre-session table 2), the third session table can be called a session table (session table), and the fourth session table can be called a post-session table (post-session table).
[0079] Table 1 is an exemplary fully connected table.
[0080] Destination IP address Destination port address Source IP address Source port address Protocol Information Convert address A B …… …… …… …… A B …… …… …… …… A B …… …… …… …… A B …… …… …… …… A B …… …… …… …… C D …… …… …… …… C D …… …… …… ……
[0081] Table 1
[0082] In Table 1, there are 5 entries with destination IP address A and destination port address B, so A and B will appear 4 times in the fully connected table, occupying more storage space. The central processor can split the repeated fields, for example, the destination IP address and destination port address columns can be split out to form a table with less data volume, and the first session table shown in Table 2 is obtained.
[0083] External IP address External port address Output address (OID) A B OID1 C D OID2
[0084] Table 2
[0085] The external IP address (Outside IP) in Table 2 may be a public IP address in the full connection table, and the external port address (Outside port) may be a public port address in the full connection table. The output address (Output Identity, OID) may be an address converted from the external IP address and the external port address.
[0086] Similarly, the central processor may also extract the protocol information and the internal IP address from the full connection table and perform the same repeated field splitting process to obtain the second session table as shown in Table 3.
[0087] protocol Internal IP address Input address (IID) A B IID1 C D IID2
[0088] Table 3
[0089] The protocol (Protocol) in Table 3 may be the protocol information in the full connection table, the internal IP address (Inside IP) may be the intranet IP address in the packet header information, and the input address (Output Identity, IID) may be the address after the internal IP address is converted.
[0090] Similarly, the central processor may also perform repeated field splitting processing on the OID in Table 2, the IID in Table 3, and the internal port address in the fully connected table to obtain a third session table as shown in Table 4.
[0091]
[0092] Table 4
[0093] The translation identification information (NAT ID, NID) and the translation port address (NAT port) may be generated by a central processing unit.
[0094] Similarly, the central processor may also generate a fourth session table as shown in Table 5 in combination with the NID in Table 4.
[0095]
[0096]
[0097] Table 5
[0098] The converted IP address (NAT IP) may be generated by a central processing unit.
[0099] S320, based on the header information of the received data packet, query the preset session table to obtain the target conversion address.
[0100] When the white box switch receives a data packet, it analyzes the packet header information, which includes key fields such as source IP address, destination IP address, source port address, destination port address, and protocol information. The integrated circuit chip queries the preset session table based on the packet header information to obtain the target conversion address.
[0101] It should be noted that when the white box switch needs to forward a data stream, it can read the first data packet in the data stream, and query the preset session table based on the packet header information of the first data packet to obtain the target conversion address, and the target conversion address is applicable to each data packet in the data stream. In this way, the white box switch does not need to query the target conversion address for each data packet in a data stream, thereby improving the forwarding efficiency of the data packet.
[0102] S330, forwarding the data packet based on the target conversion address.
[0103] When the integrated circuit chip obtains the target translation address, it will forward the data packet according to the address. The integrated circuit chip will use the target translation address as the next hop target and determine the forwarding path of the data packet according to the internal forwarding table or routing table. This may involve modifying the data packet, such as replacing the source address with the egress address of the white box switch, and performing appropriate network address translation (NAT) operations, as well as necessary encapsulation operations. Finally, the white box switch sends the data packet to the next hop device corresponding to the target translation address to implement the data packet forwarding process.
[0104] Through this method, the full connection table can be saved in the central processing unit, while the integrated circuit chip saves the smaller preset session table, which realizes the compression of the full connection table, thus saving the storage space of the integrated circuit chip, so that it can cope with the data packet forwarding scenario with a larger flow. In addition, the integrated circuit chip can query the target conversion address according to the packet header information of the data packet, thereby realizing the accurate forwarding of the data packet. This ensures the effective transmission of the data packet between the intranet and the public network, and ensures the smoothness and reliability of network communication.
[0105] In one embodiment of the present application, another data forwarding method applied to a gateway device is provided, and the data forwarding method applied to the gateway device can be executed by an integrated circuit chip. Figure 4 As shown, the data forwarding method applied to the gateway device may include S310, S410 to S430 and S330. That is, S410 to S430 are Figure 3 The specific implementation method of S320 is shown.
[0106] In the embodiment of the present application, the preset session table includes a first session table, a second session table, a third session table and a fourth session table, and the target conversion address includes a target conversion IP address and a target conversion port address.
[0107] S410 to S430 are described below:
[0108] S410: Based on the packet header information, query the first session table and the second session table in sequence to obtain output address identification information and input address identification information.
[0109] The integrated circuit chip first searches the first session table for an entry that matches the header information of the data packet. By comparing the header information of the data packet with the corresponding fields in the first session table, the integrated circuit chip can find the matching entry. Further, the output address identification information (ie, OID) is extracted from the matching entry.
[0110] The integrated circuit chip can also query the second session table for a table entry that matches the header information of the data packet. By comparing the header information of the data packet with the corresponding fields in the second session table, the integrated circuit chip can find a matching table entry. Further, the input address identification information (i.e., IID) is extracted from the matching table entry.
[0111] The output address identification information and the input address identification information indicate the source and destination of the data packet, providing key information for subsequent data packet forwarding.
[0112] S420: Query the third session table based on the output address identification information, the input address identification information and the packet header information to obtain the target conversion identification information and the target conversion port address.
[0113] The integrated circuit chip uses the previously acquired output address identification information and input address identification information, as well as the header information of the current data packet, to query the corresponding table entry from the third session table. Through the matching of the fields, the integrated circuit chip can obtain the target conversion identification information (NAT ID, NID) and the target conversion port address (NAT port). The target conversion identification information indicates the conversion identification information of the IP address to which the data packet should be sent, and the target conversion port address indicates the address after the port address to which the data packet should be sent is converted.
[0114] S430: Query and obtain a target conversion IP address in the fourth session table based on the target conversion identification information.
[0115] The integrated circuit chip queries the table entry related to the identification information from the fourth session table according to the target conversion identification information obtained previously. The table entry includes the target conversion identification information and the corresponding target conversion IP address. The integrated circuit chip can obtain the final target conversion IP address of the data packet, that is, the final destination that the data packet needs to reach, by matching the target node identification information.
[0116] It should be noted that if the integrated circuit chip fails to obtain the target conversion IP address in the fourth session table based on the target conversion identification information, the data packet will be discarded.
[0117] Through this method, the integrated circuit chip can query the necessary information in each session table according to the packet header information, output address identification information and input address identification information, such as target conversion identification information, target conversion port address and target conversion IP address, etc. This information will provide an important basis for the subsequent data packet forwarding, ensuring that the data packet can be forwarded correctly.
[0118] In one embodiment of the present application, another data forwarding method applied to a gateway device is provided, and the data forwarding method applied to the gateway device can be executed by an integrated circuit chip. Figure 5 As shown, the data forwarding method applied to the gateway device may include S310, S510 to S520 or S530 to S540, S420 to S430 and S330. That is, S510 to S520 or S530 to S540 are Figure 4 The specific implementation method of S410 is shown.
[0119] In the embodiment of the present application, the packet header information includes the destination IP address, the destination port address, the protocol information and the source IP address.
[0120] S510 to S520 are described below:
[0121] S510: Query in the first session table to obtain output address identification information that matches the destination IP address and the destination port address.
[0122] The integrated circuit chip can retrieve a matching table entry from the first session table according to the destination IP address and the destination port address of the data packet. By comparing the destination IP address and the destination port address of the data packet with the external IP address and the external port address in the first session table, the integrated circuit chip can find a matching table entry and extract the corresponding output address identification information.
[0123] S520: Search in the second session table to obtain input address identification information that matches the protocol information and the source IP address.
[0124] The integrated circuit chip retrieves a matching table entry from the second session table based on the protocol information and source IP address of the data packet. By comparing the protocol information and source IP address in the packet header information with the protocol information and internal IP address in the second session table, the integrated circuit chip can find a matching table entry and extract the corresponding input address identification information.
[0125] It should be noted that S510 to S520 are performed when matching output address identification information and input address identification information are found in the first session table and the second session table in sequence, and if no matching output address identification information is found, the integrated circuit chip can execute steps S530 to S540.
[0126] S530 to S540 are described below:
[0127] S530: If the output address identification information matching the destination IP address and the destination port address is not found in the first session table, the output address identification information corresponding to the data packet is changed to a first preset value.
[0128] If the output address identification information matching the destination IP address and destination port address of the data packet is not found in the first session table, it means that there is no table entry matching the destination IP address and destination port address in the current first session table. This may be because the destination IP address and destination port address do not conform to the preset rules, or the first session table does not contain the corresponding information. In this case, the output address identification information that the integrated circuit chip can change is a first preset value. This first preset value is a pre-set default output address identification information, for example, it can be -1. After being set to the first preset value, it can indicate that the output address identification information corresponding to the packet header information is missing or invalid.
[0129] Optionally, the integrated circuit chip can create a new field oid_final for the header information of the data packet in the storage space, and set oid_final equal to the first preset value, for example, oid_final = -1, which can indicate that the integrated circuit chip has not found the output address identification information in the first session table, and assigns the output address identification information to the first preset value.
[0130] By changing the output address identification information to the first preset value, the integrated circuit chip can ensure that even if there is no matching table entry, it can still continue to query the preset session table according to the output address identification information and other information of the packet header information, so that the data packet can still be forwarded according to the preset rules.
[0131] S540: If the input address identification information matching the protocol information and the source IP address is not found in the second session table, the input address identification information corresponding to the data packet is changed to a second preset value.
[0132] Similarly, if the input address identification information that matches the protocol information and source IP address of the data packet is not found in the second session table, it means that there is no table entry that matches the protocol information and source IP address in the current second session table. The integrated circuit chip can change the input address identification information to a second preset value. The second preset value can be the same as the first preset value or different, for example, it can be -1, -2, etc., which can indicate that the input address identification information corresponding to the packet header information is missing or invalid.
[0133] Optionally, the integrated circuit chip can create a new field iid_final for the header information of the data packet in the storage space, and set iid_final equal to the second preset value, for example, iid_final = -1, which can indicate that the integrated circuit chip has not queried the input address identification information in the second session table, and assigns the output address identification information to the second preset value.
[0134] It should be noted that the integrated circuit chip can select one step to execute between S510 and S530, and select one step to execute between S520 and S540.
[0135] Through this method, the integrated circuit chip can query the output address identification information and input address identification information that match the destination IP address, destination port address, protocol information and source IP address of the data packet in the first session table and the second session table. This information will be used to determine the target conversion IP address and target conversion port address of the data packet in subsequent processing to ensure that the data packet can be correctly forwarded and processed according to the preset rules.
[0136] Furthermore, when the integrated circuit chip cannot find matching output address identification information and input address identification information, it will change them to preset values. In this way, even if there is no specific record in the session table, the set can still continue to query the preset session table based on these two information and other information in the packet header information, so that the data packet can still be forwarded according to the preset rules.
[0137] In one embodiment of the present application, another data forwarding method applied to a gateway device is provided, and the data forwarding method applied to the gateway device can be executed by an integrated circuit chip. Figure 6 As shown, the data forwarding method applied to the gateway device may include S310, S410, S610 or S620, S430 and S330. That is, S610 or S620 is Figure 4 The specific implementation method of S420 is shown.
[0138] In the embodiment of the present application, the packet header information includes the source port address.
[0139] The S610 is described below:
[0140] S610: Query in the third session table to obtain target conversion identification information and target conversion port address that match the output address identification information, the input address identification information, and the source port address.
[0141] The integrated circuit chip can search for a table entry matching the output address identification information, the input address identification information, and the source port address in the third session table. The matching of these three pieces of information is to accurately locate the target conversion information and to identify the flow direction and source of the data packet. In the third session table, the integrated circuit chip can query the target conversion identification information and the target conversion port address matching the output address identification information, the input address identification information, and the source port address.
[0142] Optionally, the integrated circuit chip can create a new field nid_final and nat_port for the header information of the data packet in the storage space, and assign the target translation identification information (NID) and the target translation port address (NAT port) queried in the third session table to nid_final and nat_port respectively, that is, nid_final = NID, nat_port = NATport.
[0143] It should be noted that S610 is when the matching target conversion identification information and target conversion port address are found in the third session table, and if no matching target conversion identification information and target conversion port address are found, the integrated circuit chip may execute step S620.
[0144] The following describes S620:
[0145] S620, if the target conversion identification information and the target conversion port address are not obtained by searching the third session table, the data packet is sent to the central processor so that the central processor updates the packet header information to obtain updated packet header information, which includes the target conversion address.
[0146] The path of updating the header information through the central processor can be called a slow path, that is, the central processor updates the header information slowly. Correspondingly, the path of updating the header information through the integrated circuit chip can be called a fast path, which takes less time.
[0147] The central processor in S620 updates the packet header information, and the process of obtaining the updated packet header information includes S621 to S622, which are described below:
[0148] S621, querying in the full connection table to obtain the target conversion address corresponding to the packet header information.
[0149] The full connection table is stored in the central processing unit, so the central processing unit can search the full connection table for a target conversion address that matches the five-tuple information in the packet header information.
[0150] S622, updating the packet header information according to the forwarding direction and the target conversion address corresponding to the data packet to obtain updated packet header information.
[0151] If the target conversion address is found, the central processing unit can update the packet header information.
[0152] Specifically, if the data packet is sent from the public network to the intranet, the central processor updates the destination IP address in the packet header information to the target conversion IP address, and updates the destination port address in the packet header information to the target conversion port address to obtain updated packet header information.
[0153] If the data packet is sent from the intranet to the public network, the central processor updates the source IP address in the packet header information to the target conversion IP address, and updates the source port address in the packet header information to the target conversion port address to obtain updated packet header information.
[0154] Through this method, the integrated circuit chip can find a matching table entry in the third session table according to the output address identification information, input address identification information and source port address of the data packet to obtain the target conversion identification information and the target conversion port address. This information will provide accurate target conversion information for the subsequent data packet forwarding and processing, ensuring the accuracy of data forwarding.
[0155] If the integrated circuit chip fails to find the target conversion identification information and the target conversion port address, the packet header information will be sent to the central processor, which will update the packet header information. In this way, data forwarding failure due to failure to find the required information in the integrated circuit chip can be avoided, thereby ensuring the success rate of data forwarding.
[0156] In one embodiment of the present application, another data forwarding method applied to a gateway device is provided, and the data forwarding method applied to the gateway device can be executed by a central processing unit. Figure 7 As shown, the data forwarding method applied to the gateway device may include S310, S410, S620, S430 and S330. Among them, the central processor in S620 updates the packet header information, and the process of obtaining the updated packet header information includes S710 to S730.
[0157] S710 to S730 are described below:
[0158] S710: If the target conversion address corresponding to the packet header information is not obtained by searching in the full connection table, a full connection table entry for the packet header information is generated.
[0159] If the CPU fails to find a target translation address that matches the packet header information in the fully connected table, i.e., a query miss, it will generate a new fully connected table entry. This new fully connected table entry will be configured for the packet header information to ensure that subsequent packet forwarding can be processed correctly.
[0160] The process of generating a fully connected table entry includes creating a new table entry, filling in relevant fields, such as the five-tuple information of the packet header information, and calculating the target conversion address for the packet header information. In this way, the newly generated fully connected table entry will be able to represent the forwarding rules and target conversion address of the data packet.
[0161] S720: Add the fully connected table entry to the fully connected table to obtain an updated fully connected table.
[0162] That is, the central processing unit can add a row of table entries in the fully connected table, and fill the content of the fully connected table entry into the added table entry, so as to obtain an updated fully connected table.
[0163] The process of adding a fully connected table entry by the CPU usually involves inserting the new table entry into a suitable position to maintain the order and consistency of the fully connected table. The CPU compares and sorts the relevant fields of the table entry to determine the insertion position of the new table entry, which is not limited in the embodiments of the present application.
[0164] S730, querying in the updated full connection table to obtain the target conversion address corresponding to the packet header information.
[0165] The CPU will query the updated fully connected table based on the header information of the data packet to obtain the target conversion address that matches it. The CPU can compare the header information with the table items in the fully connected table based on the field to query the fully connected table items that match the data packet.
[0166] Through this method, the central processor queries and updates the forwarding rules and target conversion address of the data packet in the fully connected table, and can obtain the correct target conversion address, ensuring that the data packet can be correctly forwarded according to the packet header information.
[0167] In one embodiment of the present application, another data forwarding method applied to a gateway device is provided, and the data forwarding method applied to the gateway device can be executed by an integrated circuit chip. Figure 8As shown, the data forwarding method applied to the gateway device may include S710 to S730 and S810.
[0168] The following describes S810:
[0169] S810: Generate a preset session table entry corresponding to the packet header information based on the updated full connection table, so as to update the preset session table based on the preset session table entry.
[0170] After generating the updated full connection table, the central processor can generate preset session table items for the packet header information, including the first session table item, the second session table item, the third session table item and the fourth session table item of the packet header information. The central processor sends the generated preset session table items to the integrated circuit chip.
[0171] After receiving the preset session table entry, the integrated circuit chip can add the preset session table entry to the preset session table. Specifically, the first session table entry is added to the first session table, the second session table entry is added to the second session table, and so on.
[0172] Optionally, the central processing unit may also update the preset session table in the integrated circuit chip.
[0173] Through this method, the integrated circuit chip can update the preset session table in time to ensure that the packet header information of the same data packet next time can quickly query the target conversion address, thereby improving the efficiency of data packet forwarding.
[0174] In one embodiment of the present application, another data forwarding method applied to a gateway device is provided, and the data forwarding method applied to the gateway device can be executed by an integrated circuit chip. Fig. 9 As shown, the data forwarding method applied to the gateway device may include S310 to S320 and S910 to S920.
[0175] S910 to S920 are described below:
[0176] S910, updating the packet header information according to the forwarding direction corresponding to the data packet and the target conversion address to obtain updated packet header information.
[0177] The forwarding direction may be obtained by analyzing the header information of the data packet by the integrated circuit chip.
[0178] S920: forward the data packet according to the updated packet header information.
[0179] The integrated circuit chip determines the forwarding destination and forwarding path of the data packet based on the updated packet header information. According to the network environment of the forwarding path and the destination, the integrated circuit chip uses a built-in algorithm and a corresponding table to send the data packet to the corresponding address.
[0180] Among them, S910 may include S911 to S912.
[0181] S911 to S912 are described below:
[0182] S911, if the data packet is sent from the public network to the intranet, the destination IP address in the packet header information is updated to the target conversion IP address, and the destination port address in the packet header information is updated to the target conversion port address to obtain updated packet header information.
[0183] The updated packet header information reflects that the destination of the data packet is the device in the intranet, ensuring that the data packet can be correctly transmitted to the target node in the intranet.
[0184] S912, if the data packet is sent from the intranet to the public network, the source IP address in the packet header information is updated to the target conversion IP address, and the source port address in the packet header information is updated to the target conversion port address to obtain updated packet header information.
[0185] The updated packet header information reflects that the source address of the data packet is the device on the intranet, ensuring that the data packet can be correctly transmitted to the target node on the public network.
[0186] Through this method, the integrated circuit chip updates the packet header information accordingly according to the forwarding direction and target conversion address of the data packet, ensuring that the data packet is transmitted along the correct path and destination, thereby ensuring the accurate forwarding of the data packet and the normal operation of the network communication.
[0187] In one embodiment of the present application, another data forwarding method applied to a gateway device is provided. The data forwarding method applied to the gateway device can be executed by an integrated circuit chip and a central processing unit. Fig.10 As shown, the data forwarding method applied to the gateway device may include S1001 to S1014.
[0188] S1001 to S1014 are described below:
[0189] S1001, the integrated circuit chip extracts packet header information from the received data packet.
[0190] S1002: The integrated circuit chip obtains a preset session table.
[0191] S1003: The integrated circuit chip sequentially queries the first session table and the second session table based on the packet header information to obtain output address identification information and input address identification information.
[0192] If the output address identification information matching the destination IP address and the destination port address is not obtained by searching the first session table, the output address identification information corresponding to the data packet is changed to a first preset value.
[0193] If the input address identification information matching the protocol information and the source IP address is not obtained by searching the second session table, the input address identification information corresponding to the data packet is changed to a second preset value.
[0194] S1004, the integrated circuit chip searches the third session table for target conversion identification information and target conversion port address that match the output address identification information, the input address identification information, and the source port address.
[0195] If the query is successful, execute S1005; if the query is not successful, execute S1008.
[0196] S1005: The integrated circuit chip searches the fourth session table based on the target conversion identification information to obtain a target conversion IP address.
[0197] If the query is successful, execute S1006; if the query is not successful, execute S1007.
[0198] S1006, the integrated circuit chip updates the packet header information according to the forwarding direction and target conversion address corresponding to the data packet to obtain updated packet header information.
[0199] If the data packet is sent from the public network to the intranet, the destination IP address in the packet header information is updated to the target conversion IP address, and the destination port address in the packet header information is updated to the target conversion port address to obtain the updated packet header information.
[0200] If the data packet is sent from the intranet to the public network, the source IP address in the packet header information is updated to the target conversion IP address, and the source port address in the packet header information is updated to the target conversion port address to obtain updated packet header information.
[0201] After obtaining the updated packet header information, S1014 may be executed.
[0202] S1007: The integrated circuit chip discards the data packet.
[0203] S1008, the integrated circuit chip sends the data packet to the central processing unit.
[0204] S1009, the central processing unit searches the fully connected table to obtain the target conversion address corresponding to the packet header information.
[0205] If the query is successful, execute S1010; if the query is not successful, execute S1011.
[0206] S1010, the central processing unit updates the packet header information according to the forwarding direction and the target conversion address corresponding to the data packet to obtain updated packet header information.
[0207] After obtaining the updated packet header information, S1013 may be executed.
[0208] S1011, the central processing unit generates a fully connected table entry for the packet header information, adds the fully connected table entry to the fully connected table to obtain an updated fully connected table, and searches the updated fully connected table to obtain a target conversion address corresponding to the packet header information.
[0209] S1012, the central processing unit updates the packet header information according to the forwarding direction and the target conversion address corresponding to the data packet to obtain updated packet header information.
[0210] After obtaining the updated packet header information, the central processing unit may send the updated packet header information to the integrated circuit chip.
[0211] S1013, the central processing unit sends the updated packet header information to the integrated circuit chip.
[0212] S1014, the integrated circuit chip performs forwarding processing of the data packet according to the updated packet header information.
[0213] It should be noted that each step from S1001 to S1014 has been described in detail in the above embodiments and will not be repeated here.
[0214] Through this method, first, the full connection table is saved in the central processing unit, and the preset session table is saved in the integrated circuit chip, thereby reducing the storage pressure of the integrated circuit chip.
[0215] Secondly, without adding additional costs to integrated circuit chips, it supports on-demand expansion and contraction of gateway clusters, improves the storage capacity of session information, and enables integrated circuit chips to cope with data forwarding scenarios with larger traffic volumes.
[0216] Finally, when the integrated circuit chips work together with the central processor, they ensure that the data packets can be correctly forwarded from the source address to the destination address. This process involves querying and updating the session table and the fully connected table to update the packet header information according to the packet header information and forwarding flow. Through this interactive process, the data packets in the network can be transmitted according to the preset path, achieving efficient packet forwarding.
[0217] In one embodiment of the present application, another data forwarding method applied to a gateway device is provided, and the data forwarding method applied to the gateway device can be executed by an integrated circuit chip. The method is a process corresponding to when the integrated circuit chip can query all the expected information in the preset session table. Fig.11 As shown, the data forwarding method applied to the gateway device may include S1101 to S1105.
[0218] S1101 to S1105 are described below:
[0219] S1101, query the first session table (pre-session table 1) based on the destination IP address and the destination port address to obtain output address identification information (OID).
[0220] The destination IP address is matched with the external IP address (outside IP) in the first session table, and the destination port address is matched with the external port address (outside port).
[0221] S1102: Based on the protocol information and the source IP address, query the second session table (pre-session table 2) to obtain input address identification information (IID).
[0222] The protocol information is matched with the protocol (Protocol) in the second session table, and the source IP address is matched with the internal IP address (inside IP).
[0223] S1103, querying in a third session table (session table) to obtain target translation identification information (NID) and target translation port address (NAT port) that match the output address identification information (OID), the input address identification information (IID) and the source port address.
[0224] The source port address is matched with the internal port address (inside port) in the third session table.
[0225] S1104: Based on the target translation identification information (NID), query the fourth session table to obtain the target translation IP address (NAT IP).
[0226] S1105, obtaining a target translation address, the target translation address including a target translation IP address (NAT IP) and a target translation port address (NAT port).
[0227] Through this method, the central processing unit can split the full connection table into the above four session tables, namely the preset session table. Compared with the full connection table, the preset session table eliminates the repeated fields in the full connection table, uses less storage space to represent the same content as the full connection table, realizes the compression of the full connection table, and alleviates the storage pressure of the integrated circuit chip. In addition, the preset session table uses four session tables to query the conversion address, and each session table has a clear division of labor, so that the integrated circuit chip can quickly query the target conversion address in the preset session table, improving the efficiency of data packet forwarding.
[0228] Fig.12 FIG. 1 is a block diagram of a data forwarding device applied to a gateway device according to an embodiment of the present application. Fig.12 As shown, the data forwarding device applied to the gateway device includes:
[0229] The acquisition unit 1210 is used to acquire a preset session table, which is obtained by splitting repeated fields in a fully connected table stored in the central processor, and the fully connected table is used to record the conversion address used by the gateway device when forwarding a data packet;
[0230] A query unit 1220, configured to query a preset session table to obtain a target conversion address based on the header information of the received data packet;
[0231] The forwarding unit 1230 is used to forward the data packet based on the target conversion address.
[0232] In one embodiment of the present application, based on the aforementioned scheme, the preset session table includes a first session table, a second session table, a third session table and a fourth session table, and the target conversion address includes a target conversion IP address and a target conversion port address; the query unit 1220 is also used to query the output address identification information and the input address identification information from the first session table and the second session table in sequence based on the packet header information; query the target conversion identification information and the target conversion port address in the third session table based on the output address identification information, the input address identification information and the packet header information; query the target conversion identification information and the target conversion port address in the fourth session table based on the target conversion identification information.
[0233] In one embodiment of the present application, based on the aforementioned scheme, the packet header information includes a destination IP address, a destination port address, protocol information and a source IP address; the query unit 1220 is also used to query in the first session table to obtain output address identification information that matches the destination IP address and the destination port address; and to query in the second session table to obtain input address identification information that matches the protocol information and the source IP address.
[0234] In one embodiment of the present application, based on the aforementioned scheme, the processing unit 1240 is used to change the output address identification information corresponding to the data packet to a first preset value if the output address identification information matching the destination IP address and the destination port address is not queried in the first session table; and to change the input address identification information corresponding to the data packet to a second preset value if the input address identification information matching the protocol information and the source IP address is not queried in the second session table.
[0235] In one embodiment of the present application, based on the aforementioned scheme, the packet header information includes a source port address; the query unit 1220 is also used to query the third session table to obtain target conversion identification information and target conversion port address that match the output address identification information, the input address identification information and the source port address.
[0236] In one embodiment of the present application, based on the aforementioned scheme, the processing unit 1240 is used to send the data packet to the central processor if the target conversion identification information and the target conversion port address are not obtained by querying in the third session table, so that the central processor updates the packet header information to obtain updated packet header information, and the updated packet header information includes the target conversion address.
[0237] In one embodiment of the present application, based on the aforementioned scheme, the central processing unit updates the packet header information, and the process of obtaining the updated packet header information includes: querying the fully connected table to obtain the target conversion address corresponding to the packet header information; updating the packet header information according to the forwarding direction and target conversion address corresponding to the data packet to obtain the updated packet header information.
[0238] In one embodiment of the present application, based on the aforementioned scheme, the central processing unit updates the packet header information, and the process of obtaining the updated packet header information also includes: if the target conversion address corresponding to the packet header information is not obtained by querying the fully connected table, a fully connected table entry is generated for the packet header information; the fully connected table entry is added to the fully connected table to obtain an updated fully connected table; and the target conversion address corresponding to the packet header information is obtained by querying the updated fully connected table.
[0239] In one embodiment of the present application, based on the aforementioned solution, after the central processor adds the full connection table entry to the full connection table, and obtains the updated full connection table, it also includes: generating a preset session table entry corresponding to the packet header information based on the updated full connection table, so as to update the preset session table based on the preset session table entry.
[0240] In one embodiment of the present application, based on the above solution, the processing unit 1240 is configured to discard the data packet if the target conversion IP address is not obtained by searching in the fourth session table based on the target conversion identification information.
[0241] In one embodiment of the present application, based on the aforementioned scheme, the processing unit 1240 is used to update the packet header information according to the forwarding direction and target conversion address corresponding to the data packet to obtain updated packet header information; the forwarding unit 1230 is also used to perform forwarding processing of the data packet according to the updated packet header information.
[0242] In one embodiment of the present application, based on the aforementioned scheme, the processing unit 1240 is used to update the destination IP address in the packet header information to the target conversion IP address, and update the destination port address in the packet header information to the target conversion port address, if the data packet is sent from the public network to the intranet, to obtain the updated packet header information; if the data packet is sent from the intranet to the public network, the source IP address in the packet header information is updated to the target conversion IP address, and the source port address in the packet header information is updated to the target conversion port address, to obtain the updated packet header information.
[0243] It should be noted that the apparatus provided in the aforementioned embodiment and the method provided in the aforementioned embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment.
[0244] An embodiment of the present application also provides a data forwarding device applied to a gateway device, comprising: one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by one or more processors, the electronic device implements the data forwarding method applied to the gateway device as described above.
[0245] Fig.13 It is a structural diagram of a computer system of a data forwarding device applied to a gateway device suitable for implementing an embodiment of the present application.
[0246] It should be noted that Fig.13 The computer system 1300 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0247] like Fig.13As shown, the computer system 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1302 or the program loaded from the storage part 1308 to the random access memory (RAM) 1303, such as executing the method in the above embodiment. In RAM 1303, various programs and data required for system operation are also stored. CPU 1301, ROM 1302 and RAM 1303 are connected to each other through bus 1304. Input / output (I / O) interface 1305 is also connected to bus 1304.
[0248] The following components are connected to the I / O interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the I / O interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed so that a computer program read therefrom is installed into the storage section 1308 as needed.
[0249] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1309, and / or installed from a removable medium 1311. When the computer program is executed by a central processing unit (CPU) 1301, various functions defined in the system of the present application are executed.
[0250] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. Computer-readable media may be, for example, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0251] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0252] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0253] Another aspect of the present application also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the data forwarding method applied to a gateway device as described above. The computer-readable medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0254] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable medium. A processor of a computer device reads the computer instruction from the computer-readable medium, and the processor executes the computer instruction, so that the computer device executes the data forwarding method applied to a gateway device provided in each of the above embodiments.
[0255] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A data forwarding method applied to a gateway device, characterized in that: include: Acquire a preset session table, wherein the preset session table is obtained by splitting repeated fields in a fully connected table stored in a central processor, and the fully connected table is used to record the conversion address used by the gateway device when forwarding a data packet; Based on the header information of the received data packet, querying in the preset session table to obtain the target conversion address; The data packet is forwarded based on the target conversion address.
2. The method according to claim 1, characterized in that: The preset session table includes a first session table, a second session table, a third session table and a fourth session table, and the target conversion address includes a target conversion IP address and a target conversion port address; The step of querying the preset session table to obtain the target conversion address based on the header information of the received data packet includes: Based on the packet header information, query the first session table and the second session table in sequence to obtain output address identification information and input address identification information; Based on the output address identification information, the input address identification information and the packet header information, the third session table is searched to obtain the target conversion identification information and the target conversion port address; The target conversion IP address is obtained by searching the fourth session table based on the target conversion identification information.
3. The method according to claim 2, characterized in that The packet header information includes the destination IP address, destination port address, protocol information and source IP address; The obtaining the output address identification information and the input address identification information by querying the first session table and the second session table in sequence based on the packet header information includes: Querying the first session table to obtain output address identification information that matches the destination IP address and the destination port address; The input address identification information matching the protocol information and the source IP address is obtained by searching the second session table.
4. The method according to claim 3, characterized in that The method further comprises: If no output address identification information matching the destination IP address and the destination port address is obtained from the first session table, the output address identification information corresponding to the data packet is changed to a first preset value; If no input address identification information matching the protocol information and the source IP address is found in the second session table, the input address identification information corresponding to the data packet is changed to a second preset value.
5. The method according to claim 2, characterized in that: The packet header information includes a source port address; The step of querying the third session table to obtain the target conversion identification information and the target conversion port address based on the output address identification information, the input address identification information and the packet header information includes: The target conversion identification information and the target conversion port address that match the output address identification information, the input address identification information and the source port address are queried in the third session table.
6. The method according to claim 2, characterized in that The method further comprises: If the target conversion identification information and the target conversion port address are not obtained by querying the third session table, the data packet is sent to the central processor so that the central processor updates the packet header information to obtain updated packet header information, wherein the updated packet header information includes the target conversion address.
7. The method according to claim 6, characterized in that The central processor updates the packet header information to obtain the updated packet header information, and the process includes: Querying in the fully connected table to obtain the target conversion address corresponding to the packet header information; The packet header information is updated according to the forwarding direction corresponding to the data packet and the target conversion address to obtain updated packet header information.
8. The method according to claim 7, characterized in that The central processor updates the packet header information to obtain the updated packet header information, and the process further includes: If the target conversion address corresponding to the packet header information is not obtained by searching the fully connected table, generating a fully connected table entry for the packet header information; Adding the fully connected table entry to the fully connected table to obtain an updated fully connected table; The target conversion address corresponding to the packet header information is obtained by querying the updated full connection table.
9. The method according to claim 8, characterized in that After the central processor adds the fully connected table entry to the fully connected table to obtain an updated fully connected table, the method further includes: A preset session table entry corresponding to the packet header information is generated based on the updated full connection table, so as to update the preset session table based on the preset session table entry.
10. The method according to claim 2, characterized in that The method further comprises: If the target conversion IP address is not obtained by searching the fourth session table based on the target conversion identification information, the data packet is discarded.
11. The method according to claim 2, characterized in that The forwarding process of the data packet based on the target conversion address includes: According to the forwarding direction corresponding to the data packet and the target conversion address, the packet header information is updated to obtain updated packet header information; The data packet is forwarded according to the updated packet header information.
12. The method according to claim 11, characterized in that The updating of the packet header information according to the forwarding direction corresponding to the data packet and the target conversion address to obtain updated packet header information includes: If the data packet is sent from the public network to the intranet, the destination IP address in the packet header information is updated to the target conversion IP address, and the destination port address in the packet header information is updated to the target conversion port address to obtain updated packet header information; If the data packet is sent from the intranet to the public network, the source IP address in the packet header information is updated to the target conversion IP address, and the source port address in the packet header information is updated to the target conversion port address to obtain updated packet header information.
13. A data forwarding device applied to a gateway device, characterized in that: include: An acquisition unit, used for acquiring a preset session table, wherein the preset session table is obtained by splitting repeated fields in a fully connected table stored in a central processor, and the fully connected table is used for recording a conversion address used by the gateway device when forwarding a data packet; A query unit, configured to query the preset session table to obtain a target conversion address based on the header information of the received data packet; A forwarding unit is used to forward the data packet based on the target conversion address.
14. A gateway device, characterized in that: include: a memory storing computer-readable instructions; A processor reads the computer readable instructions stored in the memory to execute the method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 12.
