WO2022193929A1 - 一种网络设备及其共享发送和接收缓存的方法 - Google Patents
一种网络设备及其共享发送和接收缓存的方法 Download PDFInfo
- Publication number
- WO2022193929A1 WO2022193929A1 PCT/CN2022/077897 CN2022077897W WO2022193929A1 WO 2022193929 A1 WO2022193929 A1 WO 2022193929A1 CN 2022077897 W CN2022077897 W CN 2022077897W WO 2022193929 A1 WO2022193929 A1 WO 2022193929A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data packet
- receiving
- quintuple
- sending
- information
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 28
- 238000012545 processing Methods 0.000 claims abstract description 86
- 238000013519 translation Methods 0.000 claims description 24
- 239000000872 buffer Substances 0.000 claims description 14
- 230000005540 biological transmission Effects 0.000 claims description 2
- 238000003672 processing method Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/74—Address processing for routing
- H04L45/745—Address table lookup; Address filtering
- H04L45/7453—Address table lookup; Address filtering using hashing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/74—Address processing for routing
- H04L45/742—Route cache; Operation thereof
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W28/00—Network traffic management; Network resource management
- H04W28/02—Traffic management, e.g. flow control or congestion control
- H04W28/10—Flow control between communication endpoints
- H04W28/14—Flow control between communication endpoints using intermediate storage
Definitions
- the present application relates to a method for reducing the cache requirement for network data packets in a network device.
- Network devices such as routers and mobile phones can either directly access the network or act as an access point (AP) to provide Internet services to other devices.
- AP access point
- a network device acts as an access point to provide Internet access services through the IPv4 protocol, it needs to provide network data packet forwarding services, change the IP address and port information in the quintuple information of the network data packet, and then forward the network data packet.
- the quintuple information of the network data packet refers to the source IP address, destination IP address, source port, destination port, and protocol of the network data packet.
- IP_A the IP address of the Internet server S
- IP_S the IP address of the Internet server S
- the mobile phone A accesses the port Port_S of the Internet server S through the port Port_A.
- IP_S the IP address of the Internet server S
- the quintuple information is (IP_S, IP_A, Port_S, Port_A, 6), where 6 represents the TCP protocol number.
- sending direction there are sending data packets; this refers to the network data packets sent by mobile phone A to server S, and the quintuple information is (IP_A, IP_S, Port_A, Port_S, 6).
- mobile phone A accesses the Internet through a mobile communication network on the one hand, and acts as a WiFi hotspot on the other hand; mobile phone B accesses the Internet by connecting to the WiFi hotspot of mobile phone A.
- the IP address of mobile phone A is IP_A
- the IP address of mobile phone B is IP_B
- the IP address of Internet server S is IP_S.
- the mobile phone B is connected to the port Port_A of the mobile phone A through the port Port_B, and the mobile phone A accesses the port Port_S of the Internet server S through the port Port_A.
- the received original data packet is the network data packet sent by the server S to the mobile phone A, and the quintuple information is (IP_S, IP_A, Port_S, Port_A, 6).
- the received and forwarded data packet is the network data packet forwarded by mobile phone A to mobile phone B, and the quintuple information is (IP_S, IP_B, Port_S, Port_B, 6).
- Mobile phone A performs network address translation (network address translation) on the destination IP address and destination port in the received original data packet. address translation, NAT) to receive forwarded packets.
- the sending direction there are sending original packets and sending forwarded packets.
- the original data packet sent is the network data packet sent by mobile phone B to mobile phone A, and the quintuple information is (IP_B, IP_S, Port_B, Port_S, 6).
- the sending and forwarding data packet is the network data packet forwarded by the mobile phone A to the server S, and the quintuple information is (IP_A, IP_S, Port_A, Port_S, 6).
- Mobile phone A performs network address translation on the source IP address and source port in the original data packet to send and forwards the data packet.
- mobile phone A When mobile phone A is used as a forwarding device, mobile phone A only stores the quintuple information of the received original data packet, the quintuple information of the sent original data packet, and the NAT information (IP_A and IP_B conversion, Port_A and Port_B conversion). Using the NAT information to replace the quintuple information of the first two network data packets, the quintuple information of receiving and forwarding data packets and the quintuple information of sending and forwarding data packets are obtained respectively.
- the quintuple information and NAT information of two different network data packets in the forwarding scenario need to be stored in the hardware cache of the network device. How to reduce the hardware cache requirement in the network device on the premise of meeting the network performance requirements, or provide better network performance under the same size of the hardware cache, has become a technical problem to be solved urgently.
- the technical problem to be solved by this application is to provide a method by which a network device can reduce the cache requirement in a forwarding scenario.
- the present application proposes a method for sharing sending and receiving buffers in a network device, which includes the following steps in the receiving direction.
- Step S10 The network device is configured with a receiving quintuple table, a receiving fast table, and a sending fast table.
- the receiving quintuple table records the quintuple information and NAT information of one or more IPv4 network data packets that need special processing received by the network device; only the quintuple information and NAT information of the received data packets are stored in the direct sending and receiving scenario.
- the NAT information includes the translated IP address, the translated port, and whether each network data packet needs to be forwarded.
- Each entry in the receiving fast table is indexed by the hash value h_rx of the quintuple information of the IPv4 network data packet in the receiving direction received by the network device, and the IPv4 network data packet corresponding to the hash value h_rx is recorded. Whether the quintuple information exists in the receiving quintuple table; if it exists in the receiving quintuple table, record the position in the receiving quintuple table.
- Each entry in the sending fast table is indexed by the hash value h_tx of the quintuple information of the IPv4 network data packet received by the network device from the sending direction, and the IPv4 network data corresponding to the hash value h_tx is recorded. Whether the packet has an entry in the receiving fast table; if it exists in the receiving fast table, record the position in the receiving fast table.
- Step S20 When the network device receives the IPv4 network data packet in the receiving direction, hereinafter referred to as the receiving data packet, calculate the hash value h_rx of the quintuple information of the receiving data packet, and use the hash value h_rx as an index to query the receiving speed.
- Step S25 obtain the position where the quintuple information of the received data packet is stored in the receiving quintuple table from the receiving fast table, and read the quintuple information of the network data packet from the corresponding position of the receiving quintuple table; Then match the quintuple information of the received data packet with the quintuple information of the network data packet read in the receiving quintuple table; when the two completely match, go to step S30; otherwise, go to step S70.
- Step S30 Query whether the received data packet needs to be forwarded in the received quintuple table. If yes, use the NAT information of the received data packet recorded in the receiving five-tuple table to replace the five-tuple information of the received original data packet, and obtain the five-tuple information of the received and forwarded data packet; send the received and forwarded data packet to the Step S60. If not, send the received data packet to step S60.
- Step S60 Perform special processing on the sent network data packets.
- Step S70 Perform conventional processing on the network data packet. The above method saves the space required for the hardware device to cache the quintuple information of the network data packet.
- step S10 when the receiving quintuple table records the quintuple information and NAT information of the received original data packet under the forwarding scenario, the NAT information is used to replace the quintuple information of the received original data packet,
- the quintuple information of receiving and forwarding data packets is obtained; the source IP address and destination IP address, source port and destination port in the quintuple information of receiving original data packets are exchanged, and the five-tuple information of sending and forwarding data packets is obtained.
- Tuple information exchange the source IP address and destination IP address, source port and destination port in the quintuple information of the received and forwarded data packet to obtain the quintuple information of the original data packet sent; or, use NAT information
- the quintuple information of the original data packet is obtained.
- step S10 when the receiving quintuple table records the quintuple information and NAT information of the received data packet under the direct sending and receiving scenario, the source IP address in the quintuple information of the receiving data packet is recorded. Exchange with the destination IP address, source port and destination port to obtain the quintuple information of the sent data packet.
- This is an exemplary illustration of how to restore the quintuple information of two network data packets from the quintuple information of a network data packet and the NAT information in the direct sending and receiving scenario.
- the receiving direction refers to the direction sent from the server to the network device. This is a specific description of the receive direction.
- the sending direction refers to the direction sent from the forwarded device to the network device. This is a specific description of the sending direction.
- the server the network device, and the forwarded device
- the received original data packet is the network data packet sent by the server to the network device
- the received and forwarded data packet is the network device forwarded to the forwarded device.
- network packets This is a specific description of receiving original data packets and receiving forwarded data packets.
- Step S10 The network device is configured with a receiving quintuple table, a receiving fast table, and a sending fast table.
- Step S40 When the network device receives the IPv4 network data packet in the sending direction, it is hereinafter referred to as the sending data packet, calculates the hash value h_tx of the quintuple information of the sending data packet, and uses the hash value h_tx as the index to query the sending speed. table, to obtain whether the quintuple information of the sending data packet is stored in the receiving fast table; if yes, go to step S41; if not, go to step S70.
- Step S41 Obtain the position where the quintuple information of the sending data packet is stored in the receiving fast table from the sending fast table, and inquire whether the quintuple information of the sending data packet is stored in the receiving fast table from the corresponding position in the receiving fast table. in the tuple table; if yes, go to step S42; if no, go to step S70.
- Step S42 Obtain the location where the quintuple information of the sending data packet is stored in the receiving quintuple table from the receiving fast table, and read the quintuple information and NAT information; determine whether the sent data packet matches the quintuple information and NAT information of the network data packet read from the corresponding position of the receiving quintuple table, and the specific matching rules are as follows. When the record in the receiving quintuple table indicates that the sending data packet needs to be forwarded, it indicates that the sending data packet is the original sending data packet in the forwarding scenario.
- the translation IP address in the NAT information is the same, and the destination IP address of the sending data packet is the same as the source IP address in the quintuple information read in the receiving quintuple table, and the source port of the sending data packet is the same as that of the receiving quintuple table.
- the translation port in the NAT information read in the quintuple table is the same, and the destination port of the sending data packet is the same as the source port in the quintuple information read in the receiving quintuple table, and the sending data packet is the same as the source port.
- the process goes to step S50; otherwise, it goes to step S70.
- the record in the receiving quintuple table indicates that the sending data packet does not need to be forwarded, it indicates that the sending data packet is a sending data packet in the direct sending and receiving scenario.
- the destination IP address in the obtained quintuple information is the same, and the destination IP address of the sending data packet is the same as the source IP address in the quintuple information read in the receiving quintuple table, and the source IP address of the sending data packet is the same.
- the port is the same as the destination port in the quintuple information read in the receiving quintuple table
- the destination port of the sending data packet is the same as the source port in the quintuple information read in the receiving quintuple table
- the protocol type of the sending data packet is the same as the protocol type in the quintuple information read in the receiving quintuple table, then it is considered that the matching is successful, and the process goes to step S50; otherwise, it goes to step S70.
- Step S50 Query whether the sending data packet needs to be forwarded in the receiving quintuple table, and the matching rule of Step S42 is also used in the query.
- Step S60 Perform special processing on the sent network data packets.
- Step S70 Perform conventional processing on the network data packet.
- the above-mentioned processing method of the sending direction is combined with the processing method of the receiving direction, it can be understood why the application only needs to store the quintuple information and NAT information of a network data packet in the hardware device, which can satisfy the receiving direction and the sending direction. processing needs.
- the server there are three parties: the server, the network device, and the forwarded device;
- the original data packet sent is the network data packet sent by the forwarding device to the network device, and the forwarded data packet is sent by the network device to the server.
- network packets This is a specific description of sending original packets and sending forwarded packets.
- the present application also proposes a network device, which includes, in the receiving direction, a table setting unit, a receiving query unit, a receiving matching unit, a receiving forwarding unit, a special processing unit and a conventional processing unit.
- the table setting unit is used to set the receiving quintuple table, the receiving fast table and the sending fast table in the network device.
- the receiving quintuple table records the quintuple information and NAT information of one or more IPv4 network data packets that need special processing received by the network device; only the quintuple information and NAT information of the received data packets are stored in the direct sending and receiving scenario.
- the NAT information includes the translated IP address, the translated port, and whether each network data packet needs to be forwarded.
- Each entry in the receiving fast table is indexed by the hash value h_rx of the quintuple information of the IPv4 network data packet in the receiving direction received by the network device, and the IPv4 network data packet corresponding to the hash value h_rx is recorded. Whether the quintuple information exists in the receiving quintuple table; if it exists in the receiving quintuple table, record the position in the receiving quintuple table.
- Each entry in the sending fast table is indexed by the hash value h_tx of the quintuple information of the IPv4 network data packet received by the network device from the sending direction, and the IPv4 network data corresponding to the hash value h_tx is recorded. Whether the packet has an entry in the receiving fast table; if it exists in the receiving fast table, record the position in the receiving fast table.
- the receiving query unit is used to calculate the hash value h_rx of the quintuple information of the received data packet when the network device receives the IPv4 network data packet in the receiving direction, hereinafter referred to as the received data packet, and the hash value h_rx is The index queries the receiving fast table, and obtains whether the quintuple information of the received data packet is stored in the receiving quintuple table; if so, the receiving query unit sends the received data packet to the receiving matching unit; The receiving query unit sends the received data packet to the conventional processing unit.
- the receiving matching unit is used to obtain the location where the five-tuple information of the received data packet is stored in the receiving five-tuple table from the receiving fast table, and read the five-tuple information of the network data packet from the corresponding position of the receiving five-tuple table. Tuple information; then match the quintuple information of the received data packet with the quintuple information of the network data packet read in the receiving quintuple table; when the two completely match, send the received data packet to the receiving Forwarding unit; otherwise, send the received data packet to the conventional processing unit.
- Described receiving and forwarding unit is used for inquiring whether this receiving data packet needs to be forwarded in receiving quintuple table; group information, the quintuple information of the received and forwarded data packet is obtained; the receiving and forwarding unit sends the received and forwarded data packet to the special processing unit; if not, the receiving and forwarding unit sends the received data packet to the special processing unit .
- the special processing unit is used to perform special processing on the sent network data packets.
- the conventional processing unit is used for conventional processing of the network data packet. The above device saves the space required by the hardware device to cache the quintuple information of the network data packet.
- the sending direction it includes a table setting unit, a sending query unit 1, a sending query unit 2, a sending matching unit, a sending forwarding unit, a special processing unit and a conventional processing unit.
- the sending query unit 1 is used to calculate the hash value h_tx of the quintuple information of the sending data packet with the hash value h_tx when the network device receives the IPv4 network data packet in the sending direction, hereinafter referred to as the sending data packet.
- the sending query unit 1 sends the sending data packet to the sending query unit 2; if not, all the The sending query unit sends the sending data packet to the conventional processing unit.
- the sending query unit 2 is used to obtain the position where the quintuple information of the sending data packet is stored in the receiving fast table from the sending fast table, and query the quintuple information of the sending data packet from the corresponding position of the receiving fast table Whether it is stored in the receiving quintuple table; if yes, the sending query unit 2 sends the sending data packet to the sending matching unit; if not, the sending query unit 2 sends the sending data packet to the conventional processing unit.
- the sending matching unit is used to obtain the position where the quintuple information of the sending data packet is stored in the receiving quintuple table from the receiving fast table, and read the quintuple information of the network data packet from the corresponding position of the receiving quintuple table.
- Tuple information and NAT information determine whether the sent data packet matches the quintuple information and NAT information of the network data packet read from the corresponding position of the receiving quintuple table, and the specific matching rules are as follows.
- the record in the receiving quintuple table indicates that the sending data packet needs to be forwarded, it indicates that the sending data packet is the original sending data packet in the forwarding scenario.
- the translation IP address in the NAT information is the same, and the destination IP address of the sending data packet is the same as the source IP address in the quintuple information read in the receiving quintuple table, and the source port of the sending data packet is the same as that of the receiving quintuple table.
- the translation port in the NAT information read in the quintuple table is the same, and the destination port of the sending data packet is the same as the source port in the quintuple information read in the receiving quintuple table, and the sending data packet is the same as the source port.
- the sending matching unit sends the sending data packet to the sending and forwarding unit; otherwise, the sending matching unit
- the transmit packet is sent to the conventional processing unit.
- the record in the receiving quintuple table indicates that the sending data packet does not need to be forwarded, it indicates that the sending data packet is a sending data packet in the direct sending and receiving scenario.
- the destination IP address in the obtained quintuple information is the same, and the destination IP address of the sending data packet is the same as the source IP address in the quintuple information read in the receiving quintuple table, and the source IP address of the sending data packet is the same.
- the port is the same as the destination port in the quintuple information read in the receiving quintuple table
- the destination port of the sending data packet is the same as the source port in the quintuple information read in the receiving quintuple table
- the protocol type of the sending data packet is the same as the protocol type in the quintuple information read in the receiving quintuple table, then it is considered that the matching is successful, and the sending matching unit sends the sending data packet to the sending and forwarding unit; otherwise, The sending matching unit sends the sending data packet to the conventional processing unit.
- the sending and forwarding unit is used to query whether the sending data packet needs to be forwarded in the receiving quintuple table, and the matching rule of the sending matching unit is also used during the query; if so, the sending and forwarding unit uses the receiving quintuple table.
- the destination IP address and destination port information of the network data packet matched by the sending data packet recorded in replace the source IP address and source port information of the sending original data packet respectively, so as to obtain the quintuple information for sending and forwarding the data packet;
- the sending and forwarding unit sends the sending and forwarding data packet to the special processing unit; if not, the sending and forwarding unit sends the sending data packet to the special processing unit.
- the technical effect achieved by the present application is that the hardware of the network device only needs to cache the receiving fast table, the receiving quintuple table received by the network device, and the sending fast table, and does not need to cache the receiving quintuple table sent by the network device, thereby saving about 40 % to 50% of the cache space.
- FIG. 1 is a flowchart of Embodiment 1 (receiving direction) of a method for sharing sending and receiving buffers in a network device provided by the present application.
- FIG. 2 is a flowchart of Embodiment 2 (sending direction) of a method for sharing sending and receiving buffers in a network device provided by the present application.
- FIG. 3 is a schematic structural diagram of Embodiment 1 (receiving direction) of a network device provided by the present application.
- FIG. 4 is a schematic structural diagram of Embodiment 2 (sending direction) of a network device provided by the present application.
- 10 is the table setting unit
- 20 is the receiving query unit
- 25 is the receiving matching unit
- 30 is the receiving and forwarding unit
- 40 is the sending query unit 1
- 41 is the sending query unit 2
- 42 is the sending matching unit
- 50 are sending and forwarding units
- 60 are special processing units
- 70 are conventional processing units.
- Embodiment 1 (receiving direction) of a method for sharing sending and receiving buffers in a network device provided by the present application includes the following steps.
- Step S10 The network device is configured with a receiving quintuple table, a receiving fast table, and a sending fast table. These tables are used, for example, for accelerated processing of network packets. Different network services of network equipment usually have different priorities, bandwidth and other special requirements. The network equipment determines whether the network data packet belongs to the network service with special requirements according to the quintuple information of the network data packet, and if so, special processing is performed. , such as prioritizing processing, accelerating processing through hardware and/or software, allocating more bandwidth, etc.
- the receiving quintuple table records the quintuple information and NAT information of one or more IPv4 network data packets that need special processing received by the network device, wherein only the quintuple information and NAT information of one IPv4 network data packet are required
- the quintuple information of the four network data packets in the forwarding scenario can be restored, or the quintuple information of the two network data packets in the direct sending and receiving scenario can be restored.
- the direct sending and receiving scenario only the quintuple information and NAT information of the received data packet are saved, and the quintuple information of the sent data packet is not saved.
- the NAT information includes translation IP addresses, translation ports, and whether each network data packet needs to be forwarded.
- the receiving quintuple table records the quintuple information and NAT information of the received original data packet in the forwarding scenario.
- the quintuple information of the received and forwarded data packet is obtained.
- the quintuple information for sending and forwarding the data packet is obtained.
- the source IP address and destination IP address in the quintuple information of the received and forwarded data packet are exchanged, and the source port and the destination port are exchanged to obtain the quintuple information of the sent original data packet.
- the quintuple information for sending the forwarded data packet is replaced by the NAT information, and the quintuple information for sending the original data packet is obtained. Therefore, only the quintuple information and NAT information of one network data packet in the forwarding scenario need to be stored in the hardware cache of the network device, and the quintuple information of the four network data packets in the forwarding scenario can be obtained.
- the receiving quintuple table records the quintuple information and NAT information of the received data packet in the direct transceiving scenario.
- the quintuple information of the sent data packet is obtained. Therefore, the hardware cache in the network device only needs to store the quintuple information and NAT information of one network data packet in the direct transceiving scenario, and then the quintuple information of the two network data packets in the direct transceiving scenario can be obtained.
- Each entry in the receiving fast table is the hash value (Hash value, also called hash value) of the quintuple information of the IPv4 network data packet received by the network device in the receiving direction (that is, from the server S).
- h_rx is the index, which records whether the quintuple information of the IPv4 network data packet corresponding to the hash value h_rx exists in the receiving quintuple table; if it exists in the receiving quintuple table, it is recorded in the receiving quintuple table. Location.
- Each entry in the sending fast table is indexed by the hash value h_tx of the quintuple information of the IPv4 network data packet received by the network device from the sending direction (that is, from the forwarded device—mobile phone B), Record whether the IPv4 network data packet corresponding to the hash value h_tx has an entry in the receiving fast table; if it exists in the receiving fast table, record the position in the receiving fast table.
- Step S20 When the network device receives the IPv4 network data packet in the receiving direction (hereinafter referred to as the receiving data packet), it calculates the hash value h_rx of the quintuple information of the received data packet, and uses the hash value h_rx as an index to query the receiving data packet. Fast table, to obtain whether the quintuple information of the received data packet is stored in the receiving quintuple table. If yes, go to step S25. If not, go to step S70.
- the receiving data packet calculates the hash value h_rx of the quintuple information of the received data packet, and uses the hash value h_rx as an index to query the receiving data packet.
- Fast table to obtain whether the quintuple information of the received data packet is stored in the receiving quintuple table. If yes, go to step S25. If not, go to step S70.
- Step S25 Obtain the location where the quintuple information of the received data packet is stored in the receiving quintuple table from the receiving fast table, and read the quintuple information of the network data packet from the corresponding position in the receiving quintuple table. Then, the quintuple information of the received data packet is matched with the quintuple information of the network data packet read in the received quintuple table. When the two are completely matched, it is considered that the received data packet belongs to a network service with special requirements, and the process goes to step S30. Otherwise, go to step S70.
- Step S30 Query whether the received data packet needs to be forwarded in the received quintuple table.
- the received data packet is the received original data packet in the forwarding scenario
- the NAT information of the received data packet recorded in the receiving quintuple table is used to replace the quintuple information of the received original data packet, and the received and forwarded data is obtained.
- the quintuple information of the packet Send the received and forwarded data packet to step S60.
- the received data packet is a received data packet in a direct transceiving scenario, and the received data packet is sent to step S60.
- Step S60 Perform special processing on the sent network data packets, such as prioritizing processing, accelerating processing through hardware and/or software, allocating more bandwidth, and the like.
- Step S70 It is considered that the network data packet belongs to a conventional network service, and the network data packet is processed conventionally.
- Embodiment 2 sending direction of a method for sharing sending and receiving buffers in a network device provided by the present application includes the following steps.
- Step S10 The network device is configured with a receiving quintuple table, a receiving fast table, and a sending fast table.
- Step S40 When the network device receives the IPv4 network data packet in the sending direction (hereinafter referred to as the sending data packet), it calculates the hash value h_tx of the quintuple information of the sending data packet, and uses the hash value h_tx as the index to query and send Fast table, to obtain whether the quintuple information of the sending data packet is stored in the receiving fast table. If yes, go to step S41. If not, go to step S70.
- the sending data packet calculates the hash value h_tx of the quintuple information of the sending data packet, and uses the hash value h_tx as the index to query and send Fast table, to obtain whether the quintuple information of the sending data packet is stored in the receiving fast table. If yes, go to step S41. If not, go to step S70.
- Step S41 Obtain the position where the quintuple information of the sending data packet is stored in the receiving fast table from the sending fast table, and inquire whether the quintuple information of the sending data packet is stored in the receiving fast table from the corresponding position in the receiving fast table. in the tuple table. If yes, go to step S42. If not, go to step S70.
- Step S42 Obtain the location where the quintuple information of the sending data packet is stored in the receiving quintuple table from the receiving fast table, and read the quintuple information and NAT information. It is judged whether the sent data packet matches the quintuple information and NAT information of the network data packet read from the corresponding position of the receiving quintuple table, and the specific matching rules are as follows.
- the record in the receiving quintuple table When the record in the receiving quintuple table indicates that the sending data packet needs to be forwarded, it indicates that the sending data packet is the original sending data packet in the forwarding scenario.
- the translation IP address in the NAT information is the same, and the destination IP address of the sending data packet is the same as the source IP address in the quintuple information read in the receiving quintuple table, and the source port of the sending data packet is the same as that of the receiving quintuple table.
- the translation port in the NAT information read in the quintuple table is the same, and the destination port of the sending data packet is the same as the source port in the quintuple information read in the receiving quintuple table, and the sending data packet is the same as the source port.
- the protocol type is the same as the protocol type in the quintuple information read in the receiving quintuple table, it is considered that the matching is successful, the sent data packet belongs to the network service with special requirements, and the process goes to step S50. Otherwise, go to step S70.
- the record in the receiving quintuple table indicates that the sending data packet does not need to be forwarded, it indicates that the sending data packet is a sending data packet in the direct sending and receiving scenario.
- the destination IP address in the obtained quintuple information is the same, and the destination IP address of the sending data packet is the same as the source IP address in the quintuple information read in the receiving quintuple table, and the source IP address of the sending data packet is the same.
- the port is the same as the destination port in the quintuple information read in the receiving quintuple table
- the destination port of the sending data packet is the same as the source port in the quintuple information read in the receiving quintuple table
- the protocol type of the sending data packet is the same as the protocol type in the quintuple information read in the receiving quintuple table, it is considered that the matching is successful, the sending data packet belongs to a network service with special requirements, and the process goes to step S50. Otherwise, go to step S70.
- Step S50 Query whether the sending data packet needs to be forwarded in the receiving quintuple table. Since the receiving quintuple table only saves the quintuple information and NAT information of the received data packet in the direct sending and receiving scenario, and only saves the quintuple information and NAT information of the received original data packet in the forwarding scenario, the query also uses the steps Matching rules for S42.
- step S60 If yes, it indicates that the sending data packet is the sending original data packet in the forwarding scenario, and replaces the sending original data with the destination IP address and destination port information of the network data packet matching the sending data packet recorded in the receiving quintuple table.
- the source IP address and source port information of the packet are used to obtain the quintuple information for sending and forwarding the data packet. Send the forwarding data packet to step S60.
- the sending data packet is a sending data packet in the direct sending and receiving scenario, and the sending data packet is sent to step S60.
- Step S60 Perform special processing on the sent network data packets.
- Step S70 It is considered that the network data packet belongs to a conventional network service, and the network data packet is processed conventionally.
- the first embodiment (receiving direction) of the network device provided by the present application includes a table setting unit 10 , a receiving query unit 20 , a receiving matching unit 25 , a receiving forwarding unit 30 , a special processing unit 60 and a conventional processing unit 70 .
- the table setting unit 10 is used for setting the receiving quintuple table, the receiving fast table and the sending fast table in the network device.
- the receiving quintuple table records quintuple information and NAT information of one or more IPv4 network data packets that need to be specially processed and received by the network device.
- the direct sending and receiving scenario only the quintuple information and NAT information of the received data packet are saved, and the quintuple information of the sent data packet is not saved.
- the forwarding scenario only the quintuple information and NAT information of the received original data packet are saved, the quintuple information of the received and forwarded data packet is not saved, the quintuple information of the sent original data packet is not saved, and the quintuple information of the sent and forwarded data packet is not saved. Tuple information.
- the NAT information includes translation IP addresses, translation ports, and whether each network data packet needs to be forwarded.
- Each entry in the receiving fast table is indexed by the hash value h_rx of the quintuple information of the IPv4 network data packet in the receiving direction received by the network device, and the IPv4 network data packet corresponding to the hash value h_rx is recorded. Whether the quintuple information exists in the receiving quintuple table; if it exists in the receiving quintuple table, record the position in the receiving quintuple table.
- Each entry in the sending fast table is indexed by the hash value h_tx of the quintuple information of the IPv4 network data packet received by the network device from the sending direction, and the IPv4 network data corresponding to the hash value h_tx is recorded. Whether the packet has an entry in the receiving fast table; if it exists in the receiving fast table, record the position in the receiving fast table.
- the receiving query unit 20 is used to calculate the hash value h_rx of the quintuple information of the receiving data packet when the network device receives the IPv4 network data packet in the receiving direction (hereinafter referred to as the receiving data packet), and use the hash value h_rx is an index query receiving fast table, and obtains whether the quintuple information of the received data packet is stored in the receiving quintuple table. If yes, the receiving query unit 20 sends the received data packet to the receiving matching unit 25 . If not, the receiving query unit 20 sends the received data packet to the normal processing unit 70 .
- the receiving matching unit 25 is used to obtain the position where the quintuple information of the received data packet is stored in the receiving quintuple table from the receiving fast table, and read the network data packet from the corresponding position of the receiving quintuple table. Quintuple information. Then, the quintuple information of the received data packet is matched with the quintuple information of the network data packet read in the received quintuple table. When the two are completely matched, it is considered that the received data packet belongs to a network service with special requirements, and the received data packet is sent to the receiving and forwarding unit 30 . Otherwise, the received data packet is sent to the conventional processing unit 70 .
- the receiving and forwarding unit 30 is configured to query whether the received data packet needs to be forwarded in the receiving quintuple table. If yes, it means that the received data packet is the received original data packet in the forwarding scenario, and the NAT information of the received data packet recorded in the receiving quintuple table is used to replace the quintuple information of the received original data packet, and the received and forwarded data is obtained. The quintuple information of the packet.
- the receiving and forwarding unit 30 then sends the received and forwarded data packets to the special processing unit 60 . If not, it indicates that the received data packet is a received data packet in a direct transceiving scenario, and the receiving and forwarding unit 30 sends the received data packet to the special processing unit 60 .
- the special processing unit 60 is used to perform special processing on the sent network data packets.
- the conventional processing unit 70 is used to perform conventional processing on the network data packet.
- the second embodiment (sending direction) of the network device includes a table setting unit 10 , a sending query unit 1 40 , a sending query unit 2 41 , a sending matching unit 42 , a sending forwarding unit 50 , and a special processing unit 60 and conventional processing unit 70.
- the table setting unit 10 is used for setting the receiving quintuple table, the receiving fast table and the sending fast table in the network device.
- the sending query unit 1 40 is used to calculate the hash value h_tx of the quintuple information of the sending data packet when the network device receives the IPv4 network data packet in the sending direction (hereinafter referred to as the sending data packet), and use the hash value h_tx.
- the value h_tx is the index query sending fast table, to obtain whether the quintuple information of the sending data packet is stored in the receiving fast table. If yes, the sending query unit 1 40 sends the sending data packet to the sending query unit 2 41 . If not, the sending query unit 1 40 sends the sending data packet to the conventional processing unit 70 .
- the sending query unit 2 41 is used to obtain the position where the quintuple information of the sending data packet is stored in the receiving fast table from the sending fast table, and query the quintuple of the sending data packet from the corresponding position of the receiving fast table. Whether the information is stored in the receive quintuple table. If yes, the sending query unit 2 41 sends the sending data packet to the sending matching unit 42 . If not, the sending query unit 2 41 sends the sending data packet to the regular processing unit 70 .
- the sending matching unit 42 is used to obtain the position where the quintuple information of the sending data packet is stored in the receiving quintuple table from the receiving fast table, and read the network data packet from the corresponding position of the receiving quintuple table. Quintuple information and NAT information. It is judged whether the sent data packet matches the quintuple information and NAT information of the network data packet read from the corresponding position of the receiving quintuple table, and the specific matching rule is the same as step S42. If the matching is successful, the sending matching unit 42 sends the sending data packet to the sending and forwarding unit 50 . Otherwise, the sending matching unit 42 sends the sending data packet to the regular processing unit 70 .
- the sending and forwarding unit 50 is configured to query whether the sending data packet needs to be forwarded in the receiving quintuple table. Since the receiving quintuple table only saves the quintuple information and NAT information of the received data packet in the direct sending and receiving scenario, and only saves the quintuple information and NAT information of the received original data packet in the forwarding scenario, the query also uses the steps Matching rules for S42. If so, the sending and forwarding unit 50 replaces the source IP address and source port information of the original data packet with the destination IP address and destination port information of the network data packet that matches the sending data packet recorded in the receiving quintuple table, respectively. , the quintuple information of sending and forwarding packets is obtained. The sending and forwarding unit 50 then sends the sending and forwarding data packet to the special processing unit 60 . If not, the sending and forwarding unit 50 sends the sending data packet to the special processing unit 60 .
- the special processing unit 60 is used to perform special processing on the sent network data packets.
- the conventional processing unit 70 is used to perform conventional processing on the network data packet.
- the network device and the method for sharing sending and receiving buffers provided by the present application have the following beneficial effects.
- mapping from the sending fast table to the receiving fast table is designed, so that when processing IPv4 network packets in the sending direction, the receiving quintuple table information can be searched through the receiving fast table, and the network data packets can be matched, and the matching is sufficient.
- the receiving quintuple table information can be searched through the receiving fast table, and the network data packets can be matched, and the matching is sufficient.
- the hardware of the network device only needs to cache the receiving fast table, the receiving quintuple table received by the network device, and the sending fast table, and does not need to cache the receiving quintuple table sent by the network device, thereby saving about 40% to 50%. cache space.
- the network device can automatically replace the translation IP address and translation port in the forwarding data packet according to the forwarding flag of the network data packet, which is simple in implementation and flexible in control.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
一种网络设备中共享发送和接收缓存的方法,在接收方向包括如下步骤:网络设备中设置接收五元组表、接收快表、发送快表;当网络设备收到接收方向的IPv4网络数据包时,计算哈希值h_rx,查询接收快表;如果该接收数据包的五元组信息存储在接收五元组表中,从接收五元组表的相应位置读取网络数据包的五元组信息;随后进行匹配;当两者完全匹配,在接收五元组表中查询该接收数据包是否需要转发;如果是,使用接收五元组表中记录的该接收数据包的NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息;将接收转发数据包进行特殊处理。上述方法节省了硬件设备缓存网络数据包的五元组信息所需空间。
Description
本申请涉及一种网络设备中减少对网络数据包的缓存需求的方法。
路由器、手机等网络设备既可以直接访问网络,也可以充当接入点(access point,AP)给其他设备提供上网服务。当网络设备作为接入点通过IPv4协议提供上网服务时,需要提供网络数据包的转发服务,更改网络数据包的五元组信息中的IP地址、端口信息,然后再将网络数据包转发出去。网络数据包的五元组信息是指网络数据包的源IP地址、目的IP地址、源端口、目的端口、协议。
例如手机A直接访问网络。手机A的IP地址为IP_A,互联网服务器S的IP地址为IP_S,手机A通过端口Port_A访问互联网服务器S的端口Port_S。在接收方向上,有接收数据包;这是指服务器S发给手机A的网络数据包,五元组信息为(IP_S,IP_A,Port_S,Port_A,6),其中6表示TCP协议号。在发送方向上,有发送数据包;这是指手机A发给服务器S的网络数据包,五元组信息为(IP_A,IP_S,Port_A,Port_S,6)。
又如手机A一方面通过移动通讯网络访问互联网,另一方面作为WiFi热点;手机B通过连接手机A的WiFi热点来访问互联网。手机A的IP地址为IP_A,手机B的IP地址为IP_B,互联网服务器S的IP地址为IP_S。手机B通过端口Port_B连接手机A的端口Port_A,手机A通过端口Port_A访问互联网服务器S的端口Port_S。
在接收方向上,有接收原始数据包和接收转发数据包。接收原始数据包是服务器S发给手机A的网络数据包,五元组信息为(IP_S,IP_A,Port_S,Port_A,6)。接收转发数据包是手机A转发给手机B的网络数据包,五元组信息为(IP_S,IP_B,Port_S,Port_B,6)。手机A将接收原始数据包中的目的IP地址和目的端口做了网络地址转换(network
address translation,NAT)得到接收转发数据包。
在发送方向上,有发送原始数据包和发送转发数据包。发送原始数据包是手机B发给手机A的网络数据包,五元组信息为(IP_B,IP_S,Port_B,Port_S,6)。发送转发数据包是手机A转发给服务器S的网络数据包,五元组信息为(IP_A,IP_S,Port_A,Port_S,6)。手机A将发送原始数据包中的源IP地址和源端口做了网络地址转换得到发送转发数据包。
当手机A作为转发设备时,手机A中仅保存有接收原始数据包的五元组信息、发送原始数据包的五元组信息以及NAT信息(IP_A与IP_B转换,Port_A与Port_B转换)。使用NAT信息替换前面两个网络数据包的五元组信息就分别得到接收转发数据包的五元组信息、发送转发数据包的五元组信息。现有技术中,当存在转发场景时,在网络设备的硬件缓存中需要存储转发场景下的两个不同的网络数据包的五元组信息以及NAT信息。如何在满足网络性能要求的前提下减少网络设备中的硬件缓存需求,或者在同样大小的硬件缓存下提供更好的网络性能,就成为一个亟待解决的技术问题。
本申请所要解决的技术问题是提供一种网络设备在转发场景下可以减少缓存需求的方法。
为解决上述技术问题,本申请提出了一种网络设备中共享发送和接收缓存的方法,在接收方向包括如下步骤。步骤S10:网络设备中设置接收五元组表、接收快表、发送快表。所述接收五元组表记录网络设备接收的一个或多个需要进行特殊处理的IPv4网络数据包的五元组信息以及NAT信息;直接收发场景下仅保存接收数据包的五元组信息以及NAT信息;转发场景下仅保存接收原始数据包的五元组信息以及NAT信息;所述NAT信息包括转换IP地址、转换端口、以及每一个网络数据包是否需要转发。所述接收快表中的每一表项是以网络设备收到的接收方向的IPv4网络数据包的五元组信息的哈希值h_rx为索引,记录该哈希值h_rx对应的IPv4网络数据包的五元组信息是否存在于接收五元组表中;如果存在于接收五元组表中,记录在接收五元组表中的位置。所述发送快表中的每一表项是以网络设备收到的来自发送方向的IPv4网络数据包的五元组信息的哈希值h_tx为索引,记录该哈希值h_tx对应的IPv4网络数据包是否有表项存在于接收快表中;如果存在于接收快表中,记录在接收快表中的位置。步骤S20:当网络设备收到接收方向的IPv4网络数据包时,以下称接收数据包,计算该接收数据包的五元组信息的哈希值h_rx,以该哈希值h_rx为索引查询接收快表,获取该接收数据包的五元组信息是否存储在接收五元组表中;如果是,进入步骤S25;如果否,进入步骤S70。步骤S25:从接收快表中获取该接收数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息;随后将该接收数据包的五元组信息与接收五元组表中读取的网络数据包的五元组信息进行匹配;当两者完全匹配,进入步骤S30;否则进入步骤S70。步骤S30:在接收五元组表中查询该接收数据包是否需要转发。如果是,使用接收五元组表中记录的该接收数据包的NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息;将接收转发数据包送往步骤S60。如果否,将该接收数据包送往步骤S60。步骤S60:对送来的网络数据包进行特殊处理。步骤S70:对该网络数据包进行常规处理。上述方法节省了硬件设备缓存网络数据包的五元组信息所需空间。
进一步地,所述步骤S10中,当所述接收五元组表记录了转发场景下的接收原始数据包的五元组信息以及NAT信息,使用NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息;将接收原始数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送转发数据包的五元组信息;将接收转发数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送原始数据包的五元组信息;或者,使用NAT信息替换发送转发数据包的五元组信息,就得到了发送原始数据包的五元组信息。这是转发场景下的一种网络数据包的五元组信息和NAT信息如何还原出四种网络数据包的五元组信息的示例性说明。
进一步地,所述步骤S10中,当所述接收五元组表记录了直接收发场景下的接收数据包的五元组信息以及NAT信息,将接收数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送数据包的五元组信息。这是直接收发场景下的一种网络数据包的五元组信息和NAT信息如何还原出两种网络数据包的五元组信息的示例性说明。
进一步地,所述接收方向是指从服务器发给该网络设备的方向。这是对接收方向的具体说明。
进一步地,所述发送方向是指从被转发设备发给该网络设备的方向。这是对发送方向的具体说明。
进一步地,在转发场景下,有服务器、该网络设备、被转发设备三方;接收原始数据包是服务器发给该网络设备的网络数据包,接收转发数据包是该网络设备转发给被转发设备的网络数据包。这是对接收原始数据包、接收转发数据包的具体说明。
进一步地,在发送方向包括如下步骤。步骤S10:网络设备中设置接收五元组表、接收快表、发送快表。步骤S40:当网络设备收到发送方向的IPv4网络数据包时,以下称发送数据包,计算该发送数据包的五元组信息的哈希值h_tx,以该哈希值h_tx为索引查询发送快表,获取该发送数据包的五元组信息是否存储在接收快表中;如果是,进入步骤S41;如果否,进入步骤S70。步骤S41:从发送快表中获取该发送数据包的五元组信息存储在接收快表中的位置,并从接收快表的相应位置查询该发送数据包的五元组信息是否存储在接收五元组表中;如果是,进入步骤S42;如果否,进入步骤S70。步骤S42:从接收快表中获取该发送数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息和NAT信息;判断该发送数据包与从接收五元组表的相应位置读取的网络数据包的五元组信息和NAT信息是否匹配,具体匹配规则如下。当接收五元组表中的记录表明该发送数据包需要转发,说明该发送数据包是转发场景下的发送原始数据包,如果该发送数据包的源IP地址与接收五元组表中读取的NAT信息中的转换IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的NAT信息中的转换端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,进入步骤S50;否则进入步骤S70。当接收五元组表中的记录表明该发送数据包不需要转发,说明该发送数据包是直接收发场景下的发送数据包,如果该发送数据包的源IP地址与接收五元组表中读取的五元组信息中的目的IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的五元组信息中的目的端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,进入步骤S50;否则进入步骤S70。步骤S50:在接收五元组表中查询该发送数据包是否需要转发,查询时也采用步骤S42的匹配规则。如果是,使用接收五元组表中记录的该发送数据包所匹配的网络数据包的目的IP地址和目的端口信息分别替换发送原始数据包的源IP地址和源端口信息,就得到了发送转发数据包的五元组信息;将发送转发数据包送往步骤S60。如果否,将该发送数据包送往步骤S60。步骤S60:对送来的网络数据包进行特殊处理。步骤S70:对该网络数据包进行常规处理。上述发送方向的处理方法与接收方向的处理方法相结合,就可以理解为何本申请在硬件设备中仅需保存一种网络数据包的五元组信息和NAT信息,即可满足接收方向和发送方向的处理需求。
进一步地,在转发场景下,有服务器、该网络设备、被转发设备三方;发送原始数据包是被转发设备发给该网络设备的网络数据包,发送转发数据包是该网络设备转发给服务器的网络数据包。这是发送原始数据包、发送转发数据包的具体说明。
本申请还提出了一种网络设备,在接收方向上包括表格设置单元、接收查询单元、接收匹配单元、接收转发单元、特殊处理单元和常规处理单元。所述表格设置单元用来在网络设备中设置接收五元组表、接收快表、发送快表。所述接收五元组表记录网络设备接收的一个或多个需要进行特殊处理的IPv4网络数据包的五元组信息以及NAT信息;直接收发场景下仅保存接收数据包的五元组信息以及NAT信息;转发场景下仅保存接收原始数据包的五元组信息以及NAT信息;所述NAT信息包括转换IP地址、转换端口、以及每一个网络数据包是否需要转发。所述接收快表中的每一表项是以网络设备收到的接收方向的IPv4网络数据包的五元组信息的哈希值h_rx为索引,记录该哈希值h_rx对应的IPv4网络数据包的五元组信息是否存在于接收五元组表中;如果存在于接收五元组表中,记录在接收五元组表中的位置。所述发送快表中的每一表项是以网络设备收到的来自发送方向的IPv4网络数据包的五元组信息的哈希值h_tx为索引,记录该哈希值h_tx对应的IPv4网络数据包是否有表项存在于接收快表中;如果存在于接收快表中,记录在接收快表中的位置。所述接收查询单元用来当网络设备收到接收方向的IPv4网络数据包时,以下称接收数据包,计算该接收数据包的五元组信息的哈希值h_rx,以该哈希值h_rx为索引查询接收快表,获取该接收数据包的五元组信息是否存储在接收五元组表中;如果是,所述接收查询单元将该接收数据包送往接收匹配单元;如果否,所述接收查询单元将该接收数据包送往常规处理单元。所述接收匹配单元用来从接收快表中获取该接收数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息;随后将该接收数据包的五元组信息与接收五元组表中读取的网络数据包的五元组信息进行匹配;当两者完全匹配,将该接收数据包送往接收转发单元;否则将该接收数据包送往常规处理单元。所述接收转发单元用来在接收五元组表中查询该接收数据包是否需要转发;如果是,使用接收五元组表中记录的该接收数据包的NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息;所述接收转发单元再将接收转发数据包送往特殊处理单元;如果否,所述接收转发单元该接收数据包送往特殊处理单元。所述特殊处理单元用来对送来的网络数据包进行特殊处理。所述常规处理单元用来对该网络数据包进行常规处理。上述装置节省了硬件设备缓存网络数据包的五元组信息所需空间。
进一步地,在发送方向上包括表格设置单元、发送查询单元一、发送查询单元二、发送匹配单元、发送转发单元、特殊处理单元和常规处理单元。所述发送查询单元一用来当网络设备收到发送方向的IPv4网络数据包时,以下称发送数据包,计算该发送数据包的五元组信息的哈希值h_tx,以该哈希值h_tx为索引查询发送快表,获取该发送数据包的五元组信息是否存储在接收快表中;如果是,所述发送查询单元一将该发送数据包送往发送查询单元二;如果否,所述发送查询单元一将该发送数据包送往常规处理单元。所述发送查询单元二用来从发送快表中获取该发送数据包的五元组信息存储在接收快表中的位置,并从接收快表的相应位置查询该发送数据包的五元组信息是否存储在接收五元组表中;如果是,所述发送查询单元二将该发送数据包送往发送匹配单元;如果否,所述发送查询单元二将该发送数据包送往常规处理单元。所述发送匹配单元用来从接收快表中获取该发送数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息和NAT信息;判断该发送数据包与从接收五元组表的相应位置读取的网络数据包的五元组信息和NAT信息是否匹配,具体匹配规则如下。当接收五元组表中的记录表明该发送数据包需要转发,说明该发送数据包是转发场景下的发送原始数据包,如果该发送数据包的源IP地址与接收五元组表中读取的NAT信息中的转换IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的NAT信息中的转换端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,所述发送匹配单元将该发送数据包送往发送转发单元;否则,所述发送匹配单元将该发送数据包送往常规处理单元。当接收五元组表中的记录表明该发送数据包不需要转发,说明该发送数据包是直接收发场景下的发送数据包,如果该发送数据包的源IP地址与接收五元组表中读取的五元组信息中的目的IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的五元组信息中的目的端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,所述发送匹配单元将该发送数据包送往发送转发单元;否则,所述发送匹配单元将该发送数据包送往常规处理单元。所述发送转发单元用于在接收五元组表中查询该发送数据包是否需要转发,查询时也采用所述发送匹配单元的匹配规则;如果是,所述发送转发单元使用接收五元组表中记录的该发送数据包所匹配的网络数据包的目的IP地址和目的端口信息分别替换发送原始数据包的源IP地址和源端口信息,就得到了发送转发数据包的五元组信息;所述发送转发单元再将发送转发数据包送往特殊处理单元;如果否,所述发送转发单元将该发送数据包送往特殊处理单元。上述发送方向的处理方法与接收方向的处理装置相结合,就可以理解为何本申请在硬件设备中仅需保存一种网络数据包的五元组信息和NAT信息,即可满足接收方向和发送方向的处理需求。
本申请取得的技术效果是网络设备的硬件只需要缓存接收快表、网络设备接收的的接收五元组表、发送快表,不需要缓存网络设备发送的接收五元组表,从而节省约40%至50%的缓存空间。
图1是本申请提供的网络设备中共享发送和接收缓存的方法的实施例一(接收方向)的流程图。
图2是本申请提供的网络设备中共享发送和接收缓存的方法的实施例二(发送方向)的流程图。
图3是本申请提供的网络设备的实施例一(接收方向)的结构示意图。
图4是本申请提供的网络设备的实施例二(发送方向)的结构示意图。
图中附图标记说明:10为表格设置单元、20为接收查询单元、25为接收匹配单元、30为接收转发单元、40为发送查询单元一、41为发送查询单元二、42为发送匹配单元、50为发送转发单元、60为特殊处理单元、70为常规处理单元。
请参阅图1,本申请提供的网络设备中共享发送和接收缓存的方法的实施例一(接收方向)包括如下步骤。
步骤S10:网络设备中设置接收五元组表、接收快表、发送快表。这些表例如用于网络数据包的加速处理。网络设备的不同网络业务通常有不同的优先级、带宽等特殊需求,网络设备根据网络数据包的五元组信息来判断该网络数据包是否属于具有特殊需求的网络业务,如果是则进行特殊处理,如优先处理、通过硬件和/或软件加速处理、分配更多带宽等。
所述接收五元组表记录网络设备接收的一个或多个需要进行特殊处理的IPv4网络数据包的五元组信息以及NAT信息,其中仅需一个IPv4网络数据包的五元组信息以及NAT信息就能还原出转发场景下的四种网络数据包的五元组信息、或者还原出直接收发场景下的两种网络数据包的五元组信息。直接收发场景下仅保存接收数据包的五元组信息以及NAT信息,不保存发送数据包的五元组信息。转发场景下仅保存接收原始数据包的五元组信息以及NAT信息,不保存接收转发数据包的五元组信息,不保存发送原始数据包的五元组信息,不保存发送转发数据包的五元组信息。所述NAT信息包括转换IP地址、转换端口、以及每一个网络数据包是否需要转发。
例如,接收五元组表记录了转发场景下的接收原始数据包的五元组信息以及NAT信息。使用NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息。将接收原始数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送转发数据包的五元组信息。将接收转发数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送原始数据包的五元组信息。或者,使用NAT信息替换发送转发数据包的五元组信息,就得到了发送原始数据包的五元组信息。因此,在网络设备中的硬件缓存中仅需存储转发场景下的一个网络数据包的五元组信息以及NAT信息,就可以得到转发场景下的四种网络数据包的五元组信息。
又如,接收五元组表记录了直接收发场景下的接收数据包的五元组信息以及NAT信息。将接收数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送数据包的五元组信息。因此,在网络设备中的硬件缓存中仅需存储直接收发场景下的一个网络数据包的五元组信息以及NAT信息,就可以得到直接收发场景下的两种网络数据包的五元组信息。
所述接收快表中的每一表项是以网络设备收到的接收方向(即来自服务器S)的IPv4网络数据包的五元组信息的哈希值(Hash value,也称散列值)h_rx为索引,记录该哈希值h_rx对应的IPv4网络数据包的五元组信息是否存在于接收五元组表中;如果存在于接收五元组表中,记录在接收五元组表中的位置。
所述发送快表中的每一表项是以网络设备收到的来自发送方向(即来自被转发设备——手机B)的IPv4网络数据包的五元组信息的哈希值h_tx为索引,记录该哈希值h_tx对应的IPv4网络数据包是否有表项存在于接收快表中;如果存在于接收快表中,记录在接收快表中的位置。
步骤S20:当网络设备收到接收方向的IPv4网络数据包(以下称接收数据包)时,计算该接收数据包的五元组信息的哈希值h_rx,以该哈希值h_rx为索引查询接收快表,获取该接收数据包的五元组信息是否存储在接收五元组表中。如果是,进入步骤S25。如果否,进入步骤S70。
步骤S25:从接收快表中获取该接收数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息。随后将该接收数据包的五元组信息与接收五元组表中读取的网络数据包的五元组信息进行匹配。当两者完全匹配,认为该接收数据包属于具有特殊需求的网络业务,进入步骤S30。否则进入步骤S70。
步骤S30:在接收五元组表中查询该接收数据包是否需要转发。
如果是,说明该接收数据包是转发场景下的接收原始数据包,使用接收五元组表中记录的该接收数据包的NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息。将接收转发数据包送往步骤S60。
如果否,说明该接收数据包是直接收发场景下的接收数据包,将该接收数据包送往步骤S60。
步骤S60:对送来的网络数据包进行特殊处理,例如优先处理、通过硬件和/或软件加速处理、分配更多带宽等。
步骤S70:认为该网络数据包属于常规网络业务,对该网络数据包进行常规处理。
请参阅图2,本申请提供的网络设备中共享发送和接收缓存的方法的实施例二(发送方向)包括如下步骤。
步骤S10:网络设备中设置接收五元组表、接收快表、发送快表。
步骤S40:当网络设备收到发送方向的IPv4网络数据包(以下称发送数据包)时,计算该发送数据包的五元组信息的哈希值h_tx,以该哈希值h_tx为索引查询发送快表,获取该发送数据包的五元组信息是否存储在接收快表中。如果是,进入步骤S41。如果否,进入步骤S70。
步骤S41:从发送快表中获取该发送数据包的五元组信息存储在接收快表中的位置,并从接收快表的相应位置查询该发送数据包的五元组信息是否存储在接收五元组表中。如果是,进入步骤S42。如果否,进入步骤S70。
步骤S42:从接收快表中获取该发送数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息和NAT信息。判断该发送数据包与从接收五元组表的相应位置读取的网络数据包的五元组信息和NAT信息是否匹配,具体匹配规则如下。
当接收五元组表中的记录表明该发送数据包需要转发,说明该发送数据包是转发场景下的发送原始数据包,如果该发送数据包的源IP地址与接收五元组表中读取的NAT信息中的转换IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的NAT信息中的转换端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,该发送数据包属于具有特殊需求的网络业务,进入步骤S50。否则进入步骤S70。
当接收五元组表中的记录表明该发送数据包不需要转发,说明该发送数据包是直接收发场景下的发送数据包,如果该发送数据包的源IP地址与接收五元组表中读取的五元组信息中的目的IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的五元组信息中的目的端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,该发送数据包属于具有特殊需求的网络业务,进入步骤S50。否则进入步骤S70。
步骤S50:在接收五元组表中查询该发送数据包是否需要转发。由于接收五元组表仅保存直接收发场景下的接收数据包的五元组信息以及NAT信息,仅保存转发场景下的接收原始数据包的五元组信息以及NAT信息,因此查询时也采用步骤S42的匹配规则。
如果是,说明该发送数据包是转发场景下的发送原始数据包,使用接收五元组表中记录的该发送数据包所匹配的网络数据包的目的IP地址和目的端口信息分别替换发送原始数据包的源IP地址和源端口信息,就得到了发送转发数据包的五元组信息。将发送转发数据包送往步骤S60。
如果否,说明该发送数据包是直接收发场景下的发送数据包,将该发送数据包送往步骤S60。
步骤S60:对送来的网络数据包进行特殊处理。
步骤S70:认为该网络数据包属于常规网络业务,对该网络数据包进行常规处理。
请参阅图3,本申请提供的网络设备的实施例一(接收方向)包括表格设置单元10、接收查询单元20、接收匹配单元25、接收转发单元30、特殊处理单元60和常规处理单元70。
所述表格设置单元10用来在网络设备中设置接收五元组表、接收快表、发送快表。
所述接收五元组表记录网络设备接收的一个或多个需要进行特殊处理的IPv4网络数据包的五元组信息以及NAT信息。直接收发场景下仅保存接收数据包的五元组信息以及NAT信息,不保存发送数据包的五元组信息。转发场景下仅保存接收原始数据包的五元组信息以及NAT信息,不保存接收转发数据包的五元组信息,不保存发送原始数据包的五元组信息,不保存发送转发数据包的五元组信息。所述NAT信息包括转换IP地址、转换端口、以及每一个网络数据包是否需要转发。
所述接收快表中的每一表项是以网络设备收到的接收方向的IPv4网络数据包的五元组信息的哈希值h_rx为索引,记录该哈希值h_rx对应的IPv4网络数据包的五元组信息是否存在于接收五元组表中;如果存在于接收五元组表中,记录在接收五元组表中的位置。
所述发送快表中的每一表项是以网络设备收到的来自发送方向的IPv4网络数据包的五元组信息的哈希值h_tx为索引,记录该哈希值h_tx对应的IPv4网络数据包是否有表项存在于接收快表中;如果存在于接收快表中,记录在接收快表中的位置。
所述接收查询单元20用来当网络设备收到接收方向的IPv4网络数据包(以下称接收数据包)时,计算该接收数据包的五元组信息的哈希值h_rx,以该哈希值h_rx为索引查询接收快表,获取该接收数据包的五元组信息是否存储在接收五元组表中。如果是,所述接收查询单元20将该接收数据包送往接收匹配单元25。如果否,所述接收查询单元20将该接收数据包送往常规处理单元70。
所述接收匹配单元25用来从接收快表中获取该接收数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息。随后将该接收数据包的五元组信息与接收五元组表中读取的网络数据包的五元组信息进行匹配。当两者完全匹配,认为该接收数据包属于具有特殊需求的网络业务,将该接收数据包送往接收转发单元30。否则将该接收数据包送往常规处理单元70。
所述接收转发单元30用来在接收五元组表中查询该接收数据包是否需要转发。如果是,说明该接收数据包是转发场景下的接收原始数据包,使用接收五元组表中记录的该接收数据包的NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息。所述接收转发单元30再将接收转发数据包送往特殊处理单元60。如果否,说明该接收数据包是直接收发场景下的接收数据包,所述接收转发单元30该接收数据包送往特殊处理单元60。
所述特殊处理单元60用来对送来的网络数据包进行特殊处理。
所述常规处理单元70用来对该网络数据包进行常规处理。
请参阅图4,本申请提供的网络设备的实施例二(发送方向)包括表格设置单元10、发送查询单元一40、发送查询单元二41、发送匹配单元42、发送转发单元50、特殊处理单元60和常规处理单元70。
所述表格设置单元10用来在网络设备中设置接收五元组表、接收快表、发送快表。
所述发送查询单元一40用来当网络设备收到发送方向的IPv4网络数据包(以下称发送数据包)时,计算该发送数据包的五元组信息的哈希值h_tx,以该哈希值h_tx为索引查询发送快表,获取该发送数据包的五元组信息是否存储在接收快表中。如果是,所述发送查询单元一40将该发送数据包送往发送查询单元二41。如果否,所述发送查询单元一40将该发送数据包送往常规处理单元70。
所述发送查询单元二41用来从发送快表中获取该发送数据包的五元组信息存储在接收快表中的位置,并从接收快表的相应位置查询该发送数据包的五元组信息是否存储在接收五元组表中。如果是,所述发送查询单元二41将该发送数据包送往发送匹配单元42。如果否,所述发送查询单元二41将该发送数据包送往常规处理单元70。
所述发送匹配单元42用来从接收快表中获取该发送数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息和NAT信息。判断该发送数据包与从接收五元组表的相应位置读取的网络数据包的五元组信息和NAT信息是否匹配,具体匹配规则如与步骤S42相同。如匹配成功,所述发送匹配单元42将该发送数据包送往发送转发单元50。否则,所述发送匹配单元42将该发送数据包送往常规处理单元70。
所述发送转发单元50用于在接收五元组表中查询该发送数据包是否需要转发。由于接收五元组表仅保存直接收发场景下的接收数据包的五元组信息以及NAT信息,仅保存转发场景下的接收原始数据包的五元组信息以及NAT信息,因此查询时也采用步骤S42的匹配规则。如果是,所述发送转发单元50使用接收五元组表中记录的该发送数据包所匹配的网络数据包的目的IP地址和目的端口信息分别替换发送原始数据包的源IP地址和源端口信息,就得到了发送转发数据包的五元组信息。所述发送转发单元50再将发送转发数据包送往特殊处理单元60。如果否,所述发送转发单元50将该发送数据包送往特殊处理单元60。
所述特殊处理单元60用来对送来的网络数据包进行特殊处理。
所述常规处理单元70用来对该网络数据包进行常规处理。
与现有技术相比,本申请提供的网络设备及其共享发送和接收缓存的方法具有如下有益效果。
第一,设计了从发送快表到接收快表的映射,使得处理发送方向的IPv4网络数据包时,能通过接收快表查找接收五元组表信息,进行网络数据包的匹配,匹配时充分考虑NAT场景,加速对网络数据包的处理。
第二,网络设备的硬件只需要缓存接收快表、网络设备接收的的接收五元组表、发送快表,不需要缓存网络设备发送的接收五元组表,从而节省约40%至50%的缓存空间。
第三,网络设备能够根据网络数据包的转发标志自动替换转发数据包中的转换IP地址和转换端口,实现简单,控制灵活。
以上仅为本申请的优选实施例,并不用于限定本申请。对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。
Claims (10)
- 一种网络设备中共享发送和接收缓存的方法,其特征是,在接收方向包括如下步骤;步骤S10:网络设备中设置接收五元组表、接收快表、发送快表;所述接收五元组表记录网络设备接收的一个或多个需要进行特殊处理的IPv4网络数据包的五元组信息以及NAT信息;直接收发场景下仅保存接收数据包的五元组信息以及NAT信息;转发场景下仅保存接收原始数据包的五元组信息以及NAT信息;所述NAT信息包括转换IP地址、转换端口、以及每一个网络数据包是否需要转发;所述接收快表中的每一表项是以网络设备收到的接收方向的IPv4网络数据包的五元组信息的哈希值h_rx为索引,记录该哈希值h_rx对应的IPv4网络数据包的五元组信息是否存在于接收五元组表中;如果存在于接收五元组表中,记录在接收五元组表中的位置;所述发送快表中的每一表项是以网络设备收到的来自发送方向的IPv4网络数据包的五元组信息的哈希值h_tx为索引,记录该哈希值h_tx对应的IPv4网络数据包是否有表项存在于接收快表中;如果存在于接收快表中,记录在接收快表中的位置;步骤S20:当网络设备收到接收方向的IPv4网络数据包时,以下称接收数据包,计算该接收数据包的五元组信息的哈希值h_rx,以该哈希值h_rx为索引查询接收快表,获取该接收数据包的五元组信息是否存储在接收五元组表中;如果是,进入步骤S25;如果否,进入步骤S70;步骤S25:从接收快表中获取该接收数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息;随后将该接收数据包的五元组信息与接收五元组表中读取的网络数据包的五元组信息进行匹配;当两者完全匹配,进入步骤S30;否则进入步骤S70;步骤S30:在接收五元组表中查询该接收数据包是否需要转发;如果是,使用接收五元组表中记录的该接收数据包的NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息;将接收转发数据包送往步骤S60;如果否,将该接收数据包送往步骤S60;步骤S60:对送来的网络数据包进行特殊处理;步骤S70:对该网络数据包进行常规处理。
- 根据权利要求1所述的网络设备中共享发送和接收缓存的方法,其特征是,所述步骤S10中,当所述接收五元组表记录了转发场景下的接收原始数据包的五元组信息以及NAT信息,使用NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息;将接收原始数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送转发数据包的五元组信息;将接收转发数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送原始数据包的五元组信息;或者,使用NAT信息替换发送转发数据包的五元组信息,就得到了发送原始数据包的五元组信息。
- 根据权利要求1所述的网络设备中共享发送和接收缓存的方法,其特征是,所述步骤S10中,当所述接收五元组表记录了直接收发场景下的接收数据包的五元组信息以及NAT信息,将接收数据包的五元组信息中的源IP地址和目的IP地址交换、源端口和目的端***换,就得到了发送数据包的五元组信息。
- 根据权利要求1所述的网络设备中共享发送和接收缓存的方法,其特征是,所述接收方向是指从服务器发给该网络设备的方向。
- 根据权利要求1所述的网络设备中共享发送和接收缓存的方法,其特征是,所述发送方向是指从被转发设备发给该网络设备的方向。
- 根据权利要求1所述的网络设备中共享发送和接收缓存的方法,其特征是,在转发场景下,有服务器、该网络设备、被转发设备三方;接收原始数据包是服务器发给该网络设备的网络数据包,接收转发数据包是该网络设备转发给被转发设备的网络数据包。
- 根据权利要求1所述的网络设备中共享发送和接收缓存的方法,其特征是,在发送方向包括如下步骤;步骤S10:网络设备中设置接收五元组表、接收快表、发送快表;步骤S40:当网络设备收到发送方向的IPv4网络数据包时,以下称发送数据包,计算该发送数据包的五元组信息的哈希值h_tx,以该哈希值h_tx为索引查询发送快表,获取该发送数据包的五元组信息是否存储在接收快表中;如果是,进入步骤S41;如果否,进入步骤S70;步骤S41:从发送快表中获取该发送数据包的五元组信息存储在接收快表中的位置,并从接收快表的相应位置查询该发送数据包的五元组信息是否存储在接收五元组表中;如果是,进入步骤S42;如果否,进入步骤S70;步骤S42:从接收快表中获取该发送数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息和NAT信息;判断该发送数据包与从接收五元组表的相应位置读取的网络数据包的五元组信息和NAT信息是否匹配,具体匹配规则如下;当接收五元组表中的记录表明该发送数据包需要转发,说明该发送数据包是转发场景下的发送原始数据包,如果该发送数据包的源IP地址与接收五元组表中读取的NAT信息中的转换IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的NAT信息中的转换端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,进入步骤S50;否则进入步骤S70;当接收五元组表中的记录表明该发送数据包不需要转发,说明该发送数据包是直接收发场景下的发送数据包,如果该发送数据包的源IP地址与接收五元组表中读取的五元组信息中的目的IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的五元组信息中的目的端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,进入步骤S50;否则进入步骤S70;步骤S50:在接收五元组表中查询该发送数据包是否需要转发,查询时也采用步骤S42的匹配规则;如果是,使用接收五元组表中记录的该发送数据包所匹配的网络数据包的目的IP地址和目的端口信息分别替换发送原始数据包的源IP地址和源端口信息,就得到了发送转发数据包的五元组信息;将发送转发数据包送往步骤S60;如果否,将该发送数据包送往步骤S60;步骤S60:对送来的网络数据包进行特殊处理;步骤S70:对该网络数据包进行常规处理。
- 根据权利要求7所述的网络设备中共享发送和接收缓存的方法,其特征是,在转发场景下,有服务器、该网络设备、被转发设备三方;发送原始数据包是被转发设备发给该网络设备的网络数据包,发送转发数据包是该网络设备转发给服务器的网络数据包。
- 一种网络设备,其特征是,在接收方向上包括表格设置单元、接收查询单元、接收匹配单元、接收转发单元、特殊处理单元和常规处理单元;所述表格设置单元用来在网络设备中设置接收五元组表、接收快表、发送快表;所述接收五元组表记录网络设备接收的一个或多个需要进行特殊处理的IPv4网络数据包的五元组信息以及NAT信息;直接收发场景下仅保存接收数据包的五元组信息以及NAT信息;转发场景下仅保存接收原始数据包的五元组信息以及NAT信息;所述NAT信息包括转换IP地址、转换端口、以及每一个网络数据包是否需要转发;所述接收快表中的每一表项是以网络设备收到的接收方向的IPv4网络数据包的五元组信息的哈希值h_rx为索引,记录该哈希值h_rx对应的IPv4网络数据包的五元组信息是否存在于接收五元组表中;如果存在于接收五元组表中,记录在接收五元组表中的位置;所述发送快表中的每一表项是以网络设备收到的来自发送方向的IPv4网络数据包的五元组信息的哈希值h_tx为索引,记录该哈希值h_tx对应的IPv4网络数据包是否有表项存在于接收快表中;如果存在于接收快表中,记录在接收快表中的位置;所述接收查询单元用来当网络设备收到接收方向的IPv4网络数据包时,以下称接收数据包,计算该接收数据包的五元组信息的哈希值h_rx,以该哈希值h_rx为索引查询接收快表,获取该接收数据包的五元组信息是否存储在接收五元组表中;如果是,所述接收查询单元将该接收数据包送往接收匹配单元;如果否,所述接收查询单元将该接收数据包送往常规处理单元;所述接收匹配单元用来从接收快表中获取该接收数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息;随后将该接收数据包的五元组信息与接收五元组表中读取的网络数据包的五元组信息进行匹配;当两者完全匹配,将该接收数据包送往接收转发单元;否则将该接收数据包送往常规处理单元;所述接收转发单元用来在接收五元组表中查询该接收数据包是否需要转发;如果是,使用接收五元组表中记录的该接收数据包的NAT信息替换接收原始数据包的五元组信息,就得到了接收转发数据包的五元组信息;所述接收转发单元再将接收转发数据包送往特殊处理单元;如果否,所述接收转发单元该接收数据包送往特殊处理单元;所述特殊处理单元用来对送来的网络数据包进行特殊处理;所述常规处理单元用来对该网络数据包进行常规处理。
- 根据权利要求9所述的网络设备,其特征是,在发送方向上包括表格设置单元、发送查询单元一、发送查询单元二、发送匹配单元、发送转发单元、特殊处理单元和常规处理单元;所述发送查询单元一用来当网络设备收到发送方向的IPv4网络数据包时,以下称发送数据包,计算该发送数据包的五元组信息的哈希值h_tx,以该哈希值h_tx为索引查询发送快表,获取该发送数据包的五元组信息是否存储在接收快表中;如果是,所述发送查询单元一将该发送数据包送往发送查询单元二;如果否,所述发送查询单元一将该发送数据包送往常规处理单元;所述发送查询单元二用来从发送快表中获取该发送数据包的五元组信息存储在接收快表中的位置,并从接收快表的相应位置查询该发送数据包的五元组信息是否存储在接收五元组表中;如果是,所述发送查询单元二将该发送数据包送往发送匹配单元;如果否,所述发送查询单元二将该发送数据包送往常规处理单元;所述发送匹配单元用来从接收快表中获取该发送数据包的五元组信息存储在接收五元组表中的位置,并从接收五元组表的相应位置读取网络数据包的五元组信息和NAT信息;判断该发送数据包与从接收五元组表的相应位置读取的网络数据包的五元组信息和NAT信息是否匹配,具体匹配规则如下;当接收五元组表中的记录表明该发送数据包需要转发,说明该发送数据包是转发场景下的发送原始数据包,如果该发送数据包的源IP地址与接收五元组表中读取的NAT信息中的转换IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的NAT信息中的转换端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,所述发送匹配单元将该发送数据包送往发送转发单元;否则,所述发送匹配单元将该发送数据包送往常规处理单元;当接收五元组表中的记录表明该发送数据包不需要转发,说明该发送数据包是直接收发场景下的发送数据包,如果该发送数据包的源IP地址与接收五元组表中读取的五元组信息中的目的IP地址相同、且该发送数据包的目的IP地址与接收五元组表中读取的五元组信息中的源IP地址相同、且该发送数据包的源端口与接收五元组表中读取的五元组信息中的目的端口相同、且该发送数据包的目的端口与接收五元组表中读取的五元组信息中的源端口相同、且该发送数据包的协议类型与接收五元组表中读取的五元组信息中的协议类型相同,则认为匹配成功,所述发送匹配单元将该发送数据包送往发送转发单元;否则,所述发送匹配单元将该发送数据包送往常规处理单元;所述发送转发单元用于在接收五元组表中查询该发送数据包是否需要转发,查询时也采用所述发送匹配单元的匹配规则;如果是,所述发送转发单元使用接收五元组表中记录的该发送数据包所匹配的网络数据包的目的IP地址和目的端口信息分别替换发送原始数据包的源IP地址和源端口信息,就得到了发送转发数据包的五元组信息;所述发送转发单元再将发送转发数据包送往特殊处理单元;如果否,所述发送转发单元将该发送数据包送往特殊处理单元。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110295099.2 | 2021-03-19 | ||
CN202110295099.2A CN113132242B (zh) | 2021-03-19 | 2021-03-19 | 一种网络设备及其共享发送和接收缓存的方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022193929A1 true WO2022193929A1 (zh) | 2022-09-22 |
Family
ID=76773397
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/077897 WO2022193929A1 (zh) | 2021-03-19 | 2022-02-25 | 一种网络设备及其共享发送和接收缓存的方法 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113132242B (zh) |
WO (1) | WO2022193929A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113132242B (zh) * | 2021-03-19 | 2022-11-15 | 翱捷科技股份有限公司 | 一种网络设备及其共享发送和接收缓存的方法 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009103225A1 (zh) * | 2008-02-18 | 2009-08-27 | 华为技术有限公司 | 一种报文转发的方法和设备 |
CN101877728A (zh) * | 2010-06-25 | 2010-11-03 | 中兴通讯股份有限公司 | 网络地址转换转发方法及装置 |
CN109600313A (zh) * | 2017-09-30 | 2019-04-09 | 迈普通信技术股份有限公司 | 报文转发方法及装置 |
CN111935021A (zh) * | 2020-09-27 | 2020-11-13 | 翱捷智能科技(上海)有限公司 | 一种快速匹配网络数据包的方法及*** |
CN113132242A (zh) * | 2021-03-19 | 2021-07-16 | 翱捷科技股份有限公司 | 一种网络设备及其共享发送和接收缓存的方法 |
Family Cites Families (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1809033A (zh) * | 2006-02-16 | 2006-07-26 | 四川南山之桥微电子有限公司 | 网络地址转换的硬件实现方法 |
CN101068212B (zh) * | 2007-06-11 | 2010-12-29 | 中兴通讯股份有限公司 | 一种网络地址转换转发的装置及方法 |
CN101150505B (zh) * | 2007-07-31 | 2010-06-16 | 杭州华三通信技术有限公司 | 通过网络地址转换转发数据流的方法和装置 |
CN101132424B (zh) * | 2007-09-29 | 2011-08-31 | 杭州华三通信技术有限公司 | 网络地址转换的方法及装置 |
CN103095595B (zh) * | 2012-12-30 | 2017-07-18 | 大连环宇移动科技有限公司 | 一种基于单向并行多链表的网络数据管理方法及*** |
CN103384221A (zh) * | 2013-06-26 | 2013-11-06 | 汉柏科技有限公司 | 一种业务优先报文快转优化方法 |
CN104639451B (zh) * | 2013-11-14 | 2019-03-22 | 中兴通讯股份有限公司 | 数据流分流方法及控制器 |
CN109688238B (zh) * | 2018-03-26 | 2020-06-09 | 新华三技术有限公司 | 一种nat转换方法、装置及nat设备 |
CN109981463B (zh) * | 2019-02-25 | 2021-07-27 | 网易(杭州)网络有限公司 | 信息处理方法、装置、网关及存储介质 |
CN111597142B (zh) * | 2020-05-15 | 2024-04-12 | 北京光润通科技发展有限公司 | 一种基于fpga的网络安全加速卡及加速方法 |
CN111478855B (zh) * | 2020-06-23 | 2020-09-18 | 翱捷科技(上海)有限公司 | 基于LwIP协议栈的网络设备快速转发的方法及*** |
CN112486914B (zh) * | 2020-11-27 | 2024-04-12 | 神州灵云(北京)科技有限公司 | 一种数据包存储与快查方法与*** |
CN112491901B (zh) * | 2020-11-30 | 2023-03-24 | 北京锐驰信安技术有限公司 | 一种网络流量精细化筛选装置及方法 |
CN112333298B (zh) * | 2020-12-01 | 2022-09-02 | 武汉绿色网络信息服务有限责任公司 | 报文传输方法、装置、计算机设备及存储介质 |
-
2021
- 2021-03-19 CN CN202110295099.2A patent/CN113132242B/zh active Active
-
2022
- 2022-02-25 WO PCT/CN2022/077897 patent/WO2022193929A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009103225A1 (zh) * | 2008-02-18 | 2009-08-27 | 华为技术有限公司 | 一种报文转发的方法和设备 |
CN101877728A (zh) * | 2010-06-25 | 2010-11-03 | 中兴通讯股份有限公司 | 网络地址转换转发方法及装置 |
CN109600313A (zh) * | 2017-09-30 | 2019-04-09 | 迈普通信技术股份有限公司 | 报文转发方法及装置 |
CN111935021A (zh) * | 2020-09-27 | 2020-11-13 | 翱捷智能科技(上海)有限公司 | 一种快速匹配网络数据包的方法及*** |
CN113132242A (zh) * | 2021-03-19 | 2021-07-16 | 翱捷科技股份有限公司 | 一种网络设备及其共享发送和接收缓存的方法 |
Also Published As
Publication number | Publication date |
---|---|
CN113132242B (zh) | 2022-11-15 |
CN113132242A (zh) | 2021-07-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7630368B2 (en) | Virtual network interface card loopback fastpath | |
JP4722157B2 (ja) | ネットワークトラフィックのインテリジェントロードバランシング及びフェイルオーバー | |
US7526569B2 (en) | Router and address identification information management server | |
KR100811890B1 (ko) | 인터넷 시스템에서 서비스 플로우를 보장하는 애니캐스트라우팅 방법 및 장치 | |
WO2019170114A1 (zh) | 发送报文的方法、网络设备及计算机可读存储介质 | |
JP2020520612A (ja) | パケット伝送方法、エッジデバイス及び機械可読記憶媒体 | |
US10652142B2 (en) | SDN-based ARP implementation method and apparatus | |
WO2011131088A1 (zh) | 数据报文处理方法、入口隧道路由器及*** | |
JP2008295043A (ja) | ネットワークトラフィックのインテリジェントロードバランシング及びフェイルオーバー | |
JP2008295041A (ja) | ネットワークトラフィックのインテリジェントロードバランシング及びフェイルオーバー | |
US11201760B2 (en) | Data forwarding method and apparatus based on operating system kernel bridge | |
CN108347392B (zh) | 业务报文跨板处理方法、装置及*** | |
CN111371920A (zh) | Dns前端解析方法及*** | |
WO2021008591A1 (zh) | 数据传输方法、装置及*** | |
WO2011131097A1 (zh) | 数据报文处理方法、***及接入服务节点 | |
US20070133560A1 (en) | Method and apparatus for processing packet in high speed router | |
EP4156626A1 (en) | Ipv6 network communication method, apparatus and system | |
WO2022193929A1 (zh) | 一种网络设备及其共享发送和接收缓存的方法 | |
US11809925B2 (en) | Data processing method and apparatus | |
WO2023236858A1 (zh) | 流表规则的管理方法、流量管理方法、***及存储介质 | |
CN111654443A (zh) | 一种云环境下虚机IPv6地址直接访问公网的方法 | |
CN108777712B (zh) | 区块链节点通信方法、装置及区块链节点 | |
US20100085968A1 (en) | Routing Data in a Computing Device | |
WO2019242374A1 (zh) | 数据结构、数据索引方法、装置及设备、存储介质 | |
US20180367452A1 (en) | Information centric networking over multi-access network interfaces |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22770284 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 22770284 Country of ref document: EP Kind code of ref document: A1 |