Traffic routing method and device, storage medium and electronic device
By adding routing information to the SYN packet in the traffic forwarding topology, the problem of fast forwarding when the traffic type and structure is uncertain is solved, efficient TCP traffic packet forwarding is achieved, and the intrusion of application layer protocols and the use of special equipment are avoided. rely.
Patent Information
- Application Number
- CN202410898471.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-05
AI Technical Summary
Existing technologies cannot achieve fast forwarding by adding specific fields and headers to the traffic when the traffic type and structure are uncertain, and solutions based on MPLS and dedicated equipment are costly and inefficient.
By receiving TCP traffic packets and SYN packets at the target access node in the traffic forwarding topology, adding routing information to the SYN packet, and forwarding based on this information, it avoids the modification of TCP traffic packets and achieves non-intrusive and efficient forwarding.
It achieves fast forwarding when traffic type and structure are uncertain, reduces the intrusion of application layer protocols, eliminates the need to build a bearer network based on dedicated software and hardware, and improves TCP traffic packet forwarding efficiency.
Smart Images

Figure CN118449905B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a traffic routing method and device, a storage medium, and an electronic device. Background Art
[0002] For network traffic-oriented applications, it is crucial to solve traffic routing problems quickly and efficiently. In telecommunications application scenarios, there are widely used traffic engineering solutions, such as MPLS (Multiprotocol Label Switching, a label-based data transmission technology used to improve the performance and efficiency of network packet transmission), SR (Segment Routing), etc. SR is a network protocol that uses source routing technology to improve the flexibility and scalability of the network. SR is mainly used in MPLS networks. In MPLS, routers in the MPLS network receive messages; routers in the MPLS network modify messages by adding one or more MPLS extension headers, adding extension header headers, and adding an indication in the MPLS label stack that one or more MPLS extension headers have been added to the message; routers in the MPLS network forward the modified messages to another router in the MPLS network, but these solutions require extending the protocol stack and building a bearer network based on proprietary equipment. This is unrealistic for Internet applications built on public / private clouds and independent data centers.
[0003] In Internet application scenarios, this type of traffic routing problem is mostly solved by application layer solutions. For single application scenarios (all network traffic is for the same application scenario, usually using the same network protocol and data structure), there are already many mature solutions, for example, by adding specific fields and headers to the traffic to achieve fast routing of network traffic. However, for pan-application scenarios (that is, the type and structure of traffic are not fixed), these solutions are powerless. On the one hand, most pan-application scenarios have higher requirements for forwarding performance, and common application layer solutions are often difficult to meet in terms of performance. On the other hand, in pan-application scenarios, it is impossible to assume the type and structure of traffic, and it is even more impossible to solve traffic forwarding problems through intrusive methods (by adding specific fields and headers to traffic).
[0004] In summary, if the existing technology wants to solve the traffic routing problem quickly and efficiently, it needs to build a bearer network based on MPLS and proprietary equipment, or it can be achieved through an intrusive method (by adding specific fields and headers to the traffic). However, these two methods have problems such as high cost and low traffic forwarding efficiency. Summary of the invention
[0005] The main purpose of the present application is to provide a traffic routing method and device, a storage medium and an electronic device to solve the problem in the related art that when the type and structure of the traffic are uncertain, it is impossible to achieve fast traffic forwarding by adding specific fields and headers to the traffic.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a traffic routing method is provided. The method comprises: receiving a TCP traffic packet and a SYN packet sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address; adding routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet; forwarding the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology; forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address.
[0007] Furthermore, before receiving the TCP traffic packets and SYN packets sent by the source address through the access node in the traffic forwarding topology, the method also includes: building multiple Linux-based initial nodes between multiple source addresses and multiple destination addresses; determining multiple access nodes and multiple forwarding nodes from the multiple initial nodes based on the geographical location information corresponding to each initial node; and building a traffic forwarding topology based on the multiple access nodes and the multiple forwarding nodes.
[0008] Furthermore, constructing a traffic forwarding topology based on multiple access nodes and multiple forwarding nodes includes: configuring a stateless firewall for each access node and each forwarding node to obtain a configured access node and a configured forwarding node; and constructing a connectivity graph based on the configured access node and the configured forwarding node to obtain a traffic forwarding topology.
[0009] Furthermore, before adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain the processed SYN packet, the method also includes: determining multiple target forwarding nodes from the target source address to the target destination address from the traffic forwarding topology; determining the routing information based on the IP addresses and port numbers of the multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address.
[0010] Furthermore, before receiving the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology, the method also includes: determining whether the TCP fast open mechanism is currently enabled and obtaining a determination result; if the TCP fast open mechanism is enabled, closing the TCP fast open mechanism.
[0011] Further, adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain the processed SYN packet includes: adding the routing information to the byte position after the TCP protocol header in the SYN packet to obtain the added SYN packet; setting the reserved field in the TCP protocol header of the added SYN packet to a first value to obtain the processed SYN packet, wherein the first value is used to characterize that the processed SYN packet stores the routing information.
[0012] Further, forwarding the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology includes: forwarding the processed SYN packet to the first target forwarding node in the routing information through the target access node; determining whether the next hop is a forwarding node based on the current pointer position in the routing information through the first target forwarding node, and determining the second target forwarding node when the next hop is a forwarding node; performing source address conversion and destination address conversion on the processed SYN packet through the first target forwarding node, and recording the source address conversion and destination address conversion in the address conversion record; forwarding the converted SYN packet to the second target forwarding node, and determining whether the next hop is a forwarding node based on the current pointer position in the routing information through the second target forwarding node, until the converted SYN packet is forwarded to the target destination address.
[0013] Furthermore, the forwarding process of forwarding the TCP traffic packet to the target destination address based on the processed SYN packet includes: forwarding the data packet returned by the target destination address based on the converted SYN packet back to the target source address according to the source address translation and destination address translation recorded in the address translation record to establish a session between the target source address and the target destination address; forwarding the TCP traffic packet to the target destination address according to the source address translation and destination address translation and the session recorded in the address translation record.
[0014] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a traffic routing device is provided. The device includes: a receiving unit, which is used to receive a TCP traffic packet and a SYN packet sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address; an adding unit, which is used to add the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet; a first forwarding unit, which is used to forward the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology; a second forwarding unit, which is used to forward the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address.
[0015] Furthermore, the device also includes: a building unit, which is used to build multiple Linux-based initial nodes between multiple source addresses and multiple destination addresses before receiving TCP traffic packets and SYN packets sent by the source address through the access node in the traffic forwarding topology; a first determination unit, which is used to determine multiple access nodes and multiple forwarding nodes from multiple initial nodes based on the geographical location information corresponding to each initial node; and a construction unit, which is used to build a traffic forwarding topology based on the multiple access nodes and the multiple forwarding nodes.
[0016] Furthermore, the construction unit includes: a configuration module, which is used to configure a stateless firewall for each access node and each forwarding node to obtain the configured access node and the configured forwarding node; a construction module, which is used to construct a connectivity graph based on the configured access node and the configured forwarding node to obtain a traffic forwarding topology.
[0017] Furthermore, the device also includes: a second determination unit, used to determine multiple target forwarding nodes from the target source address to the target destination address from the traffic forwarding topology before adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain the processed SYN packet; a third determination unit, used to determine the routing information based on the IP addresses and port numbers of the multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address.
[0018] Furthermore, the device also includes: a judgment unit, which is used to judge whether the TCP fast open mechanism is currently enabled before receiving the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology, and obtain a judgment result; a closing unit, which is used to close the TCP fast open mechanism if the TCP fast open mechanism is enabled.
[0019] Furthermore, the adding unit includes: an adding module, used to add routing information to the byte position after the TCP protocol header in the SYN packet to obtain the added SYN packet; a setting module, used to set the reserved field in the TCP protocol header of the added SYN packet to a first value to obtain a processed SYN packet, wherein the first value is used to characterize that the processed SYN packet stores routing information.
[0020] Furthermore, the first forwarding unit includes: a first forwarding module, used to forward the processed SYN packet to the first target forwarding node in the routing information through the target access node; a determination module, used to determine whether the next hop is a forwarding node based on the current pointer position in the routing information through the first target forwarding node, and determine the second target forwarding node when the next hop is a forwarding node; a conversion module, used to perform source address conversion and destination address conversion on the processed SYN packet through the first target forwarding node, and record the source address conversion and destination address conversion in the address conversion record; a second forwarding module, used to forward the converted SYN packet to the second target forwarding node, and determine whether the next hop is a forwarding node based on the current pointer position in the routing information through the second target forwarding node, until the converted SYN packet is forwarded to the target destination address.
[0021] Furthermore, the second forwarding unit includes: a third forwarding module, used to forward the data packet returned by the target destination address based on the converted SYN packet back to the target source address according to the source address translation and destination address translation recorded in the address translation record, so as to establish a session between the target source address and the target destination address; a fourth forwarding module, used to forward the TCP traffic packet to the target destination address according to the source address translation and destination address translation and the session recorded in the address translation record.
[0022] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a program, wherein when the program is running, the device where the storage medium is located is controlled to execute any one of the above-mentioned traffic routing methods.
[0023] In order to achieve the above-mentioned purpose, according to another aspect of the present application, an electronic device is also provided, the electronic device includes one or more processors and a memory, and the memory is used to store a traffic routing method implemented by one or more processors to implement any of the above-mentioned items.
[0024] Through the present application, the following steps are adopted: receiving the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address; adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet; forwarding the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology; forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address, thereby solving the problem in the related art that when the type and structure of the traffic are uncertain, it is impossible to achieve fast traffic forwarding by adding specific fields and headers to the traffic.
[0025] In this scheme, when it is necessary to send a TCP traffic packet from a target source address to a target destination address, the TCP traffic packet and the SYN packet are received by the target access node in the traffic forwarding topology, and then the target access node adds the routing information from the target source address and the target destination address to the SYN packet, and then the processed SYN packet is forwarded to the target destination address based on the routing information by the target access node and the target forwarding node in the traffic forwarding topology, thereby realizing the forwarding process based on the processed SYN packet to forward the TCP traffic packet to the target destination address. By adding routing information to the SYN packet, the modification of the TCP traffic packet is avoided, there is no intrusion to the application layer protocol, and there is no need to build a bearer network based on dedicated software and hardware. The target forwarding node can quickly obtain the corresponding routing information based on the SYN packet, thereby achieving the effect of improving the forwarding efficiency of the TCP traffic packet. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0027] Figure 1 The flow chart of the traffic routing method provided in the embodiment of the present application is as follows: Figure 1 ;
[0028] Figure 2 The flow chart of the traffic routing method provided in the embodiment of the present application is as follows: Figure 2 ;
[0029] Figure 3 is a schematic diagram of a traffic routing device provided according to an embodiment of the present application;
[0030] Figure 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0032] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0035] TCP, short for Transmission Control Protocol, is a connection-oriented, reliable, byte-stream-based transport layer protocol. The TCP protocol plays an important role in computer networks. It is used to establish connections between different hosts in the network, transmit data, and ensure reliable data transmission. The TCP protocol achieves reliable data transmission by establishing connections, transmitting data, and disconnecting connections, ensuring data integrity and sequence. The TCP protocol is part of the Internet protocol suite (TCP / IP protocol stack) and is commonly used to transmit web pages, e-mails, and other applications. TCP traffic packets are data packets transmitted through the TCP protocol.
[0036] SYN packet is a data packet used to establish a connection in the TCP protocol. Its full name is Synchronize packet. During the TCP three-way handshake process, the client sends a SYN packet to the server, indicating a request to establish a connection; after receiving the SYN packet, the server will reply with a SYN-ACK packet, indicating confirmation of receiving the connection request and agreeing to establish the connection; finally, the client sends an ACK packet again, indicating confirmation of receiving the server's confirmation, and the connection establishment is complete.
[0037] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0038] The present invention is described below in conjunction with preferred implementation steps. Figure 1 The flow chart of the traffic routing method provided in the embodiment of the present application is as follows: Figure 1 ,like Figure 1 As shown, the method comprises the following steps:
[0039] Step S101: receiving a TCP traffic packet and a SYN packet sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address.
[0040] Optionally, in the scenarios to which this application is applicable, the bearer network usually spans one or more public / private clouds and data center networks, which can carry actual user services or simply be used as network forwarding. In order to achieve fast forwarding of TCP traffic packets, a Linux-based traffic forwarding topology is built in these networks. It should be noted that the traffic forwarding topology consists of multiple access nodes and forwarding nodes.
[0041] When a user needs to access B (i.e., the above-mentioned target source address) from A (i.e., the above-mentioned target destination address), the traffic packet accessed by the user (e.g., the above-mentioned TCP traffic packet) can be forwarded to B through the above-mentioned traffic forwarding topology. Specifically, it includes: receiving the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology. It should be noted that the SYN packet is used to establish a session between the target source address and the target destination address, which is the TCP three-way handshake process.
[0042] Step S102: adding routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet.
[0043] Optionally, after the target access node receives the TCP traffic packet and the SYN packet, the target access node will add the segment route from the target source address to the target destination address (i.e., the above-mentioned routing information) to the SYN packet, and the SYN packet can be quickly forwarded to the target destination address through the segment route from the target source address to the target destination address. It should be noted that the access node in the traffic forwarding topology can store segment routes from different source addresses to different destination addresses, and the segment routes from different source addresses to different destination addresses can be transmitted to the access node by the routing controller.
[0044] Step S103: forwarding the processed SYN packet to the target destination address through the target access node and the target forwarding node in the traffic forwarding topology based on the routing information.
[0045] Optionally, according to the above segment routing from the target source address to the target destination address (ie the above routing information), the processed SYN packet is forwarded to the target destination address through the target access node and the target forwarding node in the traffic forwarding topology.
[0046] Step S104, forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address.
[0047] Optionally, after forwarding the SYN packet to the target destination address, the target destination address will reply with a SYN-ACK packet after receiving the SYN packet, and this SYN-ACK packet can be forwarded back to the target destination address according to the forwarding process of the SYN packet; finally, the target destination address sends an ACK packet, and the ACK packet can also be sent to the target destination address according to the forwarding process of the SYN packet to establish a session between the target source address and the target destination address, and then forward the TCP traffic packet to the target destination address according to the forwarding process of the SYN packet. After the TCP traffic packet is forwarded to the target destination address, the TCP traffic packet is processed by the target application in the target destination address.
[0048] It should be noted that, in the subsequent TCP traffic packets from the target source address to the target destination address, all can be quickly forwarded based on the forwarding process of the SYN packet.
[0049] In summary, when it is necessary to send a TCP traffic packet from a target source address to a target destination address, the TCP traffic packet and the SYN packet are received by the target access node in the traffic forwarding topology, and then the target access node adds the routing information from the target source address and the target destination address to the SYN packet, and then the processed SYN packet is forwarded to the target destination address based on the routing information by the target access node and the target forwarding node in the traffic forwarding topology, thereby realizing the forwarding process based on the processed SYN packet to forward the TCP traffic packet to the target destination address. By adding routing information to the SYN packet, the modification of the TCP traffic packet is avoided, there is no intrusion to the application layer protocol, and there is no need to build a bearer network based on dedicated software and hardware. The target forwarding node can quickly obtain the corresponding routing information based on the SYN packet, thereby achieving the effect of improving the forwarding efficiency of the TCP traffic packet.
[0050] Optionally, in the traffic routing method provided in an embodiment of the present application, before receiving TCP traffic packets and SYN packets sent by a source address through an access node in a traffic forwarding topology, the method also includes: building multiple Linux-based initial nodes between multiple source addresses and multiple destination addresses; determining multiple access nodes and multiple forwarding nodes from the multiple initial nodes based on the geographic location information corresponding to each initial node; and building a traffic forwarding topology based on the multiple access nodes and the multiple forwarding nodes.
[0051] In an optional embodiment, the following steps are used to construct a traffic forwarding topology: clarify the current multiple source addresses and multiple destination addresses. Since public / private clouds and data center networks can carry actual user services or simply be used for network forwarding, Linux-based soft routing devices (i.e., the multiple initial nodes mentioned above) can be built on these networks.
[0052] For example, the initial nodes include N1, N2, N3, N4...Nn, and a subset of N1 to Nn can be defined as an access node set, that is, based on the geographical location information corresponding to each initial node, multiple access nodes and multiple forwarding nodes are determined from multiple initial nodes. Generally, the initial nodes that are geographically located at the edge are defined as access nodes to receive user traffic packets.
[0053] Finally, a traffic forwarding topology is built through multiple access nodes and multiple forwarding nodes. Pure software routing and forwarding are achieved through Linux-based soft routing devices, which reduces the cost of traffic routing without the need to build a bearer network based on dedicated software and hardware.
[0054] Optionally, in the traffic routing method provided in an embodiment of the present application, constructing a traffic forwarding topology based on multiple access nodes and multiple forwarding nodes includes: configuring a stateless firewall for each access node and each forwarding node to obtain a configured access node and a configured forwarding node; and constructing a connectivity graph based on the configured access node and the configured forwarding node to obtain a traffic forwarding topology.
[0055] In an optional embodiment, in order to ensure the forwarding of TCP traffic packets, building a traffic forwarding topology based on multiple access nodes and multiple forwarding nodes includes the following steps: configuring a stateless firewall for each access node and each forwarding node. Building a connectivity graph by connecting the configured access nodes and the configured forwarding nodes to obtain a traffic forwarding topology. It should be noted that the nodes can be connected based on an intranet, an operator's public network, or a private network. A stateless firewall is a network security device that filters data packets at the network layer but does not track or store session information.
[0056] The stateless firewall ensures that the TCP traffic packet can be forwarded to the target destination address according to the forwarding process of the SYN packet.
[0057] Optionally, in the traffic routing method provided in an embodiment of the present application, before adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain the processed SYN packet, the method also includes: determining multiple target forwarding nodes from the target source address to the target destination address from the traffic forwarding topology; determining the routing information based on the IP addresses and port numbers of the multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address.
[0058] In an optional embodiment, considering that the present application is built on the TCP protocol, the segment routing (i.e., the above-mentioned routing information) needs to include port information in addition to the IP address information. Therefore, multiple target forwarding nodes from the target source address to the target destination address are determined from the current traffic forwarding topology. In an optional embodiment, the segment routing from the target source address to the target destination address can be allocated by the routing controller. For example, the segment routing allocated by the routing controller is N1 (the above-mentioned target access node), N3, N5, N7, D1 (the above-mentioned target destination address). Then, the IP addresses and port numbers of S1 (the above-mentioned target source address), N3, N5, N7, and D1 will be written into the segment routing, that is, the above-mentioned routing information is determined based on the IP addresses and port numbers of multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address.
[0059] In an optional embodiment, the structure of the routing information is shown in Table 1:
[0060] Table 1
[0061]
[0062] Among them, cur is used to indicate which forwarding node is currently located, and then determine which forwarding node is the next hop. After obtaining the IP addresses and port numbers of the above-mentioned multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address, these IP addresses and port numbers are added to the structure shown in Table 1 to obtain the above-mentioned routing information.
[0063] The above routing information can be used to quickly forward traffic packets.
[0064] Optionally, in the traffic routing method provided in an embodiment of the present application, before receiving the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology, the method also includes: determining whether the TCP fast open mechanism is currently enabled and obtaining a determination result; if the TCP fast open mechanism is enabled, then closing the TCP fast open mechanism.
[0065] In an optional embodiment, before the user sends a TCP traffic packet and a SYN packet, it is necessary to first determine whether the TCP Fast Open mechanism is currently enabled. If the TCP Fast Open mechanism is enabled, the SYN packet sent will contain data, which will affect the operation of this solution. Therefore, in order to avoid this conflict, it is necessary to turn off the TCP FastOpen option, that is, turn off the TCP Fast Open mechanism, and send the TCP traffic packet and SYN packet when it is turned off.
[0066] Optionally, in the traffic routing method provided in an embodiment of the present application, the routing information between the target source address and the target destination address is added to the SYN packet through the target access node to obtain the processed SYN packet, including: adding the routing information to the byte position after the TCP protocol header in the SYN packet to obtain the added SYN packet; setting the reserved field in the TCP protocol header of the added SYN packet to a first value to obtain the processed SYN packet, wherein the first value is used to characterize that the routing information is stored in the processed SYN packet.
[0067] In an optional embodiment, in order not to affect the transmission of the SYN packet, the routing information is added to the SYN packet in the following manner: the routing information is added to the byte position after the TCP protocol header in the SYN packet to obtain the added SYN packet. The structure of the SYN packet after adding the routing information is shown in Table 2:
[0068] Table 2
[0069]
[0070] Although both IPv4 and TCP protocol headers are designed with Options fields (optional fields), directly extending the IPv4 and TCP headers in the traffic will increase the length of the modified network frame. When the length of the original network frame is close to 1450 bytes, the additionally filled Options field is likely to cause the network frame length to exceed the MTU, resulting in IP fragmentation and greatly slowing down network performance. Therefore, this solution uses TCP's payload rather than the protocol header to store segment routing data. Considering that the TCP protocol will first perform a three-way handshake during the session establishment phase, the first SYN packet does not usually contain a payload (except in the Fast Open scenario). That is, the packet only contains a 20-byte IP protocol header and a 20-byte TCP protocol header, a total of 40 bytes, which is much smaller than the 1450 bytes mentioned above. This provides enough space to fill the routing data, so the routing information is added to the byte position after the TCP protocol header in the SYN packet.
[0071] In order to facilitate the subsequent forwarding nodes to quickly determine whether the SYN packet has been filled with segment routing, the reserved field in the TCP header is used, and its highest bit is used as TIR (There is a route). When TIR is 1, it indicates that the packet contains segment routing information, otherwise it is 0, that is, the reserved field in the TCP protocol header of the added SYN packet is set to the first value to obtain the processed SYN packet. It should be noted that after modifying the TIR bit, the TCP Checksum and IP Checksum need to be recalculated.
[0072] The above steps are used to add routing information to the SYN packet without affecting the transmission of the SYN packet or the data transmission speed.
[0073] Optionally, in the traffic routing method provided in an embodiment of the present application, forwarding the processed SYN packet to the target destination address based on routing information through the target access node and the target forwarding node in the traffic forwarding topology includes: forwarding the processed SYN packet to the first target forwarding node in the routing information through the target access node; determining whether the next hop is a forwarding node based on the current pointer position in the routing information through the first target forwarding node, and determining the second target forwarding node if the next hop is a forwarding node; performing source address conversion and destination address conversion on the processed SYN packet through the first target forwarding node, and recording the source address conversion and destination address conversion in the address conversion record; forwarding the converted SYN packet to the second target forwarding node, and determining whether the next hop is a forwarding node based on the current pointer position in the routing information through the second target forwarding node, until the converted SYN packet is forwarded to the target destination address.
[0074] In an optional embodiment, the processed SYN packet is forwarded to the target destination address through the following steps: after the target access node adds the routing information to the SYN packet, the target access node forwards the processed SYN packet to the first target forwarding node in the routing information, and the first target forwarding node determines the target IP and port number of the next hop based on the segment routing and cur (current pointer), and determines whether the next hop is a forwarding node. DNAT and SNAT (i.e., the above-mentioned source address conversion and destination address conversion) are performed on the SYN packet. After the conversion, the first target forwarding node needs to add cur so that the subsequent forwarding node can determine the target IP and port number of the next hop.
[0075] It should be noted that after the above processing is completed, it is also necessary to recalculate the TCP Checksum and IP Checksum.
[0076] In the case where the next hop is a forwarding node, the first target forwarding node forwards the converted SYN packet to the second target forwarding node, and the second target forwarding node performs the same processing as the first target forwarding node until the converted SYN packet is forwarded to the target destination address.
[0077] It should be noted that when DNAT and SNAT are performed on SYN packets, DNAT and SNAT can be recorded in conntrack (a module in the Linux kernel used to record NAT table entries), that is, recorded in the address translation record.
[0078] The above steps realize the fast forwarding of SYN packets.
[0079] Optionally, in the traffic routing method provided in an embodiment of the present application, forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet includes: forwarding the data packet returned by the target destination address based on the converted SYN packet back to the target source address according to the source address conversion and destination address conversion recorded in the address conversion record to establish a session between the target source address and the target destination address; forwarding the TCP traffic packet to the target destination address according to the source address conversion and destination address conversion and the session recorded in the address conversion record.
[0080] In an optional embodiment, since SYN has been DNAT and SNATed at each forwarding node during the routing process, the return traffic will be reverse DNAT and reverse SNATed according to the NAT record recorded in conntrack (a module in the Linux kernel used to record NAT table entries). Therefore, after the SYN packet is forwarded to the target destination address, the target destination address will reply with a SYN-ACK packet after receiving the SYN packet, and this SYN-ACK packet can be forwarded to the target destination address according to the forwarding process of the SYN packet; finally, the target destination address sends another ACK packet, and the ACK packet can also be sent to the target destination address according to the forwarding process of the SYN packet to establish a session between the target source address and the target destination address. Then, the TCP traffic packet is forwarded to the target destination address according to the forwarding process of the SYN packet. After the TCP traffic packet is forwarded to the target destination address, the TCP traffic packet is processed by the target application in the target destination address.
[0081] In an optional embodiment, the Figure 2 The flowchart shown implements traffic routing: traffic enters the access node, the access node determines whether it is TCP traffic, if it is TCP traffic, the access node writes segment routing data to the SYN packet, starts forwarding based on segment routing, the forwarding node performs network address forwarding (NAT) and self-increments cur, and determines whether the next hop is a forwarding node, if it is a forwarding node, repeats network address forwarding and self-increments cur, if not, the target service in the destination address has been reached, and the traffic is processed by the target service. The traffic routing method provided by the embodiment of the present application performs lossless extension of the TCP protocol, is non-invasive to the application layer protocol, is compatible with the existing Ethernet architecture, and does not need to build a bearer network based on dedicated software and hardware, and can transmit traffic packets more efficiently through network address translation technology.
[0082] The traffic routing method provided by the embodiment of the present application receives TCP traffic packets and SYN packets sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address; the routing information between the target source address and the target destination address is added to the SYN packet through the target access node to obtain a processed SYN packet; the processed SYN packet is forwarded to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology; the TCP traffic packet is forwarded to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address, thereby solving the problem in the related art that when the type and structure of the traffic are uncertain, it is impossible to achieve fast traffic forwarding by adding specific fields and headers to the traffic.
[0083] In this scheme, when it is necessary to send a TCP traffic packet from a target source address to a target destination address, the TCP traffic packet and the SYN packet are received by the target access node in the traffic forwarding topology, and then the target access node adds the routing information from the target source address and the target destination address to the SYN packet, and then the processed SYN packet is forwarded to the target destination address based on the routing information by the target access node and the target forwarding node in the traffic forwarding topology, thereby realizing the forwarding process based on the processed SYN packet to forward the TCP traffic packet to the target destination address. By adding routing information to the SYN packet, the modification of the TCP traffic packet is avoided, there is no intrusion to the application layer protocol, and there is no need to build a bearer network based on dedicated software and hardware. The target forwarding node can quickly obtain the corresponding routing information based on the SYN packet, thereby achieving the effect of improving the forwarding efficiency of the TCP traffic packet.
[0084] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0085] The embodiment of the present application also provides a traffic routing device. It should be noted that the traffic routing device of the embodiment of the present application can be used to execute the traffic routing method provided in the embodiment of the present application. The traffic routing device provided in the embodiment of the present application is introduced below.
[0086] Figure 3 Schematic diagram of a traffic routing device according to an embodiment of the present application. Figure 3 As shown, the device includes: a receiving unit 301, an adding unit 302, a first forwarding unit 303 and a second forwarding unit 304.
[0087] The receiving unit 301 is used to receive a TCP traffic packet and a SYN packet sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address;
[0088] An adding unit 302 is used to add routing information between a target source address and a target destination address to a SYN packet through a target access node to obtain a processed SYN packet;
[0089] A first forwarding unit 303, configured to forward the processed SYN packet to a target destination address through a target access node and a target forwarding node in a traffic forwarding topology based on routing information;
[0090] The second forwarding unit 304 is used to forward the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address.
[0091] The traffic routing device provided in the embodiment of the present application receives the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology through the receiving unit 301, wherein the SYN packet is used to establish a session between the target source address and the target destination address; the adding unit 302 adds the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet; the first forwarding unit 303 forwards the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology; the second forwarding unit 304 forwards the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address, thereby solving the problem in the related art that when the type and structure of the traffic are uncertain, it is impossible to achieve fast traffic forwarding by adding specific fields and headers to the traffic.
[0092] In this scheme, when it is necessary to send a TCP traffic packet from a target source address to a target destination address, the TCP traffic packet and the SYN packet are received by the target access node in the traffic forwarding topology, and then the target access node adds the routing information from the target source address and the target destination address to the SYN packet, and then the processed SYN packet is forwarded to the target destination address based on the routing information by the target access node and the target forwarding node in the traffic forwarding topology, thereby realizing the forwarding process based on the processed SYN packet to forward the TCP traffic packet to the target destination address. By adding routing information to the SYN packet, the modification of the TCP traffic packet is avoided, there is no intrusion to the application layer protocol, and there is no need to build a bearer network based on dedicated software and hardware. The target forwarding node can quickly obtain the corresponding routing information based on the SYN packet, thereby achieving the effect of improving the forwarding efficiency of the TCP traffic packet.
[0093] Optionally, in the traffic routing device provided in the embodiment of the present application, the device also includes: a building unit, used to build multiple Linux-based initial nodes between multiple source addresses and multiple destination addresses before receiving TCP traffic packets and SYN packets sent by the source address through the access node in the traffic forwarding topology; a first determination unit, used to determine multiple access nodes and multiple forwarding nodes from multiple initial nodes based on the geographic location information corresponding to each initial node; and a construction unit, used to build a traffic forwarding topology based on the multiple access nodes and the multiple forwarding nodes.
[0094] Optionally, in the traffic routing device provided in the embodiment of the present application, the construction unit includes: a configuration module, used to configure a stateless firewall for each access node and each forwarding node to obtain a configured access node and a configured forwarding node; a construction module, used to construct a connectivity graph based on the configured access node and the configured forwarding node to obtain a traffic forwarding topology.
[0095] Optionally, in the traffic routing device provided in the embodiment of the present application, the device also includes: a second determination unit, used to determine multiple target forwarding nodes from the target source address to the target destination address from the traffic forwarding topology before adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain the processed SYN packet; a third determination unit, used to determine the routing information based on the IP addresses and port numbers of the multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address.
[0096] Optionally, in the traffic routing device provided in the embodiment of the present application, the device also includes: a judgment unit, used to judge whether the TCP fast open mechanism is currently enabled before receiving the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology, and obtain a judgment result; a closing unit, used to close the TCP fast open mechanism if the TCP fast open mechanism is enabled.
[0097] Optionally, in the traffic routing device provided in the embodiment of the present application, the adding unit includes: an adding module, used to add routing information to the byte position after the TCP protocol header in the SYN packet to obtain the added SYN packet; a setting module, used to set the reserved field in the TCP protocol header of the added SYN packet to a first value to obtain a processed SYN packet, wherein the first value is used to characterize that the processed SYN packet stores routing information.
[0098] Optionally, in the traffic routing device provided in the embodiment of the present application, the first forwarding unit includes: a first forwarding module, used to forward the processed SYN packet to the first target forwarding node in the routing information through the target access node; a determination module, used to determine whether the next hop is a forwarding node based on the current pointer position in the routing information through the first target forwarding node, and determine the second target forwarding node when the next hop is a forwarding node; a conversion module, used to perform source address conversion and destination address conversion on the processed SYN packet through the first target forwarding node, and record the source address conversion and destination address conversion in the address conversion record; a second forwarding module, used to forward the converted SYN packet to the second target forwarding node, and determine whether the next hop is a forwarding node through the second target forwarding node based on the current pointer position in the routing information, until the converted SYN packet is forwarded to the target destination address.
[0099] Optionally, in the traffic routing device provided in an embodiment of the present application, the second forwarding unit includes: a third forwarding module, used to forward the data packet returned by the target destination address based on the converted SYN packet back to the target source address according to the source address translation and destination address translation recorded in the address translation record, so as to establish a session between the target source address and the target destination address; a fourth forwarding module, used to forward the TCP traffic packet to the target destination address according to the source address translation and destination address translation and the session recorded in the address translation record.
[0100] The traffic routing device includes a processor and a memory. The above-mentioned receiving unit 301, adding unit 302, first forwarding unit 303 and second forwarding unit 304 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0101] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the fast forwarding of traffic can be achieved by adjusting the kernel parameters.
[0102] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0103] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, a traffic routing method is implemented.
[0104] An embodiment of the present invention provides a processor, which is used to run a program, wherein a traffic routing method is executed when the program is running.
[0105] like Figure 4 As shown, an embodiment of the present invention provides an electronic device, the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: receiving a TCP traffic packet and a SYN packet sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address; adding routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet; forwarding the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology; forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address.
[0106] Optionally, before receiving TCP traffic packets and SYN packets sent by the source address through the access node in the traffic forwarding topology, the method also includes: building multiple Linux-based initial nodes between multiple source addresses and multiple destination addresses; determining multiple access nodes and multiple forwarding nodes from the multiple initial nodes based on the geographical location information corresponding to each initial node; and building a traffic forwarding topology based on the multiple access nodes and the multiple forwarding nodes.
[0107] Optionally, constructing a traffic forwarding topology based on multiple access nodes and multiple forwarding nodes includes: configuring a stateless firewall for each access node and each forwarding node to obtain a configured access node and a configured forwarding node; and constructing a connectivity graph based on the configured access nodes and the configured forwarding nodes to obtain a traffic forwarding topology.
[0108] Optionally, before adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain the processed SYN packet, the method also includes: determining multiple target forwarding nodes from the target source address to the target destination address from the traffic forwarding topology; determining the routing information based on the IP addresses and port numbers of the multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address.
[0109] Optionally, before receiving the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology, the method also includes: determining whether the TCP fast open mechanism is currently enabled and obtaining a determination result; if the TCP fast open mechanism is enabled, closing the TCP fast open mechanism.
[0110] Optionally, adding routing information between a target source address and a target destination address to a SYN packet through a target access node to obtain a processed SYN packet includes: adding routing information to a byte position after a TCP protocol header in the SYN packet to obtain an added SYN packet; setting a reserved field in a TCP protocol header of the added SYN packet to a first value to obtain a processed SYN packet, wherein the first value is used to characterize that routing information is stored in the processed SYN packet.
[0111] Optionally, forwarding the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology includes: forwarding the processed SYN packet to the first target forwarding node in the routing information through the target access node; determining whether the next hop is a forwarding node based on the current pointer position in the routing information through the first target forwarding node, and determining the second target forwarding node when the next hop is a forwarding node; performing source address conversion and destination address conversion on the processed SYN packet through the first target forwarding node, and recording the source address conversion and destination address conversion in the address conversion record; forwarding the converted SYN packet to the second target forwarding node, and determining whether the next hop is a forwarding node based on the current pointer position in the routing information through the second target forwarding node, until the converted SYN packet is forwarded to the target destination address.
[0112] Optionally, forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet includes: forwarding the data packet returned by the target destination address based on the converted SYN packet back to the target source address according to the source address translation and destination address translation recorded in the address translation record to establish a session between the target source address and the target destination address; forwarding the TCP traffic packet to the target destination address according to the source address translation and destination address translation and the session recorded in the address translation record.
[0113] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0114] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that is initialized with the following method steps: receiving a TCP traffic packet and a SYN packet sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address; adding routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet; forwarding the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology; forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by the target application in the target destination address.
[0115] Optionally, before receiving TCP traffic packets and SYN packets sent by the source address through the access node in the traffic forwarding topology, the method also includes: building multiple Linux-based initial nodes between multiple source addresses and multiple destination addresses; determining multiple access nodes and multiple forwarding nodes from the multiple initial nodes based on the geographical location information corresponding to each initial node; and building a traffic forwarding topology based on the multiple access nodes and the multiple forwarding nodes.
[0116] Optionally, constructing a traffic forwarding topology based on multiple access nodes and multiple forwarding nodes includes: configuring a stateless firewall for each access node and each forwarding node to obtain a configured access node and a configured forwarding node; and constructing a connectivity graph based on the configured access nodes and the configured forwarding nodes to obtain a traffic forwarding topology.
[0117] Optionally, before adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain the processed SYN packet, the method also includes: determining multiple target forwarding nodes from the target source address to the target destination address from the traffic forwarding topology; determining the routing information based on the IP addresses and port numbers of the multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address.
[0118] Optionally, before receiving the TCP traffic packet and SYN packet sent by the target source address through the target access node in the traffic forwarding topology, the method also includes: determining whether the TCP fast open mechanism is currently enabled and obtaining a determination result; if the TCP fast open mechanism is enabled, closing the TCP fast open mechanism.
[0119] Optionally, adding routing information between a target source address and a target destination address to a SYN packet through a target access node to obtain a processed SYN packet includes: adding routing information to a byte position after a TCP protocol header in the SYN packet to obtain an added SYN packet; setting a reserved field in a TCP protocol header of the added SYN packet to a first value to obtain a processed SYN packet, wherein the first value is used to characterize that routing information is stored in the processed SYN packet.
[0120] Optionally, forwarding the processed SYN packet to the target destination address based on the routing information through the target access node and the target forwarding node in the traffic forwarding topology includes: forwarding the processed SYN packet to the first target forwarding node in the routing information through the target access node; determining whether the next hop is a forwarding node based on the current pointer position in the routing information through the first target forwarding node, and determining the second target forwarding node when the next hop is a forwarding node; performing source address conversion and destination address conversion on the processed SYN packet through the first target forwarding node, and recording the source address conversion and destination address conversion in the address conversion record; forwarding the converted SYN packet to the second target forwarding node, and determining whether the next hop is a forwarding node based on the current pointer position in the routing information through the second target forwarding node, until the converted SYN packet is forwarded to the target destination address.
[0121] Optionally, forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet includes: forwarding the data packet returned by the target destination address based on the converted SYN packet back to the target source address according to the source address translation and destination address translation recorded in the address translation record to establish a session between the target source address and the target destination address; forwarding the TCP traffic packet to the target destination address according to the source address translation and destination address translation and the session recorded in the address translation record.
[0122] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0123] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0124] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0126] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0127] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0128] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0129] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0130] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0131] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A traffic routing method, characterized in that: include: Receiving a TCP traffic packet and a SYN packet sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and the target destination address; Adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet; forwarding the processed SYN packet to the target destination address through the target access node and the target forwarding node in the traffic forwarding topology based on the routing information; forwarding the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by a target application in the target destination address; Wherein, adding the routing information between the target source address and the target destination address to the SYN packet through the target access node, and obtaining the processed SYN packet includes: Add the routing information to the byte position after the TCP protocol header in the SYN packet to obtain the added SYN packet; The reserved field in the TCP protocol header of the added SYN packet is set to a first value to obtain the processed SYN packet, wherein the first value is used to indicate that the processed SYN packet stores the routing information.
2. The method according to claim 1, characterized in that: Before receiving the TCP traffic packet and the SYN packet sent by the source address through the access node in the traffic forwarding topology, the method further includes: Build multiple Linux-based initial nodes between multiple source addresses and multiple destination addresses; Determining a plurality of access nodes and a plurality of forwarding nodes from the plurality of initial nodes according to the geographical location information corresponding to each initial node; The traffic forwarding topology is constructed according to the multiple access nodes and the multiple forwarding nodes.
3. The method according to claim 2, characterized in that Constructing the traffic forwarding topology according to the multiple access nodes and the multiple forwarding nodes includes: A stateless firewall is configured for each access node and each forwarding node to obtain a configured access node and a configured forwarding node; A connectivity graph is constructed based on the configured access nodes and the configured forwarding nodes to obtain the traffic forwarding topology.
4. The method according to claim 1, characterized in that Before adding the routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain the processed SYN packet, the method further includes: Determine a plurality of target forwarding nodes from the target source address to the target destination address from the traffic forwarding topology; The routing information is determined according to the IP addresses and port numbers of the multiple target forwarding nodes, the IP address and port number of the target source address, and the IP address and port number of the target destination address.
5. The method according to claim 1, characterized in that Before receiving the TCP traffic packet and the SYN packet sent by the target source address through the target access node in the traffic forwarding topology, the method further includes: Determine whether the TCP fast open mechanism is currently enabled and obtain the determination result; If the TCP fast open mechanism is enabled, the TCP fast open mechanism is disabled.
6. The method according to claim 1, characterized in that Forwarding the processed SYN packet to the target destination address through the target access node and the target forwarding node in the traffic forwarding topology based on the routing information includes: forwarding the processed SYN packet to a first target forwarding node in the routing information through the target access node; Determine, by the first target forwarding node, whether the next hop is a forwarding node based on the current pointer position in the routing information, and determine a second target forwarding node if the next hop is a forwarding node; Performing source address translation and destination address translation on the processed SYN packet through the first target forwarding node, and recording the source address translation and destination address translation into an address translation record; The converted SYN packet is forwarded to the second target forwarding node, and the second target forwarding node determines whether the next hop is a forwarding node based on the current pointer position in the routing information, until the converted SYN packet is forwarded to the target destination address.
7. The method according to claim 6, characterized in that The forwarding process of forwarding the TCP traffic packet to the target destination address based on the processed SYN packet includes: According to the source address translation and the destination address translation recorded in the address translation record, forward the data packet returned by the target destination address based on the translated SYN packet back to the target source address to establish a session between the target source address and the target destination address; According to the source address translation and the destination address translation recorded in the address translation record and the session, the TCP traffic packet is forwarded to the target destination address.
8. A flow routing device, characterized in that: include: A receiving unit, configured to receive a TCP traffic packet and a SYN packet sent by a target source address through a target access node in a traffic forwarding topology, wherein the SYN packet is used to establish a session between the target source address and a target destination address; an adding unit, configured to add routing information between the target source address and the target destination address to the SYN packet through the target access node to obtain a processed SYN packet; A first forwarding unit, configured to forward the processed SYN packet to the target destination address through the target access node and the target forwarding node in the traffic forwarding topology based on the routing information; A second forwarding unit, configured to forward the TCP traffic packet to the target destination address based on the forwarding process of the processed SYN packet, wherein the TCP traffic packet is processed by a target application in the target destination address; The adding unit includes: an adding module, which is used to add the routing information to the byte position after the TCP protocol header in the SYN packet to obtain the added SYN packet; a setting module, which is used to set the reserved field in the TCP protocol header of the added SYN packet to a first value to obtain the processed SYN packet, wherein the first value is used to indicate that the routing information is stored in the processed SYN packet.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the storage medium is controlled to execute the traffic routing method according to any one of claims 1 to 7 on a device.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the traffic routing method described in any one of claims 1 to 7.
