CN116800672A - Method, device, electronic equipment and storage medium for accelerating message forwarding - Google Patents

Method, device, electronic equipment and storage medium for accelerating message forwarding Download PDF

Info

Publication number
CN116800672A
CN116800672A CN202311070714.5A CN202311070714A CN116800672A CN 116800672 A CN116800672 A CN 116800672A CN 202311070714 A CN202311070714 A CN 202311070714A CN 116800672 A CN116800672 A CN 116800672A
Authority
CN
China
Prior art keywords
message
forwarding
information
forwarding rule
ethernet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202311070714.5A
Other languages
Chinese (zh)
Other versions
CN116800672B (en
Inventor
吴正中
张辉
汤小梁
唐才荣
孔祥开
王晓东
张东东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Urban Construction Intelligent Control Technology Co ltd
Original Assignee
Beijing Urban Construction Intelligent Control Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Urban Construction Intelligent Control Technology Co ltd filed Critical Beijing Urban Construction Intelligent Control Technology Co ltd
Priority to CN202311070714.5A priority Critical patent/CN116800672B/en
Publication of CN116800672A publication Critical patent/CN116800672A/en
Application granted granted Critical
Publication of CN116800672B publication Critical patent/CN116800672B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a method, a device, electronic equipment and a storage medium for accelerating message forwarding, which relate to the technical field of communication, and the method comprises the following steps: acquiring information in the forwarding process of a first packet connected with an Internet Protocol (IP) layer from an Ethernet in interface to an Ethernet out interface; based on the information in the forwarding process, creating a message forwarding rule corresponding to the IP layer connection, and adding the message forwarding rule into a forwarding rule set; and after receiving a new message, forwarding the message based on the forwarding rule set. The system resources are greatly saved, and the system throughput rate is improved.

Description

Method, device, electronic equipment and storage medium for accelerating message forwarding
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and apparatus for accelerating packet forwarding, an electronic device, and a storage medium.
Background
The network layer is the third layer in the open system interconnection communication reference model (Open System Interconnection Reference Mode, OSI), and is interposed between the transport layer and the data link layer, and is mainly used to implement transparent transmission between two network system data. The network layer establishes a connection between two nodes by internet protocol (Internet Protocol, IP) addressing, and selects a proper route and switching node for the message sent by the transmission layer of the source end, and correctly sends the message to the transmission layer of the destination end according to the address. The network layer is also referred to as the IP protocol layer or IP layer.
In the prior art, the flow of forwarding a message by an IP layer is long, and according to the types of forwarding the message (such as an intranet message and a remote message) and the difference of equipment configuration (such as source network address translation (Network Address Translation, NAT) and destination NAT), the forwarding flow may involve multiple flows of bridging, destination NAT, source NAT, route searching, neighbor information searching and the like, each flow has a series of time-consuming calculation operations, and each message needs to undergo one or more of the time-consuming flows, which seriously consumes system resources and reduces the throughput rate of the system.
Disclosure of Invention
Aiming at the problems existing in the prior art, the invention provides a method, a device, electronic equipment and a storage medium for accelerating message forwarding.
In a first aspect, the present invention provides a method for accelerating message forwarding, including:
acquiring information in the forwarding process of a first packet connected with an Internet Protocol (IP) layer from an Ethernet in interface to an Ethernet out interface;
based on the information in the forwarding process, creating a message forwarding rule corresponding to the IP layer connection, and adding the message forwarding rule into a forwarding rule set;
and after receiving a new message, forwarding the message based on the forwarding rule set.
In some embodiments, the message forwarding rule includes at least one of the following:
message quintuple information;
network address translation NAT information;
bridging conversion information;
ethernet interface information;
timestamp information.
In some embodiments, the message quintuple information includes at least one of original message quintuple information, outgoing direction message quintuple information, and return direction message quintuple information.
In some embodiments, the NAT information includes at least one of destination NAT translation information and source NAT translation information.
In some embodiments, the ethernet interface information comprises at least one of:
an ethernet ingress interface and a media access control MAC address of the ethernet ingress interface;
an ethernet out interface and a MAC address of the ethernet out interface.
In some embodiments, the forwarding processing of the packet based on the forwarding rule set includes:
inquiring the forwarding rule set by using the original message quintuple information of the message;
and under the condition that the matched message forwarding rule is inquired, finishing the modification and repackaging of the message according to the matched message forwarding rule, and forwarding the packaged message to an Ethernet output interface in the matched message forwarding rule.
In some embodiments, the modifying and repackaging the packet according to the matched packet forwarding rule includes:
updating the IP layer header and the transmission layer header of the message according to the matched message forwarding rule;
updating the time-to-live TTL value of the message and recalculating the header checksum of the message;
and encapsulating the Ethernet header of the message by using the neighbor information.
In some embodiments, the modifying and repackaging the packet according to the matched packet forwarding rule includes:
judging whether the matched message forwarding rule is overtime or not according to the timestamp information in the matched message forwarding rule;
and under the condition that the matched message forwarding rule is not overtime, finishing the modification and repackaging of the message according to the matched message forwarding rule.
In some embodiments, the method further comprises:
and determining that the message is successfully sent out, and updating the timestamp information in the matched message forwarding rule.
In some embodiments, before forwarding the packet based on the forwarding rule set, the method further comprises:
detecting whether the message is an IPv4 or IPv6 message;
And carrying out validity check on the message under the condition that the message is an IPv4 or IPv6 message.
In a second aspect, the present invention further provides an apparatus for accelerating message forwarding, including:
the information acquisition module is used for acquiring information in the forwarding process of a first packet connected with an Internet Protocol (IP) layer from an Ethernet input interface to an Ethernet output interface;
the rule creation module is used for creating a message forwarding rule corresponding to the IP layer connection based on the information in the forwarding process and adding the message forwarding rule into a forwarding rule set;
and the forwarding processing module is used for forwarding the message based on the forwarding rule set after receiving the new message.
In some embodiments, the message forwarding rule includes at least one of the following:
message quintuple information;
network address translation NAT information;
bridging conversion information;
ethernet interface information;
timestamp information.
In some embodiments, the message quintuple information includes at least one of original message quintuple information, outgoing direction message quintuple information, and return direction message quintuple information.
In some embodiments, the NAT information includes at least one of destination NAT translation information and source NAT translation information.
In some embodiments, the ethernet interface information comprises at least one of:
an ethernet ingress interface and a media access control MAC address of the ethernet ingress interface;
an ethernet out interface and a MAC address of the ethernet out interface.
In some embodiments, the forwarding processing of the packet based on the forwarding rule set includes:
inquiring the forwarding rule set by using the original message quintuple information of the message;
and under the condition that the matched message forwarding rule is inquired, finishing the modification and repackaging of the message according to the matched message forwarding rule, and forwarding the packaged message to an Ethernet output interface in the matched message forwarding rule.
In some embodiments, the modifying and repackaging the packet according to the matched packet forwarding rule includes:
updating the IP layer header and the transmission layer header of the message according to the matched message forwarding rule;
updating the time-to-live TTL value of the message and recalculating the header checksum of the message;
and encapsulating the Ethernet header of the message by using the neighbor information.
In some embodiments, the modifying and repackaging the packet according to the matched packet forwarding rule includes:
Judging whether the matched message forwarding rule is overtime or not according to the timestamp information in the matched message forwarding rule;
and under the condition that the matched message forwarding rule is not overtime, finishing the modification and repackaging of the message according to the matched message forwarding rule.
In some embodiments, the apparatus further comprises:
and the time stamp updating module is used for determining that the message is successfully sent out and updating the time stamp information in the matched message forwarding rule.
In some embodiments, the apparatus further comprises an inspection module for:
before forwarding the message based on the forwarding rule set, detecting whether the message is an IPv4 or IPv6 message;
and carrying out validity check on the message under the condition that the message is an IPv4 or IPv6 message.
In a third aspect, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, where the processor implements the method for accelerating forwarding of a message according to the first aspect as described above when executing the program.
In a fourth aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of accelerating message forwarding as described in the first aspect above.
According to the method, the device, the electronic equipment and the storage medium for accelerating message forwarding, the message forwarding rule corresponding to each IP layer connection is created by acquiring the information of the first packet of the IP layer connection in the forwarding process from the Ethernet in interface to the Ethernet out interface and is added into the forwarding rule set for forwarding the subsequent message, so that the forwarding process flow of the subsequent message can be greatly saved, the system resources are greatly saved, and the system throughput rate is improved.
Drawings
In order to more clearly illustrate the invention or the technical solutions in the related art, the following description will briefly explain the drawings used in the embodiments or the related art description, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for those skilled in the art.
FIG. 1 is a diagram of an IP message format provided in the related art;
fig. 2 is a schematic diagram of a common network layer packet transmission path provided in the related art;
fig. 3 is a schematic diagram of a packet forwarding flow provided in the related art;
FIG. 4 is a flow chart of a method for accelerating message forwarding according to the present invention;
FIG. 5 is a diagram illustrating exemplary locations of information collection points provided by the present invention;
FIG. 6 is a diagram illustrating an example flow of acceleration processing of an IP layer packet according to the present invention;
fig. 7 is a schematic structural diagram of a device for accelerating message forwarding provided by the present invention;
fig. 8 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
The term "and/or" in the present invention describes an association relationship of association objects, which means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
The term "plurality" in the present invention means two or more, and other adjectives are similar thereto.
The terms "first," "second," and the like, herein, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the invention are capable of operation in sequences other than those illustrated or otherwise described herein, and that the "first" and "second" distinguishing between objects generally are not limited in number to the extent that the first object may, for example, be one or more.
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In order to facilitate a clearer understanding of the technical solution of the present invention, some technical matters related to the present invention will be described first.
The IP protocol is a core protocol in a transmission control protocol (Transmission Control Protocol, TCP)/IP protocol cluster, and is also a carrier of TCP/IP, and all protocol data of TCP, user datagram protocol (User Datagram Protocol, UDP), internet control message protocol (Internet Control Message Protocol, ICMP) and internet group management protocol (Internet Group Management Protocol, IGMP) are transmitted in the protocol stack in an IP datagram format, and the IP protocol provides unreliable, connectionless data transmission service.
Unreliable means that the IP protocol does not guarantee that the datagram can be successfully delivered to the destination, and the IP protocol only provides as good a transmission service as possible. If an error occurs in the transmission process, such as that a certain router on the path temporarily uses up its buffer area, so that a new datagram cannot be forwarded normally, the IP protocol simply discards the datagram and sends an ICMP message to the source end, and the specific reliability requirement is ensured by a higher layer protocol.
Connectionless means that the IP protocol does not maintain state information for subsequent datagrams, and the handling of each datagram is independent of the other. Datagrams may not be received in the order of transmission, as consecutively transmitted datagrams are routed independently, and different routes may be selected due to network topology changes, so that it is possible that sequentially transmitted datagrams arrive out of order.
Fig. 1 is a schematic diagram of an IP message format provided in the related art, and as shown in fig. 1, a typical IP message format mainly includes the following items:
(1) Version: 4 bits, which refers to the version of the IP protocol, are currently widely used with version numbers of 4 (i.e., IPv 4) and 6 (i.e., IPv 6).
(2) Header length: 4 bits refers to the header length in units of 32 bits.
(3) Service type: 8 bits, differentiated services field (Differentiated Services, DS). This field is only active when differentiated services are used.
(4) Total length: 16 bits, which refers to the length of the sum of the header and the data, are in bytes. The maximum length is 65535 bytes.
(5) An identifier: 16 bits for identifying a message or each fragment belonging to a message.
(6) And (3) marking: the 3 bits, the lowest bit of the flag field is noted MF (More Fragment), mf=1 indicates that the datagram is the last datagram in the number of datagram slices, and mf=0 indicates that this is the last datagram slice. The middle one bit of the flag field is denoted DF (Don't Fragment), meaning "no fragmentation" and only fragments are allowed when df=0.
(7) Offset: the finger slice is offset, 13 bits, and a longer message is used for marking the relative position of a certain slice in the original message after slicing.
(8) Survival time: the Time To Live (TTL) is 8 bits, which is set by the system of the message sender, and the value of the Time To Live (TTL) is reduced by 1 after being forwarded by one router, and the Time To Live (TTL) is discarded after being reduced to 0. The method is used for avoiding the continuous forwarding of the message when the destination cannot be found and wasting network resources.
(9) Protocol: 8 bits, identifying the protocol used by the upper layer.
(10) And (3) checksum: referring to the header checksum, 16 bits, only the header of the IP packet is checked, and no data portion is included, and the header checksum is recalculated every time a router passes.
(11) Source IP: the source IP address, 32 bits, represents the host IP of the data sender.
(12) Destination IP: referring to the destination IP address, 32 bits, represent the host IP to which the data is to be received.
(13) Options: an option field, with a length of 0-40 bytes.
(14) Data: i.e. the data payload.
Fig. 2 is a schematic diagram of a common network layer packet transmission path provided in the related art, as shown in fig. 2, different packet transmission paths may be used for different scenarios.
Scene 1: the message flow to the local host introduces (to the local host along the path 1-2-3-6-7).
(1) The host receives the message from the ethernet ingress interface. If the destination media access control (Media Access Control, MAC) address of the message is the local host, the message enters the IP layer for further processing; if the destination MAC address of the message is not the local host, the message is discarded.
(2) Before the route searching, the message entering the IP layer needs legal checking, and if the message fragments are also recombined.
(3) And carrying out route searching on the legal message by using the IP address. A route to the home is found for a message destined for the home host.
(4) The message is processed by the transport layer protocol and then passes through the application layer protocol.
(5) And finally, the message is transmitted to an application program of the local host, namely, the application program receives the message.
Scene 2: forwarding messages Wen Liucheng describes (forwarding messages along the path 1-2-3-4-5-11-12).
(1) The host receives the message from the Ethernet in interface and the message flow is the same as that of the message sent to the local host.
(2) Message routing preprocessing is the same as message flow to the local host.
(3) For forwarded messages, a route to other hosts is found during route lookup.
(4) And carrying out forwarding validity check on the message, and subtracting the TTL of the message lifetime.
(5) And using the routing information to repackage the Ethernet header of the message, and delivering the message to an Ethernet output interface driver.
(6) And re-sending the message at the Ethernet output interface.
Scene 3: the local host sends a message Wen Liucheng introduction (send message along path 8-9-10-11-12).
(1) The message sent by the local host application program enters the network protocol stack through the application layer protocol.
(2) And carrying out IP encapsulation on the message at the IP layer, and if the message is too large, carrying out fragment encapsulation and sending on the message.
(3) And searching an output interface of the message by using a routing protocol.
(4) And encapsulating the Ethernet header of the message by using the routing information, and delivering the message to an Ethernet output interface driver.
(5) And re-sending the message at the Ethernet output interface.
Fig. 3 is a schematic diagram of a forwarding message flow provided in the related art, and as shown in fig. 3, the forwarding message flow mainly includes:
(1) The message enters the host from the ethernet ingress interface.
(2) Judging whether the message is a local area network message or not. If the message is a local area network message, namely an intranet message, entering a network bridge processing flow, inquiring a network bridge interface to select an interface, and carrying out two-layer forwarding.
(3) If the message is a remote message, the message enters an IP layer to forward the message.
(4) Judging whether the message needs to be subjected to destination NAT conversion or not. If the destination NAT conversion is needed, entering a destination NAT conversion flow, and updating the destination IP and the destination port of the message by using a destination NAT rule.
(5) And querying a routing table by using the destination IP of the message, and selecting an output interface of the message.
(6) Judging whether the message needs source NAT conversion or not. If source NAT conversion is needed, a source NAT conversion flow is entered, and source IP and source port of the message are updated by using source NAT rule.
(7) And forwarding the message to an output interface, and performing Ethernet encapsulation on the message.
(8) Judging whether neighbor information used by the message exists or not. The neighbor protocol used by IPv4 is address resolution protocol (Address Resolution Protocol, ARP) and the neighbor protocol used by IPv6 is neighbor discovery protocol (Neighbor Discovery Protocol, NDP). And if the neighbor information does not exist, querying the neighbor information by using a neighbor protocol corresponding to the message.
(9) The ethernet header of the message is encapsulated with neighbor information.
(10) And sending the message out of the output interface.
In the conventional message forwarding scheme, each message to be forwarded needs to undergo a message forwarding flow shown in fig. 3, where a series of time-consuming computing operations such as bridging, destination NAT, source NAT, route lookup, neighbor information lookup may be involved, which severely consumes system resources and reduces throughput of the system.
The invention provides a solution to the above problems, and the implementation principle is as follows: the five-tuple (source IP, destination IP, source port, destination port, transport layer protocol) of the IP layer can be used for uniquely identifying one IP layer connection, the information of the first packet of the IP layer connection in the forwarding process from the Ethernet in interface to the Ethernet out interface can be recorded, and a message forwarding rule is formed for the subsequent message, so that the time-consuming computation of the processes of bridging, destination NAT, source NAT, route searching and the like of the subsequent message is avoided, a large amount of system resources can be saved, and the throughput rate of the system is further improved.
Fig. 4 is a flow chart of a method for accelerating message forwarding provided by the present invention, as shown in fig. 4, the method includes the following steps:
step 400, information in the forwarding process of the first packet connected by the Internet Protocol (IP) layer from the Ethernet in interface to the Ethernet out interface is obtained.
Step 401, creating a message forwarding rule corresponding to the IP layer connection based on the information in the forwarding process, and adding the message forwarding rule to a forwarding rule set.
Step 402, after receiving a new message, forwarding the message based on the forwarding rule set.
Specifically, the execution body of each step in the method may be a device for accelerating message forwarding, where the device may be implemented by Software and/or hardware, and the device may be integrated in an electronic device, where the electronic device may be an intelligent control integrated machine (for example, an intelligent control integrated machine integrating functions of calculation, storage, exchange, monitoring, and the like in an intelligent rail transit field), a switch, a firewall, a Software defined network (Software-Defined Networking, SDN) product, and the like.
An IP layer connection refers to a communication connection established between two devices via an IP protocol on the internet. The IP layer five-tuple (source IP, destination IP, source port, destination port, transport layer protocol) can be used to uniquely identify one IP layer connection. The first packet of the IP layer connection refers to the first packet (or message, datagram, etc.) of the IP layer connection.
For the first packet of each IP layer connection, when the first packet forwards, a packet forwarding rule corresponding to the IP layer connection is not created yet, so that the first packet can be forwarded along a forwarding path of a common packet, for example, a packet forwarding flow shown in fig. 3 is adopted. The device for accelerating the message forwarding can acquire (collect or record) information in the forwarding process of the first packet of each IP layer connection from the Ethernet in interface to the Ethernet out interface, create a message forwarding rule corresponding to each IP layer connection by using the information, and add the message forwarding rule into a forwarding rule set for forwarding a newly received message.
In the present invention, the specific storage form of the forwarding rule set is not limited, and may be, for example, a database, a cache queue, or other forms that can be used for information storage. It can be appreciated that before the first packet forwarding rule is added to the forwarding rule set, the forwarding rule set is an empty set, and as the packet forwarding rule is continuously created, a new packet forwarding rule is continuously added to the forwarding rule set, so that the forwarding rule set is continuously updated, and the latest forwarding rule set is used for forwarding the subsequent newly received packet.
It should be noted that, the new message in step 402 may be any message received after the message forwarding rule is added to the forwarding rule set, which is not limited in this aspect of the present invention. For example: the new packet may be a subsequent packet of the IP layer connection for which the packet forwarding rule has been created, except for the first packet, or may be a first packet of a new IP layer connection for which the packet forwarding rule has not been created (of course, these first packets may not be able to query a matching packet forwarding rule in the forwarding rule set, so that its forwarding process cannot accelerate).
Fig. 5 is a diagram illustrating a location of an information collection point according to the present invention, as shown in fig. 5, where the information collection point (i.e. a collection point for collecting information in a forwarding process of a first packet connected by each IP layer from an ethernet ingress interface to an ethernet egress interface) may be set in a stage (such as before or after a packet is packaged, specifically, without limitation, in which required information can be completely collected, and the required information can be flexibly set according to actual needs).
In some embodiments, the collected primary information includes at least one of:
(1) The original message quintuple (source IP, destination IP, source port, destination port, transport layer protocol) information is used to uniquely identify an IP layer connection.
(2) Whether destination NAT translation is required.
(3) Whether source NAT translation is required.
(4) And outputting the message quintuple information, wherein if the destination IP and the destination port of the message are changed by performing the destination NAT conversion, the source IP and the source port of the message are changed by performing the source NAT conversion, and the output message quintuple information is used for recording the message quintuple information after the NAT conversion.
(5) Whether a bridging transition is required.
(6) An ethernet ingress interface and a MAC address of the ethernet ingress interface.
(7) An ethernet out interface and a MAC address of the ethernet out interface.
(8) Time stamp of information collection.
The device for accelerating the forwarding of the message can use the collected information to create a message forwarding rule corresponding to each IP layer connection, so as to accelerate the forwarding process of the subsequent message.
In some embodiments, the message forwarding rule may include at least one of the following:
(1) Message quintuple information.
The message quintuple information comprises information of various message quintuples (source IP, destination IP, source port, destination port and transport layer protocol) related in the message forwarding process.
In some embodiments, the message quintuple information includes at least one of original message quintuple information, outgoing direction message quintuple information, and return direction message quintuple information.
The original message quintuple information can be filled in the collected information; the output direction message quintuple information can be filled in the output direction message quintuple information in the collected information.
The message quintuple information of the return direction refers to the message quintuple information of the return message direction connected by the IP layer, and can be used for fast matching the response message. The return direction message quintuple information is exchanged with the source (IP, port) and destination (IP, port) addresses in the output direction message quintuple information. For example: outgoing direction message five-tuple information (IP 1, IP2, port 1, port 2, transport layer protocol), and return direction message five-tuple information (IP 2, IP1, port 2, port 1, transport layer protocol). Corresponding return direction message quintuple information can be filled in the item according to the output direction message quintuple information in the collected information.
(2) The network address translates the NAT information.
The NAT information comprises various information related to NAT conversion in the message forwarding process.
In some embodiments, the NAT information may be information indicating whether to perform NAT conversion, and may include at least one of destination NAT conversion information and source NAT conversion information.
For example, the destination NAT conversion information may indicate whether destination NAT conversion is required, and the term may be filled with the information collected as described above, in which destination NAT conversion is required or not required.
For example, the source NAT translation information may indicate whether source NAT translation is required, and the term may be filled with information collected as described above, in which source NAT translation is required or not required.
(3) Bridging conversion information.
The bridging conversion information comprises various information related to bridging conversion in the message forwarding process.
In some embodiments, the bridge conversion information may be information for indicating whether to perform bridge conversion, where the bridge conversion may be required or not according to the collected information.
(4) Ethernet interface information.
The ethernet interface information may include at least one of information related to an ethernet in interface and information related to an ethernet out interface.
For example, the information about the ethernet in interface may include a specific ethernet in interface and a MAC address of the ethernet in interface, and the item may be filled with the ethernet in interface and the MAC address of the ethernet in interface in the collected information.
For example, the information about the ethernet out interface may include a specific ethernet out interface and a MAC address of the ethernet out interface, where the MAC addresses of the ethernet out interface and the ethernet out interface in the collected information may be filled in.
(5) Timestamp information.
The timestamp information may fill in the timestamp of the information collection in the collected information when creating the message forwarding rule. Alternatively, the time stamp information may be updated subsequently. The timestamp information may be used to detect whether a message forwarding rule has timed out.
After the message forwarding rule is created, the device for accelerating message forwarding can add the message forwarding rule into the forwarding rule set, and when a new message is subsequently received, the device for accelerating message forwarding can inquire the forwarding rule set, save corresponding forwarding processing flow according to the information stored in the message forwarding rule, and accelerate message forwarding.
In some embodiments, the message forwarding rules may be stored in a Hash (Hash) table and added to the forwarding rule set for improving forwarding rule query efficiency.
The method for accelerating the message forwarding creates the message forwarding rule corresponding to each IP layer connection by acquiring the information in the forwarding process of the first packet of the IP layer connection from the Ethernet in interface to the Ethernet out interface, and adds the message forwarding rule into the forwarding rule set for forwarding the subsequent message, thereby greatly saving the forwarding process flow of the subsequent message, greatly saving system resources and improving the system throughput rate.
In some embodiments, the forwarding processing of the packet based on the forwarding rule set includes:
inquiring the forwarding rule set by using the original message quintuple information of the message;
and under the condition that the matched message forwarding rule is inquired, finishing the modification and repackaging of the message according to the matched message forwarding rule, and forwarding the packaged message to an Ethernet output interface in the matched message forwarding rule.
Specifically, after receiving a new message, the device for accelerating message forwarding can first obtain the five-tuple information of the original message of the message, and query the forwarding rule set by using the information to obtain the matched message forwarding rule.
If a matched message forwarding rule (such as original message quintuple information or message direction quintuple information matched in the forwarding rule) is queried, the matched message forwarding rule can be used for directly modifying and repackaging the message, and the packaged message is directly forwarded to an Ethernet interface, so that the flows of bridging, destination NAT, source NAT, route searching and the like are saved.
In some embodiments, the modifying and repackaging the packet according to the matched packet forwarding rule includes:
updating the IP layer header and the transmission layer header of the message according to the matched message forwarding rule;
updating the time-to-live TTL value of the message and recalculating the header checksum of the message;
and encapsulating the Ethernet header of the message by using the neighbor information.
Specifically, when the message is modified and repackaged by using the matched message forwarding rule, the device for accelerating message forwarding may update the IP layer header and the transport layer header of the message according to the content in the matched message forwarding rule, for example: and updating the source IP and the destination IP in the IP layer header according to the five-tuple information of the outgoing direction message in the matched message forwarding rule, and updating the source port and the destination port in the transmission layer header.
The means for accelerating the forwarding of the message may then update the TTL value of the message (i.e. decrease the TTL value by 1) and recalculate the header checksum of the message.
The means for accelerating forwarding of the message may then encapsulate the ethernet header of the message using the neighbor information. Optionally, the device for accelerating message forwarding may determine whether neighbor information used by the message exists, and if the neighbor information does not exist, query the neighbor information using a neighbor protocol corresponding to the message.
In some embodiments, the modifying and repackaging the packet according to the matched packet forwarding rule includes:
judging whether the matched message forwarding rule is overtime or not according to the timestamp information in the matched message forwarding rule;
and under the condition that the matched message forwarding rule is not overtime, finishing the modification and repackaging of the message according to the matched message forwarding rule.
Specifically, before the message is modified and repackaged by using the matched message forwarding rule, the device for accelerating message forwarding can firstly judge whether the matched message forwarding rule is overtime, if so, the matched message forwarding rule is not used, and the message is not accelerated; and if not, modifying and repackaging the message by using the matched message forwarding rule.
The timeout detection may be implemented by using time stamp information in the packet forwarding rule, for example, a duration may be set, and if it is assumed to be 5 seconds, if the interval between the current detection time and the time stamp information in the matched packet forwarding rule exceeds 5 seconds, it may be determined that the matched packet forwarding rule is timeout, otherwise, if the interval between the current detection time and the time stamp information in the matched packet forwarding rule does not exceed 5 seconds, it may be determined that the matched packet forwarding rule is not timeout.
By using the time stamp information in the message forwarding rule to perform timeout detection, the invalid message forwarding rule can be avoided, and the success rate of message forwarding is improved.
In some embodiments, the method further comprises:
and determining that the message is successfully sent out, and updating the timestamp information in the matched message forwarding rule.
Specifically, if it is determined that the message is successfully sent out, the device for accelerating message forwarding can update the timestamp information in the matched message forwarding rule in time. For example, the timestamp information successfully sent by the message may be used as the updated timestamp information in the matched message forwarding rule.
By updating the time stamp information in the message forwarding rule in time after the message is successfully sent out, the accuracy of overtime detection is ensured.
In some embodiments, before forwarding the packet based on the forwarding rule set, the method further includes:
detecting whether the message is an IPv4 or IPv6 message;
and carrying out validity check on the message under the condition that the message is an IPv4 or IPv6 message.
Specifically, after receiving the message, before forwarding the message based on the forwarding rule set, the device for accelerating forwarding of the message may perform some pre-checks on the message, including detecting whether the version of the message meets the requirement of accelerating processing, whether the message meets the requirement of validity checking, and so on.
In the invention, whether the version of the message is the IPv4 or IPv6 version can be detected first, if the version of the message is not the IPv4 message or the IPv6 message, the acceleration processing is not performed, and the message is processed according to the common message forwarding flow. If the message is an IPv4 or IPv6 message, further performing validity check on the message, such as checking the IP address, the IP layer message format, the transmission layer message format, the TTL and the like of the message, and not performing acceleration processing on the message which is not legal to be detected.
By performing pre-inspection before acceleration processing, messages which do not meet the acceleration processing requirement can be filtered out, system resources are further saved, and system throughput rate is improved.
FIG. 6 is an exemplary diagram of an acceleration processing flow of an IP layer packet, where an entry point of the acceleration processing flow of the IP layer packet is after a packet is received by an Ethernet ingress interface and before a forwarding flow is processed; the exit point of the IP layer packet acceleration process flow is a packet acceleration entry and a packet acceleration exit as shown in fig. 5 after the ethernet output interface encapsulates the packet with neighbor information and before the driver sends the packet. As shown in fig. 6, the IP layer packet acceleration processing flow mainly includes:
(1) The message enters the host from the ethernet ingress interface.
(2) The message enters an acceleration processing flow.
(3) And detecting whether the message is an IPv4 or IPv6 message.
(4) And carrying out validity check on the message, such as checking the IP address, the IP layer message format, the transmission layer message format, the TTL and the like of the message, wherein the message which is not legal to be detected is not subjected to acceleration processing.
(5) And obtaining the original quintuple information of the message.
(6) And querying a forwarding rule database (a database storing a forwarding rule set) by using the obtained original quintuple information.
(7) If there is no matched forwarding rule, the message is not accelerated.
(8) And judging whether the queried forwarding rule is overtime or not by detecting the time stamp of the forwarding rule, wherein the default overtime time is 5 seconds. If the message is overtime, deleting the current forwarding rule, and not carrying out acceleration processing on the message.
(9) And updating the IP layer header and the transmission layer header of the message by using the forwarding rule.
(10) Updating the TTL value of the message and recalculating the checksum of the message.
(11) The message ethernet header is encapsulated with neighbor information.
(12) And forwarding the packaged message to an Ethernet output interface stored in the forwarding rule.
(13) And sending out the message at the Ethernet output interface.
(14) And if the message is successfully sent out, updating the time stamp of the forwarding rule.
The device for accelerating message forwarding provided by the invention is described below, and the device for accelerating message forwarding described below and the method for accelerating message forwarding described above can be referred to correspondingly.
Fig. 7 is a schematic structural diagram of a device for accelerating message forwarding provided by the present invention, as shown in fig. 7, the device includes:
the information acquisition module 700 is configured to acquire information in a forwarding process of a first packet connected to an IP layer of an internet protocol from an ethernet ingress interface to an ethernet egress interface;
a rule creation module 710, configured to create a message forwarding rule corresponding to the IP layer connection based on the information in the forwarding process, and add the message forwarding rule to a forwarding rule set;
and the forwarding processing module 720 is configured to perform forwarding processing on the packet based on the forwarding rule set after receiving the new packet.
In some embodiments, the message forwarding rule includes at least one of the following:
message quintuple information;
network address translation NAT information;
bridging conversion information;
ethernet interface information;
timestamp information.
In some embodiments, the message quintuple information includes at least one of original message quintuple information, outgoing direction message quintuple information, and return direction message quintuple information.
In some embodiments, the NAT information includes at least one of destination NAT translation information and source NAT translation information.
In some embodiments, the ethernet interface information comprises at least one of:
an ethernet ingress interface and a media access control MAC address of the ethernet ingress interface;
an ethernet out interface and a MAC address of the ethernet out interface.
In some embodiments, the forwarding processing of the packet based on the forwarding rule set includes:
inquiring the forwarding rule set by using the original message quintuple information of the message;
and under the condition that the matched message forwarding rule is inquired, finishing the modification and repackaging of the message according to the matched message forwarding rule, and forwarding the packaged message to an Ethernet output interface in the matched message forwarding rule.
In some embodiments, the modifying and repackaging the packet according to the matched packet forwarding rule includes:
updating the IP layer header and the transmission layer header of the message according to the matched message forwarding rule;
updating the time-to-live TTL value of the message and recalculating the header checksum of the message;
and encapsulating the Ethernet header of the message by using the neighbor information.
In some embodiments, the modifying and repackaging the packet according to the matched packet forwarding rule includes:
judging whether the matched message forwarding rule is overtime or not according to the timestamp information in the matched message forwarding rule;
and under the condition that the matched message forwarding rule is not overtime, finishing the modification and repackaging of the message according to the matched message forwarding rule.
In some embodiments, the apparatus further comprises:
and the time stamp updating module is used for determining that the message is successfully sent out and updating the time stamp information in the matched message forwarding rule.
In some embodiments, the apparatus further comprises an inspection module for:
before forwarding the message based on the forwarding rule set, detecting whether the message is an IPv4 or IPv6 message;
And carrying out validity check on the message under the condition that the message is an IPv4 or IPv6 message.
It should be noted that, the device provided by the present invention can implement all the method steps implemented by the method embodiment and achieve the same technical effects, and the parts and beneficial effects that are the same as those of the method embodiment in the present embodiment are not described in detail herein.
Fig. 8 is a schematic structural diagram of an electronic device according to the present invention, as shown in fig. 8, the electronic device may include: processor 810, communication interface (Communications Interface) 820, memory 830, and communication bus 840, wherein processor 810, communication interface 820, memory 830 accomplish communication with each other through communication bus 840. Processor 810 may invoke logic instructions in memory 830 to perform any of the methods for accelerating message forwarding provided in the embodiments described above, such as: acquiring information in the forwarding process of a first packet connected with an Internet Protocol (IP) layer from an Ethernet in interface to an Ethernet out interface; based on the information in the forwarding process, creating a message forwarding rule corresponding to the IP layer connection, and adding the message forwarding rule into a forwarding rule set; and after receiving a new message, forwarding the message based on the forwarding rule set.
Further, the logic instructions in the memory 830 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that, the electronic device provided by the present invention can implement all the method steps implemented by the method embodiments and achieve the same technical effects, and the details and beneficial effects of the same parts and advantages as those of the method embodiments in the present embodiment are not described in detail.
In another aspect, the present invention further provides a non-transitory computer readable storage medium, on which a computer program is stored, where the computer program when executed by a processor may implement any one of the methods for accelerating forwarding of a message provided in the foregoing embodiments, for example: acquiring information in the forwarding process of a first packet connected with an Internet Protocol (IP) layer from an Ethernet in interface to an Ethernet out interface; based on the information in the forwarding process, creating a message forwarding rule corresponding to the IP layer connection, and adding the message forwarding rule into a forwarding rule set; and after receiving a new message, forwarding the message based on the forwarding rule set.
It should be noted that, the non-transitory computer readable storage medium provided by the present invention can implement all the method steps implemented by the method embodiments and achieve the same technical effects, and detailed descriptions of the same parts and beneficial effects as those of the method embodiments in this embodiment are omitted.
The apparatus embodiments described above are merely illustrative, wherein the modules illustrated as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (13)

1. A method for accelerating message forwarding, comprising:
acquiring information in the forwarding process of a first packet connected with an Internet Protocol (IP) layer from an Ethernet in interface to an Ethernet out interface;
based on the information in the forwarding process, creating a message forwarding rule corresponding to the IP layer connection, and adding the message forwarding rule into a forwarding rule set;
and after receiving a new message, forwarding the message based on the forwarding rule set.
2. The method for accelerating message forwarding according to claim 1, wherein the message forwarding rule includes at least one of:
message quintuple information;
network address translation NAT information;
bridging conversion information;
ethernet interface information;
timestamp information.
3. The method for accelerating message forwarding according to claim 2, wherein the message quintuple information comprises at least one of original message quintuple information, outgoing direction message quintuple information and return direction message quintuple information.
4. The method for accelerating message forwarding as recited in claim 2, wherein the NAT information includes at least one of destination NAT translation information and source NAT translation information.
5. The method for accelerating message forwarding according to claim 2, wherein the ethernet interface information comprises at least one of:
an ethernet ingress interface and a media access control MAC address of the ethernet ingress interface;
an ethernet out interface and a MAC address of the ethernet out interface.
6. The method for accelerating forwarding of a message according to any one of claims 2 to 5, wherein the forwarding of the message based on the forwarding rule set includes:
inquiring the forwarding rule set by using the original message quintuple information of the message;
and under the condition that the matched message forwarding rule is inquired, finishing the modification and repackaging of the message according to the matched message forwarding rule, and forwarding the packaged message to an Ethernet output interface in the matched message forwarding rule.
7. The method for accelerating message forwarding according to claim 6, wherein said modifying and repackaging the message according to the matched message forwarding rule comprises:
updating the IP layer header and the transmission layer header of the message according to the matched message forwarding rule;
Updating the time-to-live TTL value of the message and recalculating the header checksum of the message;
and encapsulating the Ethernet header of the message by using the neighbor information.
8. The method for accelerating message forwarding according to claim 6, wherein said modifying and repackaging the message according to the matched message forwarding rule comprises:
judging whether the matched message forwarding rule is overtime or not according to the timestamp information in the matched message forwarding rule;
and under the condition that the matched message forwarding rule is not overtime, finishing the modification and repackaging of the message according to the matched message forwarding rule.
9. The method for accelerating message forwarding as recited in claim 6, further comprising:
and determining that the message is successfully sent out, and updating the timestamp information in the matched message forwarding rule.
10. The method for accelerating forwarding of a message according to any one of claims 1 to 5, wherein prior to forwarding the message based on the forwarding rule set, the method further comprises:
detecting whether the message is an IPv4 or IPv6 message;
And carrying out validity check on the message under the condition that the message is an IPv4 or IPv6 message.
11. An apparatus for accelerating message forwarding, comprising:
the information acquisition module is used for acquiring information in the forwarding process of a first packet connected with an Internet Protocol (IP) layer from an Ethernet input interface to an Ethernet output interface;
the rule creation module is used for creating a message forwarding rule corresponding to the IP layer connection based on the information in the forwarding process and adding the message forwarding rule into a forwarding rule set;
and the forwarding processing module is used for forwarding the message based on the forwarding rule set after receiving the new message.
12. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements the method of accelerating message forwarding according to any of claims 1 to 10 when executing the program.
13. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a method of accelerating message forwarding according to any of claims 1 to 10.
CN202311070714.5A 2023-08-24 2023-08-24 Method, device, electronic equipment and storage medium for accelerating message forwarding Active CN116800672B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311070714.5A CN116800672B (en) 2023-08-24 2023-08-24 Method, device, electronic equipment and storage medium for accelerating message forwarding

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311070714.5A CN116800672B (en) 2023-08-24 2023-08-24 Method, device, electronic equipment and storage medium for accelerating message forwarding

Publications (2)

Publication Number Publication Date
CN116800672A true CN116800672A (en) 2023-09-22
CN116800672B CN116800672B (en) 2024-01-12

Family

ID=88037573

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311070714.5A Active CN116800672B (en) 2023-08-24 2023-08-24 Method, device, electronic equipment and storage medium for accelerating message forwarding

Country Status (1)

Country Link
CN (1) CN116800672B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117376272A (en) * 2023-12-08 2024-01-09 广州通则康威科技股份有限公司 Message length adjustment method, device, system and storage medium
CN117640503A (en) * 2024-01-22 2024-03-01 北京天维信通科技股份有限公司 Flow optimization method and device integrating BRouter technology and intelligent path technology

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101877728A (en) * 2010-06-25 2010-11-03 中兴通讯股份有限公司 Method and device for converting and forwarding network addresses
CN101938415A (en) * 2010-08-30 2011-01-05 北京傲天动联技术有限公司 Rapid forwarding method for network forwarding device
CN102571613A (en) * 2012-03-09 2012-07-11 华为技术有限公司 Method and network device for message forwarding
CN103763194A (en) * 2013-12-31 2014-04-30 杭州华三通信技术有限公司 Message forwarding method and device
US9154415B1 (en) * 2012-09-18 2015-10-06 Cisco Technology, Inc. Parallel processing for low latency network address translation
CN111510513A (en) * 2020-01-03 2020-08-07 普联国际有限公司 MAP-E link acceleration method, device, storage medium and network equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101877728A (en) * 2010-06-25 2010-11-03 中兴通讯股份有限公司 Method and device for converting and forwarding network addresses
CN101938415A (en) * 2010-08-30 2011-01-05 北京傲天动联技术有限公司 Rapid forwarding method for network forwarding device
CN102571613A (en) * 2012-03-09 2012-07-11 华为技术有限公司 Method and network device for message forwarding
US9154415B1 (en) * 2012-09-18 2015-10-06 Cisco Technology, Inc. Parallel processing for low latency network address translation
CN103763194A (en) * 2013-12-31 2014-04-30 杭州华三通信技术有限公司 Message forwarding method and device
CN111510513A (en) * 2020-01-03 2020-08-07 普联国际有限公司 MAP-E link acceleration method, device, storage medium and network equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117376272A (en) * 2023-12-08 2024-01-09 广州通则康威科技股份有限公司 Message length adjustment method, device, system and storage medium
CN117640503A (en) * 2024-01-22 2024-03-01 北京天维信通科技股份有限公司 Flow optimization method and device integrating BRouter technology and intelligent path technology
CN117640503B (en) * 2024-01-22 2024-04-30 北京天维信通科技股份有限公司 Flow optimization method and device integrating BRouter technology and intelligent path technology

Also Published As

Publication number Publication date
CN116800672B (en) 2024-01-12

Similar Documents

Publication Publication Date Title
CN116800672B (en) Method, device, electronic equipment and storage medium for accelerating message forwarding
EP3958521A1 (en) Method and apparatus for providing service for service flow
US10382309B2 (en) Method and apparatus for tracing paths in service function chains
JP3717836B2 (en) Dynamic load balancer
CN110034971B (en) Method and device for detecting service chain
US7852774B2 (en) User datagram protocol traceroute probe extension
US8520672B2 (en) Packet switching device using results determined by an application node
US20020055999A1 (en) System and method for measuring quality of service
US20090161576A1 (en) Methods And Systems For Sending Information To A Zone Included In An Internet Network
US20070110068A1 (en) Reply communication apparatus and ARP reply communication apparatus
EP3570524B1 (en) Packet fragment forwarding without reassembly
US20140241368A1 (en) Control apparatus for forwarding apparatus, control method for forwarding apparatus, communication system, and program
CN111988266B (en) Method for processing message
CN107231269B (en) Accurate cluster speed limiting method and device
CN113950811B (en) Extending BGP protection for SR Path ingress protection
US11909650B2 (en) Internet protocol operations and management option
CN108777654B (en) Message forwarding method and routing equipment
JP2009135772A (en) Router device
CN111770049B (en) Global cache variable and message information storage method and device
KR20230022251A (en) BIER OAM detection method, device, and system
CN116057911A (en) Load balancing and OAM in service function chains using multiprotocol label switching
CN115442288B (en) SRv6 network data packet inspection method and device
CN116996439B (en) SDN-based efficient routing addressing method and system
JP3834157B2 (en) Service attribute assignment method and network device
KR20020025427A (en) Apparatus and method for forwarding Internet Protocol Packet

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant