Packet transmission method and device, and storage medium

By establishing tunnels and using flow tables to route packets through the same network device in SD-WAN, the challenge of ensuring consistent packet routing across multiple devices is addressed, improving communication reliability and efficiency.

JP7580467B2Active Publication Date: 2024-11-11HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2022541917
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2020-01-08
Filing Date
2020-10-12
Publication Date
2024-11-11
Estimated Expiration
2040-10-12

AI Technical Summary

Technical Problem

In software-defined wide area networks (SD-WAN), ensuring that packets for the same application pass through the same network device is challenging when multiple network devices are located at a site, as deep packet inspection (DPI) only works when packets are processed by the same device.

Method used

Establish multiple tunnels between network devices at different sites, and use flow tables to identify and route packets through the same network device by matching flow identifiers, ensuring packets for the same application are routed consistently.

Benefits of technology

Guarantees that packets for the same application always pass through the same network device, enhancing communication reliability and efficiency by reducing unnecessary traversals and queries across network devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007580467000003
    Figure 0007580467000003
  • Figure 0007580467000004
    Figure 0007580467000004
  • Figure 0007580467000005
    Figure 0007580467000005
Patent Text Reader

Abstract

A packet transmission method and apparatus, as well as a storage medium, belonging to the field of communications technology are provided. In the method, after receiving a first data packet from a second site, a first network device searches a stored flow table for a target flow entry. Each flow entry includes a flow identifier and a corresponding outbound interface identifier, and the target flow entry is created when the first site transmits a reverse data flow of the first data packet to the second site. If the target flow entry is found, the first network device transmits the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry. It can be understood that only when the reverse data flow passes through the first network device, the target flow entry exists in the flow table of the first network device, the target flow entry can be found, and therefore the first data packet is transmitted through the interface corresponding to the outbound interface identifier in the target flow entry. Therefore, the present application can ensure that packets transmitted and packets received for the same application pass through the same network device.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present application relates to the field of communication technologies, and in particular to a packet transmission method and apparatus, and a storage medium. [Background technology]

[0002] This application claims priority to Chinese Patent Application No. 202010019654.4, entitled "PACKET SENDING METHOD AND APPARATUS, AND STORAGE MEDIUM," filed on January 8, 2020, which is incorporated by reference in its entirety.

[0003] Software-defined wide area network (SD-WAN) is an important embodiment of software-defined networking (SDN). In SD-WAN, a tunnel is usually established between network devices at two sites using overlay technology, and packets may be sent through the tunnel. In addition, those network devices may further identify the application type to which the packet belongs through deep packet inspection (DPI) and send packets based on the application type. However, to guarantee the reliability of communication, the two network devices are usually located at several important sites. Furthermore, in DPI, the application type can be successfully identified only when packets sent and packets received for the same application pass through the same network device. Therefore, in this case, how to guarantee interworking between two network devices and how to guarantee that packets sent and packets received for the same application pass through the same network device are currently urgent problems to be solved. Summary of the Invention

[0004] The present application provides a packet transmission method and device, and a storage medium, to solve the problem that when multiple network devices are installed at a site, it is not possible to ensure that packets transmitted and packets received for the same application pass through the same network device. The technical solutions are as follows:

[0005] According to a first aspect, a packet transmission method is provided. A plurality of network devices are disposed at a first site. A plurality of tunnels are established between the network devices disposed at the first site and the network devices disposed at a second site. The second site is a site performing data transmission with the first site. In this case, the first network device receives a first data packet from the second site, and the first network device searches a flow table stored in the first network device for a target flow entry whose flow identifier is the flow identifier of the first data flow, and if the target flow entry is found, the first network device transmits the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry.

[0006] The first network device is any one of the above network devices. The flow table includes a plurality of flow entries, each of the plurality of flow entries including a flow identifier and a corresponding outbound interface identifier. The first data flow is a data flow to which the first data packet belongs. The target flow entry is created when the first site sends a second data flow to the second site. The source address of the second data flow is the destination address of the first data flow, and the destination address of the second data flow is the source address of the first data flow.

[0007] In the present application, when receiving a first data packet from a second site, the first network device may search in a flow table for a target flow entry whose flow identifier is the flow identifier of the first data flow. The first data flow is the data flow to which the first data packet belongs. The target flow entry is created when the first site sends a second data flow to the second site. The source address of the second data flow is the destination address of the first data flow, and the destination address of the second data flow is the source address of the first data flow. Thus, the target flow entry is present in the flow table of the first network device only when the second data flow passes through the first network device. Only in this way can the first network device find the target flow entry and then send the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry. In the present application, it can be seen that it is possible to ensure that packets sent and packets received for the same application pass through the same network device.

[0008] Optionally, after the first network device searches for a target flow entry in a flow table stored in the first network device, the target flow entry is not found, and the first network device searches for the target flow entry, the flow identifier of which is the flow identifier of the first data flow. attitude If there is still a network device among the plurality of network devices that does not have the target flow entry, the first network device sends the first data packet to the second network device to instruct the second network device to search for the target flow entry in a flow table stored in the second network device. Here, the second network device selects the network device among the plurality of network devices that has not yet been searched for the target flow entry. attitudeThe target flow entry is not found, and all of the above multiple network devices search for the target flow entry. did If so, the first network device transmits the first data packet through the local route.

[0009] In one example, the network devices at the first site may be connected through network links two by two, i.e., the network devices may communicate with each other two by two. In this case, the first data packet may carry a device identifier of each network device through which the first data packet passes. In this manner, the target flow entry is searched for. attitude When determining whether there is still a network device in the first site that does not have a target flow entry, the first network device searches for a target flow entry among the plurality of network devices in the first site based on a device identifier of the network device carried in the first data packet. attitude You may decide not to use the network devices.

[0010] It should be noted that each network device at the first site stores a local route, which stores routing information between the corresponding network device and the user terminal at the first site. Thus, after the first network device receives the first data packet and the multiple network devices at the first site all search for the target flow entry, the first network device may send the first data packet to the user terminal at the first site based on the local route.

[0011] Optionally, when the first network device transmits the first data packet through an interface corresponding to the outbound interface identifier in the flow entry, if the interface corresponding to the outbound interface identifier in the target flow entry is a first type interface, the first network device transmits the first data packet to the user terminal of the first site through the interface corresponding to the outbound interface identifier in the target flow entry, or if the interface corresponding to the outbound interface identifier in the target flow entry is a second type interface, the first network device transmits the first data packet to a third network device through the interface corresponding to the outbound interface identifier in the target flow entry, and instructs the third network device to search for the target flow entry in a flow table stored in the third network device.

[0012] The first type of interface is an interface for communicating with a user terminal at the first site, the second type of interface is an interface for communicating with another network device of the plurality of network devices, and the third network device is a device of the plurality of network devices that communicates with the first network device through an interface corresponding to the outbound interface identifier in the target flow entry.

[0013] Optionally, before the first network device receives the first data packet from the second site, the first network device receives a second data packet from a user terminal at the first site, the first network device selects a tunnel as a target tunnel from the above multiple tunnels based on the destination address, the first network device determines a flow identifier of the first data flow based on the flow identifier of the second data flow, the first network device adds a target flow entry to a flow table stored in the first network device, and if the target tunnel is a tunnel established between the first network device and the network device at the second site, the first network device transmits the second data packet through the target tunnel.

[0014] The second data packet carries a destination address, and the second data packet belongs to a second data flow. A flow identifier in the target flow entry currently being added by the first network device is a flow identifier of the first data flow. An outbound interface identifier in the target flow entry currently being added is an identifier of the first interface, and the first interface is an interface in the first network device configured to receive the second data packet from the user terminal at the first site.

[0015] It should be noted that since the second data packet belongs to the second data flow, which is a data flow transmitted by a user terminal at the first site to a user terminal at the second site, the destination address carried in the second data packet is the destination address of the user terminal at the second site.

[0016] It should be noted that when the user terminal at the first site sends a second data packet to the user terminal at the second site, since the two user terminals belong to different sites, the user terminal at the first site needs to send the second data packet to the network device at the first site, and then send the second data packet to the network device at the second site through the network device, and then the network device at the second site sends the second data packet to the user terminal at the second site.

[0017] In one example, a user terminal at a first site may select a network device from a plurality of network devices at the first site as a first network device based on a networking scheme of the first site, and then send a second data packet to the first network device, and send the second data packet to a network device at a second site through the first network device.

[0018] Optionally, the first network device stores a routing table, the routing table including a plurality of routing entries, each of the plurality of routing entries including a site prefix and a corresponding site identifier. In this way, when the first network device selects a tunnel as a target tunnel from the plurality of tunnels based on a destination address, the first network device determines a target routing entry from the routing table based on the destination address, where the destination address matches the site prefix included in the target routing entry. The first network device determines one or more tunnel entries based on the site identifier included in the target routing entry, where the one or more tunnel entries are tunnel entries corresponding to a tunnel established between the first site and the second site. The first network device selects a tunnel entry from the one or more tunnel entries as a target tunnel entry, and uses the tunnel corresponding to the target tunnel entry as the target tunnel.

[0019] In this application, a site prefix refers to a network segment corresponding to a site, so that a destination address carried in the second data packet may be matched against the site prefix contained in each routing entry in the routing table to determine a target routing entry from the routing table.

[0020] Based on the above description, it should be noted that the destination address carried in the second data packet is the address of the user terminal of the second site. Therefore, the site prefix included in the target routing entry is the site prefix of the second site, and the site identifier included in the target routing entry is the identifier of the second site.

[0021] In the present application, the first network device may store one tunnel table, and the tunnel table is used to store tunnel entries corresponding to multiple sites. Of course, the first network device may alternatively store multiple tunnel tables, and the multiple tunnel tables are in one-to-one correspondence with the multiple sites. The multiple sites refer to the sites that establish a tunnel with the first site, and the multiple sites include the second site. In these two cases, the manner in which the first network device determines one or more tunnel entries is different. Therefore, the following provides an explanation for these two cases.

[0022] In a first case, the first network device stores one tunnel table. In this case, the first network device may determine one or more tunnel identifiers based on a site identifier included in the target routing entry, where the one or more tunnel identifiers are identifiers of tunnels established between the first site and the second site. The first network device may then determine one or more tunnel entries from the tunnel table based on the one or more tunnel identifiers.

[0023] It should be noted that regardless of how many tunnel tables are stored in the first network device, each tunnel table may include multiple tunnel entries, and each of the multiple tunnel entries may include a tunnel identifier and corresponding tunnel attribute information. The tunnel attribute information may include a tunnel encapsulation method, a source address and a destination address of the tunnel, whether the tunnel is available, a bandwidth of the tunnel, and a delay of the tunnel, etc. In addition, in some cases, the first network device may store a first mapping relationship between a site identifier and a tunnel identifier. Specifically, the first mapping relationship stores an identifier of each site that establishes a tunnel with the first site, and an identifier of a tunnel established between each site and the first site. In this manner, the first network device may determine one or more tunnel identifiers from the first mapping relationship based on the site identifier included in the target routing entry. The first network device may then determine a tunnel entry whose included tunnel identifier is the same as the one or more tunnel identifiers from the tunnel table to obtain one or more tunnel entries.

[0024] In a second case, the first network device stores a plurality of tunnel tables. In this case, the first network device may determine an identifier of the target tunnel table based on a site identifier included in the target routing entry. The target tunnel table is a tunnel table in the plurality of tunnel tables corresponding to the second site. The first network device may then determine a target tunnel table from the plurality of tunnel tables based on the identifier of the target tunnel table, and determine a tunnel entry stored in the target tunnel table as the one or more tunnel entries.

[0025] The first network device may store different tunnel tables for different sites, and the first network device may store a second mapping relationship between the site identifier and the tunnel table identifier. Specifically, the second mapping relationship stores an identifier of each site that establishes a tunnel with the first site and an identifier of a tunnel table corresponding to each site. In this manner, the first network device may determine an identifier of a target tunnel table from the second mapping relationship based on the site identifier included in the target routing entry. Then, a target tunnel table may be determined from the multiple tunnel tables based on the identifier of the target tunnel table, and a tunnel entry in the target tunnel table is further determined as one or more tunnel entries.

[0026] After determining the one or more tunnel entries, the first network device may select a tunnel entry from the one or more tunnel entries as a target tunnel entry according to a tunnel selection policy, and further determine a tunnel corresponding to the target tunnel entry as the target tunnel, i.e., use a tunnel identified by a tunnel identifier included in the target tunnel entry as the target tunnel.

[0027] Optionally, the flow identifier of the second data flow includes source port information and destination port information. When the first network device determines the flow identifier of the first data flow based on the flow identifier of the second data flow, the first network device swaps the source port information and the destination port information in the flow identifier of the second data flow. By , obtain a flow identifier of the first data flow.

[0028] The first data flow is a data flow sent by a user terminal at the second site to a user terminal at the first site, and the second data flow is a data flow sent by a user terminal at the first site to a user terminal at the second site, so the source address of the first data flow is the destination address of the second data flow, and the destination address of the first data flow is the source address of the second data flow.

[0029] In the present application, the first network device may determine a flow identifier for the second data flow based on the second data packet, and may further determine a flow identifier for the first data flow based on the flow identifier of the second data flow.

[0030] In one example, the first network device may obtain tuple information of the second data packet, where the tuple information includes at least source port information and destination port information. The obtained tuple information is used as a flow identifier of the second data flow. Then, the first network device replaces the source port information and the destination port information in the flow identifier of the second data flow to obtain a flow identifier of the first data flow.

[0031] In another example, the first network device may obtain tuple information of a second data packet and obtain a flow identifier of a second data flow from a stored correspondence between tuple information and flow identifiers based on the tuple information of the second data packet. A flow identifier of the first data flow is then obtained from the stored correspondence between identifiers of the first data flow and identifiers of the second data flow based on the flow identifier of the second data flow.

[0032] After determining the flow identifier of the first data flow based on the second data packet, the first network device may add a target flow entry to a flow table stored in the first network device. The flow table may include a plurality of flow entries, each of the plurality of flow entries including a flow identifier and a corresponding outbound interface identifier. Thus, the currently added target flow entry includes a flow identifier and a corresponding outbound interface identifier. Furthermore, the flow identifier in the currently added target flow entry is a flow identifier of the first data flow, and the outbound interface identifier in the currently added target flow entry is an identifier of a first interface, where the first interface is an interface in the first network device configured to receive the second data packet from the user terminal at the first site.

[0033] It should be noted that when the same data flow enters the first network device, the data flow may enter the first network device through an interface for communicating with a user terminal at the first site, or through an interface for communicating with another network device at the first site. Thus, the outbound interface identifier in the target flow entry currently added by the first network device may be an interface in the first network device that communicates with a user terminal at the first site, or may be an interface in the first network device that communicates with another network device at the first site.

[0034] Optionally, after the first network device adds the target flow entry to the flow table stored in the first network device, if the target tunnel is a tunnel established between the fourth network device and the network device of the second site, the first network device adds a tunnel identifier of the target tunnel to the second data packet to obtain a third data packet, and the first network device sends the third data packet to the fourth network device to instruct the fourth network device to separate the second data packet, determine a flow identifier of the first data flow based on the flow identifier of the second data flow, add the target flow entry to the flow table stored in the fourth network device, and send the second data packet through the target tunnel.

[0035] The fourth network device is a network device other than the first network device among the plurality of network devices, and a flow identifier included in the target flow entry currently added by the fourth network device is a flow identifier of the first data flow. An outbound interface identifier in the target flow entry currently added is an identifier of a second interface, and the second interface is an interface in the fourth network device that is configured to receive the third data packet.

[0036] It should be noted that since the tunnel table includes all tunnels established between a network device at a first site and a network device at a second site, the target tunnel determined by the first network device may include a tunnel established between the first network device and a network device at the second site, or a tunnel established between another network device other than the first network device at the first site and a network device at the second site, i.e., a tunnel established between a fourth network device and a network device at the second site.

[0037] In some possible cases, when the target tunnel is a tunnel established between the fourth network device and the network device at the second site, the first network device may add a tunnel index field to the second data packet to obtain a third data packet, where the tunnel index field may include a tunnel identifier of the target tunnel. The first network device may then transmit the third data packet to the fourth network device.

[0038] Based on the above description, a network link is established between the first network device and the fourth network device, and the first network device communicates with the fourth network device through the network link. Thus, the first network device may add a tunnel identifier of the target tunnel to the second data packet to obtain a third data packet, and then send the third data packet to the fourth network device through the network link between the first network device and the fourth network device.

[0039] After the fourth network device receives the third data packet, because the tunnel index field includes not only the tunnel identifier of the target tunnel, but also the encapsulation method, label, version number, protocol type, etc. in the tunnel index field, the fourth network device may separate the second data packet from the third data packet based on information such as the encapsulation method, label, version number, and protocol type.

[0040] In the present application, after separating the second data packet, the fourth network device may determine a flow identifier of the second data flow based on the second data packet, and further determine a flow identifier of the first data flow based on the flow identifier of the second data flow.

[0041] In one example, the fourth network device may obtain tuple information of the second data packet, where the tuple information includes at least source port information and destination port information. The obtained tuple information is used as a flow identifier of the second data flow. Then, the fourth network device replaces the source port information and the destination port information in the flow identifier of the second data flow to obtain a flow identifier of the first data flow.

[0042] In another example, the fourth network device may obtain tuple information of the second data packet and obtain a flow identifier of the second data flow from the stored correspondence between the tuple information and the flow identifier based on the tuple information of the second data packet. A flow identifier of the first data flow is then obtained from the stored correspondence between the identifier of the first data flow and the identifier of the second data flow based on the flow identifier of the second data flow.

[0043] It should be noted that because the fourth network device receives the third data packet through the network link between the fourth network device and the first network device, the outbound interface identifier in the target flow entry currently added by the fourth network device is an interface for communicating with the first network device, i.e., a second type interface.

[0044] After adding the target flow entry to the stored flow table, the fourth network device may obtain a target tunnel entry from the stored tunnel table based on a tunnel identifier of the obtained target tunnel, obtain tunnel attribute information of the target tunnel from the target tunnel entry, further perform tunnel encapsulation on the second data packet based on the obtained tunnel attribute information to obtain a fourth data packet, and transmit the fourth data packet through the target tunnel.

[0045] Optionally, the first data packet is a data packet received by the first network device through a tunnel established between the first network device and the network device at the second site. Alternatively, the first data packet is a data packet received by the first network device and transmitted by a fifth network device, the fifth network device being a network device other than the first network device among the above plurality of network devices.

[0046] Optionally, a network link is established between the network devices, and the network devices communicate through the network link, the network link being a physical link or a network tunnel, the network tunnel including a Generic Routing Encapsulation (GRE) tunnel.

[0047] It should be noted that when the network devices are relatively close to each other, the network link may be a physical link. When the network devices are relatively far from each other or cannot be connected through a physical link, the network link may be a network tunnel, which may include a Generic Routing Encapsulation (GRE) tunnel. Of course, as an alternative, the network tunnel may be another tunnel.

[0048] Furthermore, the network link between the two network devices at the first site is mainly used to synchronize tunnel entries within the site and transmit data packets within the site, and does not need to be advertised to networks outside the site. Therefore, the network addresses on the interfaces on the network devices at the first site used to establish the network link may all be set to private network addresses, and may use the same address space at different sites. This can reduce the consumption of the operator's network address resources by the SD-WAN network.

[0049] Optionally, when the data packet included in the first data flow is transmitted to the second site through a tunnel between the first network device and the network device of the second site, the first network device may transmit the target flow entry to another network device of the first site through a network link after the first network device adds the target flow entry to a flow table stored in the first network device. After receiving the target flow entry, the other network device may modify the outbound interface of the target flow entry to a second type of interface, i.e., the interface through which each other network device communicates with the first network device, and store the modified target flow entry in the flow table. In this way, when receiving the first data packet, the other network device may find the target flow entry in the stored flow table and transmit the first data packet to the first network device through an interface corresponding to the outbound interface identifier included in the target flow entry. The first network device may then transmit the first data packet to a user terminal of the first site based on the target flow entry. It can be seen that by synchronizing the target flow entry with another network device at the first site, the case where the first data packet continues to be traversed and queried between network devices when the target flow entry is not found can be significantly reduced, thereby improving the efficiency of transmission of the first data packet.

[0050] According to a second aspect, another packet transmission method is provided. A plurality of network devices are disposed at a first site. A network link is established between the plurality of network devices. A plurality of tunnels are established between the network device disposed at the first site and a network device disposed at a second site. The second site is a site performing data transmission with the first site. The method includes the first network device receiving a first data packet from the second site, where the first data packet is a data packet received by the first network device through a network link between the first network device and the second network device, the first network device being any one of the plurality of network devices, and the second network device being a network device among the plurality of network devices that establishes a network link with the first network device, and the first network device transmitting the first data packet to a user terminal at the first site.

[0051] In the present application, since a network link is established between a plurality of network devices at a first site, the tunnel table of the first network device includes not only a tunnel entry corresponding to a tunnel between the first network device and a network device at a second site, but also a tunnel entry corresponding to a tunnel between another network device at the first site and a network device at the second site. Thus, when the first network device receives a second data packet from a user terminal at the first site, and the selected target tunnel is a tunnel between a third network device and a network device at the second site, the first network device may transmit the second data packet to the third network device through the network link between the first network device and the third network device. Then, the third network device transmits the second data packet to the second site through the target tunnel. In this way, the interworking between the first network device and the third network device is implemented, and the communication between the first site and the second site can be implemented without creating excessive tunnels.

[0052] According to a third aspect, there is provided a packet transmission device having a function of implementing the behavior in the packet transmission method of the first aspect. The packet transmission device includes at least one module, and the at least one module is configured to implement the packet transmission method provided in the first aspect.

[0053] According to a fourth aspect, there is provided another packet transmission device, the packet transmission device having a function of implementing the behavior in the packet transmission method of the second aspect, the packet transmission device including at least one module, the at least one module being configured to implement the packet transmission method provided in the second aspect.

[0054] According to a fifth aspect, a network device is provided. The network device includes a processor and a memory. The memory is configured to store a program for executing the packet transmission method provided in the first or second aspect, and to store data used to implement the packet transmission method provided in the first or second aspect. The processor is configured to execute the program stored in the memory. The operating apparatus of the storage device may further include a communication bus, and the communication bus is configured to establish a connection between the processor and the memory.

[0055] According to a sixth aspect, there is provided a computer readable storage medium storing instructions which, when executed on a computer, enable the computer to perform a packet transmission method according to the first or second aspect.

[0056] According to a seventh aspect, there is provided a computer program product comprising instructions which, when executed on a computer, enable the computer to perform the packet transmission method according to the first or second aspect.

[0057] The technical effects achieved in the second, third, fourth, fifth, sixth and seventh aspects are similar to those achieved by the corresponding technical means in the first aspect, and will not be described in detail again herein.

[0058] The technical solutions provided in this application can bring at least the following advantageous effects:

[0059] In the present application, when receiving a first data packet from a second site, the first network device may search in a flow table for a target flow entry whose flow identifier is the flow identifier of the first data flow. The first data flow is the data flow to which the first data packet belongs. The target flow entry is created when the first site sends a second data flow to the second site. The source address of the second data flow is the destination address of the first data flow, and the destination address of the second data flow is the source address of the first data flow. Thus, the target flow entry is present in the flow table of the first network device only when the second data flow passes through the first network device. Only in this way can the first network device find the target flow entry and then send the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry. In the present application, it can be seen that it is possible to ensure that packets sent and packets received for the same application pass through the same network device. [Brief description of the drawings]

[0060] [Figure 1] FIG. 2 is a diagram of a system architecture in a packet transmission method according to an embodiment of the present application; [Diagram 2] FIG. 2 is a diagram of a system architecture in another packet transmission method according to an embodiment of the present application. [Diagram 3] FIG. 2 is a schematic diagram of the structure of a network device according to an embodiment of the present application; [Figure 4] 2 is a flow chart of a packet transmission method according to an embodiment of the present application; [Diagram 5] FIG. 2 is a schematic diagram of a tunnel index field according to an embodiment of the present application; [Figure 6] 4 is a flow chart of another packet transmission method according to an embodiment of the present application. [Figure 7]FIG. 2 is a schematic diagram of an arrangement of network devices at a first site according to an embodiment of the present application; [Figure 8] 4 is a flow chart of another packet transmission method according to an embodiment of the present application. [Figure 9] FIG. 2 is a schematic diagram of the structure of a packet sending device according to an embodiment of the present application; [Figure 10] FIG. 2 is a schematic diagram of the structure of another packet sending device according to an embodiment of the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0061] In order to make the objectives, technical solutions and advantages of the present application more apparent, the implementation of the present application is described in more detail below with reference to the accompanying drawings.

[0062] Figure 1 is a diagram of a system architecture in a packet transmission method according to an embodiment of the present application. As shown in Figure 1, the system includes a network device 101, a network device 102, a network device 103, and a control device 104. The network device 101 and the network device 102 are network devices located at a first site, and the network device 103 is a network device located at a second site. The network device 101, the network device 102, and the network device 103 may be connected to the control device 104 wirelessly or by wire to communicate with each other.

[0063] After being powered on, the network devices may register with the control device 104. Then, a tunnel may be established between two network devices belonging to different sites through the control device 104. In this specification, the network device 101 and the network device 103 are used as examples for illustration.

[0064] 1, a first interface of network device 101 accesses a Long Term Evolution (LTE) network, a first interface of network device 102 accesses a Multi-Protocol Label Switching (MPLS) network, a first interface of network device 103 accesses the LTE network, and a second interface of network device 103 accesses the MPLS network. It is assumed that before network device 101 is powered on, both network device 102 and network device 103 complete registration, i.e., tunnel 2 is established between the first interface of network device 102 and the second interface of network device 103.

[0065] After being powered on, the network device 101 may send a site prefix and a site identifier of the first site and Transport Network Port (TNP) information of the first interface of the network device 101 to the control device 104. The control device 104 then determines that the network device 101 can communicate with the network device 103 based on the stored network topology structure. Thus, the control device 104 may send the site prefix and the site identifier of the first site and the TNP information of the first interface of the network device 101 to the network device 103, and send the site prefix and the site identifier of the second site and the TNP information of the first interface of the network device 103 to the network device 101.

[0066] After receiving the site prefix and the site identifier of the second site, the network device 101 may add the site prefix and the site identifier of the second site as a routing entry in the stored routing table. Similarly, after receiving the site prefix and the site identifier of the first site, the network device 103 may add the site prefix and the site identifier of the first site as a routing entry in the stored routing table. Then, after the network device 101 receives the TNP information of the first interface of the network device 103 sent by the control device 104, and the network device 103 receives the TNP information of the first interface of the network device 101 sent by the control device 104, it is assumed that the TNP information of the two interfaces may match. In this case, the tunnel 1 may be established between the first interface of the network device 101 and the first interface of the network device 103. Then, a network link may be further established between the second interface of the network device 101 and the second interface of the network device 102. The network link may be a physical link or a network tunnel through which network device 101 may communicate with network device 102 .

[0067] Based on this, after establishing tunnel 1, network device 101 may store the tunnel identifier and tunnel attribute information of tunnel 1 in a tunnel table, and send the tunnel identifier and tunnel attribute information of tunnel 1 to network device 102 via a network link. Then, network device 101 may receive the tunnel identifier and tunnel attribute information of tunnel 2 sent by network device 102, and store the tunnel identifier and tunnel attribute information in a tunnel table. Similarly, the tunnel tables of network device 102 and network device 103 also store the tunnel identifier and tunnel attribute information of tunnel 1, and the tunnel identifier and attribute information of tunnel 2.

[0068] It should be noted that the TNP information may include parameter information used to establish a tunnel with another network device, such as the network address and encryption mode of an interface. Furthermore, for the same tunnel, the source port information and the peer port information in the tunnel attribute information stored in the devices at both ends of the tunnel are opposite. For example, for tunnel 1, the source port information in the tunnel attribute information stored in network device 101 and network device 102 is the destination port information in the tunnel attribute information stored in network device 103, and the destination port information in the tunnel attribute information stored in network device 101 and network device 102 is the source port information in the tunnel attribute information stored in network device 103. The source port information of the tunnel may include the source network address of the tunnel, and the destination port information of the tunnel may include the destination network address of the tunnel.

[0069] Then, when receiving a data packet transmitted from the user terminal at the first site to the user terminal at the second site, the network device 101 may select Tunnel 1 or Tunnel 2 as a target tunnel from the tunnel table, and transmit the data packet through the target tunnel. When the target tunnel is Tunnel 1, the network device 101 may transmit the data packet directly through Tunnel 1. When the target tunnel is Tunnel 2, the network device 101 may add a tunnel identifier of Tunnel 2 to the data packet, and then transmit the data packet with the tunnel identifier added to the network device 102, instructing the network device 102 to transmit the data packet through Tunnel 2.

[0070] Similarly, upon receiving a data packet transmitted from a user terminal at a first site to a user terminal at a second site, network device 102 may select tunnel 1 or tunnel 2 as a target tunnel from the tunnel table in a manner similar to that described above, and transmit the data packet through the target tunnel. Upon receiving a data packet transmitted from a user terminal at a second site to a user terminal at a first site, network device 103 may select tunnel 1 or tunnel 2 as a target tunnel from the tunnel table, and transmit the data packet through the target tunnel.

[0071] Optionally, in the system shown in FIG. 1, an example in which two network devices are disposed at a first site and one network device is disposed at a second site is used for explanation. Of course, in another possible case, one network device or three or more network devices may be alternatively disposed at the first site, or two or more network devices may be alternatively disposed at the second site. Furthermore, the quantity of network devices disposed at the first site may be the same as or different from the quantity of network devices disposed at the second site.

[0072] For example, as shown in Fig. 2, in the system architecture shown in Fig. 2, two network devices are disposed at a first site and a second site, respectively. Specifically, network device 101 and network device 102 are disposed at the first site, and network device 105 and network device 106 are disposed at the second site. Through the above-mentioned method, tunnel 1 may be established between network device 101 and network device 105, tunnel 2 may be established between network device 102 and network device 106, and a network link is established between network device 101 and network device 102.

[0073] 3 is a schematic diagram of the structure of a network device according to an embodiment of the present application. The network device may be the network device shown in FIG 1 or FIG 2. The network device includes at least one processor 301, a communication bus 302, a memory 303, and at least one communication interface 304.

[0074] The processor 301 may be a microprocessor (including a central processing unit (CPU)), a network processor (NP), ,Ma or one or more integrated circuits configured to implement the solutions of the present application, such as, for example, an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0075] The communication bus 302 is configured to transmit information between the aforementioned components. The communication bus 302 may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used to represent the bus in this diagram, but this does not mean that there is only one bus or only one type of bus.

[0076] The memory 303 may be, but is not limited to, a read-only memory (ROM), a random access memory (RAM), an electrically erasable programmable read-only memory (EEPROM), an optical disk (including a compact disc read-only memory (CD-ROM), a compact disk, a laser disk, a digital versatile disk, or a Blu-ray disk, etc.), a magnetic disk storage medium or another magnetic storage device, or any other medium that can be configured to carry or store the expected program code in the form of instructions or data structures that can be accessed from a network. The memory 303 may exist independently and be connected to the processor 301 via the communication bus 302. Alternatively, the memory 303 may be integrated with the processor 301.

[0077] The communication interface 304 is configured to communicate with another device or a communication network using any device such as a transceiver. The communication interface 304 includes a wired communication interface and may further include a wireless communication interface. The wired communication interface may be, for example, an Ethernet interface. The Ethernet interface may be an optical interface, an electrical interface, or a combination thereof. The wireless communication interface may be a Wireless Local Area Network (WLAN) interface, a cellular network communication interface, or a combination thereof.

[0078] In a particular implementation, in an embodiment, the processor 301 may include one or more CPUs, such as CPU0 and CPU1 shown in FIG.

[0079] In a particular implementation, in an embodiment, a network device may include multiple processors, such as, for example, processor 301 and processor 305 shown in Figure 3. Each of these processors may be a single-core processor or a multi-core processor. A processor herein may refer to one or more devices, circuits, and / or processing cores configured to process data (e.g., network program instructions).

[0080] In some embodiments, the memory 303 may be configured to store program code 310 for performing the solutions of the present application, and the processor 301 may execute the program code 310 stored in the memory 303. In particular, the network device may use the processor 301 and the program code 310 in the memory 303 to perform the packet transmission method provided in the following embodiments of FIG. 4, FIG. 6, or FIG. 8.

[0081] Figure 4 is a flow chart of a packet transmission method according to an embodiment of the present application. In this embodiment of the present application, a plurality of network devices are disposed at a first site, a network link is established between the plurality of network devices, a plurality of tunnels are established between the network devices disposed at the first site and the network devices disposed at a second site, and the second site is a site that performs data transmission with the first site. Please refer to Figure 4. The method includes the following steps.

[0082] Step 401: A first network device receives a second data packet from a user terminal at a first site, where the second data packet carries a destination address, and the second data packet belongs to a second data flow.

[0083] The first network device is any one of a plurality of network devices at the first site. The second data packet belongs to a second data flow, and the second data flow is a data flow transmitted from a user terminal at the first site to a user terminal at the second site, so that a destination address carried in the second data flow is a destination address of the user terminal at the second site.

[0084] It should be noted that when a user terminal at a first site sends a second data packet to a user terminal at a second site, since the two user terminals belong to different sites, the user terminal at the first site needs to send the second data packet to a network device at the first site, and then send the second data packet to a network device at the second site through the network device, and then the network device at the second site sends the second data packet to the user terminal at the second site.

[0085] In one example, a user terminal at a first site may select a network device from a plurality of network devices at the first site as a first network device based on a networking scheme of the first site, and then send a second data packet to the first network device, and send the second data packet to a network device at a second site through the first network device.

[0086] It should be noted that the user terminal may store the correspondence between the networking scheme and the device identifier. When the user terminal needs to transmit a data packet, the user terminal may determine a network device to transmit the data packet based on the networking scheme of the site where the user terminal is located and the correspondence between the networking scheme and the device identifier. For example, in the user terminal of the first site, the user terminal may obtain a corresponding device identifier from the stored correspondence between the networking scheme and the device identifier based on the networking scheme of the first site, and further determine the network device identified by the device identifier as the first network device.

[0087] Step 402: The first network device selects a tunnel as a target tunnel from a plurality of tunnels established between the first site and the second site based on a destination address carried in the second data packet.

[0088] In this embodiment of the present application, a first network device stores a routing table, the routing table includes a plurality of routing entries, each of the plurality of routing entries includes a site prefix and a corresponding site identifier, the site prefix refers to a network segment corresponding to the site, the site identifier refers to an identifier of the site, and is used to uniquely identify the site.

[0089] The following describes an implementation process in which a first network device determines a target tunnel using steps (1) to (3).

[0090] (1) The first network device determines a target routing entry from a routing table based on a destination address carried in the second data packet, where the destination address matches a site prefix included in the target routing entry.

[0091] Since the site prefix indicates a network segment corresponding to a site, the destination address carried in the second data packet may be matched against the site prefix contained in each routing entry in the routing table to determine a target routing entry from the routing table.

[0092] Based on the above description, it should be noted that the destination address carried in the second data packet is the address of the user terminal of the second site. Therefore, it can be determined that the site prefix included in the target routing entry is the site prefix of the second site, and the site identifier included in the target routing entry is the identifier of the second site.

[0093] (2) the first network device determines one or more tunnel entries based on a site identifier included in the target routing entry, where the one or more tunnel entries are tunnel entries corresponding to a tunnel established between the first site and a second site.

[0094] The first network device may store one tunnel table, and the tunnel table is used to store tunnel entries corresponding to multiple sites. Of course, the first network device may alternatively store multiple tunnel tables, and the multiple tunnel tables are in one-to-one correspondence with the multiple sites. The multiple sites refer to sites that establish a tunnel with the first site, and the multiple sites include the second site. The two cases differ in the way in which the first network device determines one or more tunnel entries. Therefore, the following provides an explanation of the two cases.

[0095] In a first case, the first network device stores one tunnel table. In this case, the first network device may determine one or more tunnel identifiers based on a site identifier included in the target routing entry, where the one or more tunnel identifiers are identifiers of tunnels established between the first site and the second site. The first network device may then determine one or more tunnel entries from the tunnel table based on the one or more tunnel identifiers.

[0096] It should be noted that regardless of how many tunnel tables are stored in the first network device, each tunnel table may include multiple tunnel entries, and each of the multiple tunnel entries may include a tunnel identifier and corresponding tunnel attribute information. The tunnel attribute information may include a tunnel encapsulation method, a source address and a destination address of the tunnel, whether the tunnel is available, a bandwidth of the tunnel, and a delay of the tunnel, etc. Furthermore, in some embodiments, the first network device may store a first mapping relationship between a site identifier and a tunnel identifier. Specifically, the first mapping relationship stores an identifier of each site that establishes a tunnel with the first site, and an identifier of a tunnel established between each site and the first site. In this manner, the first network device may determine one or more tunnel identifiers from the first mapping relationship based on the site identifier included in the target routing entry. The first network device may then determine a tunnel entry from the tunnel table whose included tunnel identifier is the same as the one or more tunnel identifiers to obtain one or more tunnel entries.

[0097] In a second case, the first network device stores a plurality of tunnel tables. In this case, the first network device may determine an identifier of the target tunnel table based on a site identifier included in the target routing entry. The target tunnel table is a tunnel table in the plurality of tunnel tables corresponding to the second site. The first network device may then determine a target tunnel table from the plurality of tunnel tables based on the identifier of the target tunnel table, and determine a tunnel entry stored in the target tunnel table as the one or more tunnel entries.

[0098] The first network device may store different tunnel tables for different sites, and the first network device may store a second mapping relationship between the site identifier and the tunnel table identifier. Specifically, the second mapping relationship stores an identifier of each site that establishes a tunnel with the first site and an identifier of a tunnel table corresponding to each site. In this manner, the first network device may determine an identifier of a target tunnel table from the second mapping relationship based on the site identifier included in the target routing entry. Then, a target tunnel table may be determined from the multiple tunnel tables based on the identifier of the target tunnel table, and a tunnel entry in the target tunnel table is further determined as one or more tunnel entries.

[0099] (3) The first network device selects a tunnel entry from the one or more tunnel entries as a target tunnel entry, and determines a tunnel corresponding to the target tunnel entry as the target tunnel.

[0100] The first network device may select a tunnel entry from one or more tunnel entries as a target tunnel entry according to a tunnel selection policy, and further determine a tunnel corresponding to the target tunnel entry as the target tunnel, i.e., use a tunnel identified by a tunnel identifier included in the target tunnel entry as the target tunnel.

[0101] For example, the tunnel selection policy stored by the first network device is to select a tunnel with a maximum bandwidth. In this manner, the first network device may obtain tunnel attribute information included in one or more tunnel entries and obtain the bandwidth of the tunnel from the tunnel attribute information. Then, the first network device may select a tunnel entry with a maximum bandwidth from the one or more tunnel entries based on the bandwidth of the tunnel.

[0102] Optionally, each tunnel entry further includes a connection identifier, which is used to indicate whether the corresponding tunnel is connected, i.e., whether the corresponding tunnel is available. Thus, before selecting a target tunnel entry according to the tunnel selection policy, the first network device may alternatively filter, from the one or more tunnel entries, tunnel entries whose connection identifiers are valid, and further select a target tunnel entry from the filtered tunnel entries according to the tunnel selection policy.

[0103] Step 403: When the target tunnel is a tunnel established between a third network device and a network device at a second site, the first network device adds a tunnel identifier of the target tunnel to the second data packet to obtain a third data packet, where the third network device is a network device other than the first network device among the multiple network devices at the first site.

[0104] It should be noted that since the tunnel table includes all tunnels established between the network device at the first site and the network device at the second site, the target tunnel determined by the first network device may be a tunnel established between the first network device and the network device at the second site, or a tunnel established between a third network device and the network device at the second site, where the third network device is a network device other than the first network device at the first site.

[0105] In some embodiments, when the target tunnel is a tunnel established between a third network device and a network device at a second site, the first network device may add a tunnel index field to the second data packet to obtain the third data packet.

[0106] For example, as shown in FIG. 5, the tunnel index field may include a tunnel identifier, which may be the tunnel identifier of the target tunnel. Optionally, the tunnel index field may further include an encapsulation scheme, a label, a version number, a protocol type, etc. The encapsulation scheme is a tunnel type corresponding to the tunnel identifier. The label is a flag bit, which may be used to indicate that the data packet is sent from the user side to the tunnel side or received from the tunnel side. The version number is the version number of the tunnel index field used. The protocol type is the protocol type of the second data packet.

[0107] Step 404: The first network device transmits the third data packet to the third network device through a network link between the first network device and the third network device.

[0108] Based on the above description, a network link is established between the first network device and the third network device, and the first network device communicates with the third network device through the network link. Thus, the first network device may add a tunnel identifier of the target tunnel to the second data packet to obtain a third data packet, and then send the third data packet to the third network device through the network link between the first network device and the third network device.

[0109] It should be noted that when the first network device is relatively close to the third network device, the network link may be a physical link. When the first network device is relatively far from the third network device or cannot be connected to the third network device through a physical link, the network link may be a network tunnel, which may include a Generic Routing Encapsulation (GRE) tunnel. Of course, as an alternative, the network tunnel may be another tunnel.

[0110] Furthermore, the network link between the two network devices at the first site is mainly used to synchronize tunnel entries within the site and transmit data packets within the site, and does not need to be advertised to networks outside the site. Therefore, the network addresses on the interfaces on the network devices at the first site used to establish the network link may all be set to private network addresses, and may use the same address space at different sites. This can reduce the consumption of the operator's network address resources by the SD-WAN network.

[0111] Step 405: The third network device receives the third data packet, separates the second data packet from the third data packet, and sends the second data packet through the target tunnel.

[0112] In some embodiments, the tunnel index field includes not only the tunnel identifier of the target tunnel, but also the encapsulation method, label, version number, protocol type, etc. of the tunnel index field, so that the second data packet may be separated from the third data packet based on information such as the encapsulation method, label, version number, protocol type, etc. Furthermore, a tunnel identifier of the target tunnel may also be further obtained.

[0113] Since the third network device also stores the target tunnel entry, the third network device may obtain tunnel attribute information of the target tunnel from the target tunnel entry based on the tunnel identifier of the target tunnel, further perform tunnel encapsulation on the second data packet based on the obtained tunnel attribute information to obtain a fourth data packet, and transmit the fourth data packet through the target tunnel.

[0114] The above steps 403 to 405 are for the case where the target tunnel is a tunnel between a third network device and a network device at a second site. When the target tunnel is a tunnel between a first network device and a network device at a second site, the first network device may directly send the second data packet through the target tunnel.

[0115] In this case, an implementation process of the first network device sending a second data packet through the target tunnel may include: the first network device may obtain tunnel attribute information of the target tunnel from the target tunnel entry, and further perform tunnel encapsulation on the second data packet according to the obtained tunnel attribute information to obtain a fourth data packet, and send the fourth data packet through the target tunnel.

[0116] It should be noted that after receiving the fourth data packet, the network device at the second site may perform tunnel decapsulation on the fourth data packet to obtain the second data packet.

[0117] Please note that the above steps 401 to 405 are the case where the user terminal of the first site transmits a data packet to the user terminal of the second site. It should be understood that, alternatively, the user terminal of the second site may transmit a data packet to the user terminal of the first site. Therefore, in the following, steps 406 and 407 are used to describe the case where the user terminal of the second site transmits a data packet to the user terminal of the first site.

[0118] Step 406: The first network device receives a first data packet from the second site, where the first data packet belongs to the first data flow.

[0119] The first data flow is a data flow sent by a user terminal at the second site to a user terminal at the first site, and thus the source address of the first data flow is the destination address of the second data flow, and the destination address of the first data flow is the source address of the second data flow.

[0120] It should be noted that the implementation process of the network device at the second site receiving a first data packet from the user terminal at the second site and sending the first data packet to the network device at the first site is similar to the scheme of steps 401 to 405, and details will not be described again in this specification.

[0121] Step 407: The first network device sends a first data packet to the user terminal at the first site.

[0122] In some embodiments, each network device at the first site may communicate with the user terminal at the first site. Thus, the first network device may directly transmit the first data packet to the user terminal at the first site after receiving the first data packet from the second site. In other words, the first network device transmits the first data packet to the user terminal at the first site in the manner of steps 406 and 407.

[0123] In some other embodiments, the multiple network devices at the first site may form a VRRP group according to the Virtual Router Redundancy Protocol (VRRP). The VRRP group includes a primary network device and one or more secondary network devices. The primary network device is configured to interact with a user terminal at the first site, and the secondary network device may take the place of the primary network device when the primary network device is out of order. In this case, when the first network device is the primary network device, the first network device may transmit the first data packet to the user terminal at the first site after receiving the first data packet. The first data packet may be a data packet received by the first network device through a network link between the first network device and a second network device, and the second network device is a network device among the multiple network devices at the first site that establishes a network link with the first network device. Of course, as an alternative, the first data packet may be a data packet received by the first network device through a tunnel established between the first network device and a network device at the second site.

[0124] It should be noted that after receiving the first data packet, the network device at the second site may select a tunnel from the tunnels between the second site and the first site, and send the first data packet to the first site through the selected tunnel. When the selected tunnel is a tunnel established between the network device at the second site and the first network device, the first network device may directly receive the first data packet through the tunnel. Since the first network device is a primary network device, the first network device may directly send the first data packet to the user terminal at the first site. When the selected tunnel is a tunnel established between the network device at the second site and the second network device, the second network device may receive the first data packet through the tunnel. Since the first network device is a primary network device, the second network device should further send the first data packet to the first network device through a network link. In other words, the first network device may receive the first data packet sent by the second network device through a network link. The first network device may then transmit the first data packet to the user terminal at the first site.

[0125] It should be noted that the first network device stores a local route, which stores routing information between the first network device and the user terminal at the first site. Thus, after receiving the first data packet, the first network device may send the first data packet to the user terminal at the first site based on the local route.

[0126] Moreover, the second network device and the third network device may be the same network device, although, alternatively, the second network device and the third network device may be different network devices.

[0127] In this embodiment of the present application, since a network link is established between a plurality of network devices at a first site, the tunnel table of the first network device includes not only a tunnel entry corresponding to a tunnel between the first network device and a network device at a second site, but also a tunnel entry corresponding to a tunnel between another network device at the first site and a network device at the second site. Thus, when the first network device receives a second data packet from a user terminal at the first site, and the selected target tunnel is a tunnel between a third network device and a network device at the second site, the first network device may transmit the second data packet to the third network device through the network link between the first network device and the third network device. Then, the third network device transmits the second data packet to the second site through the target tunnel. In this way, the interworking between the first network device and the third network device is implemented, and the communication between the first site and the second site can be implemented without creating excessive tunnels.

[0128] Figure 6 is a flow chart of a packet transmission method according to an embodiment of the present application. In this embodiment of the present application, a number of network devices are disposed at a first site, and a number of tunnels are established between these network devices disposed at the first site and a network device disposed at a second site, and the second site is a site that performs data transmission with the first site. Please refer to Figure 6. The method includes the following steps.

[0129] Step 601: A first network device receives a second data packet from a user terminal at a first site, where the second data packet carries a destination address, and the second data packet belongs to a second data flow.

[0130] In this embodiment of the present application, for the relevant description of step 601, please refer to the relevant description of step 401 in the above embodiment, and details will not be described again in this specification.

[0131] Step 602: The first network device selects a tunnel as a target tunnel from a plurality of tunnels established between the first site and the second site based on a destination address carried in the second data packet.

[0132] In this embodiment of the present application, for the relevant description of step 602, please refer to the relevant description of step 402 in the above embodiment, and details will not be described again in this specification.

[0133] Step 603: The first network device determines a flow identifier of the first data flow based on the flow identifier of the second data flow.

[0134] The first data flow is a data flow sent by a user terminal at the second site to a user terminal at the first site, and the second data flow is a data flow sent by a user terminal at the first site to a user terminal at the second site, so the source address of the first data flow is the destination address of the second data flow, and the destination address of the first data flow is the source address of the second data flow.

[0135] In some embodiments, the first network device may determine a flow identifier for the second data flow based on the second data packet, and further determine a flow identifier for the first data flow based on the flow identifier of the second data flow.

[0136] In one example, the first network device may obtain tuple information of the second data packet, where the tuple information includes at least source port information and destination port information. The obtained tuple information is used as a flow identifier of the second data flow. Then, the first network device replaces the source port information and the destination port information in the flow identifier of the second data flow to obtain a flow identifier of the first data flow.

[0137] It should be noted that in this example, the 5-tuple information of the second data packet may be determined as the flow identifier of the second data flow, the 3-tuple information of the second data packet may be determined as the flow identifier of the second data flow, or the 7-tuple information of the second data packet may be determined as the flow identifier of the second data flow. This is not limited to this embodiment of the present application. If the flow identifier of the second data flow at least includes source port information and destination port information, the second data flow can be uniquely identified.

[0138] For example, the flow identifier of the second data flow is 5-tuple information, where the source address is 192.168.0.1, the destination address is 192.168.1.1, the source port is port 1, the destination port is port 2, and the protocol number is protocol number 1. Then, the first network device swaps the source address and the destination address in the flow identifier of the second data flow, and swaps the source port and the destination port in the flow identifier of the second data flow to obtain new 5-tuple information, where the source address is 192.168.1.1, the destination address is 192.168.0.1, the source port is port 2, the destination port is port 1, and the protocol number is protocol number 1. This new 5-tuple information is used as the flow identifier of the first data flow.

[0139] In another example, the first network device may obtain tuple information of a second data packet and obtain a flow identifier of a second data flow from a stored correspondence between tuple information and flow identifiers based on the tuple information of the second data packet. A flow identifier of the first data flow is then obtained from the stored correspondence between identifiers of the first data flow and identifiers of the second data flow based on the flow identifier of the second data flow.

[0140] For example, the 5-tuple information of the second data packet is that the source address is 192.168.0.1, the destination address is 192.168.1.1, the source port is port 1, the destination port is port 2, and the protocol number is protocol number 1. Then, based on the 5-tuple information of the second data packet, the first network device may learn that the flow identifier of the second data flow is ID2 from the correspondence between the tuple information and the flow identifier shown in Table 1 below. Then, based on the flow identifier of the second data flow, the first network device obtains that the flow identifier of the first data flow is ID1 from the correspondence between the identifier of the first data flow and the identifier of the second data flow shown in Table 2 below.

[0141] [Table 1]

[0142] [Table 2]

[0143] Step 604: The first network device adds the target flow entry to a flow table stored in the first network device.

[0144] The flow table may include a plurality of flow entries, each of the plurality of flow entries including a flow identifier and a corresponding outbound interface identifier. Thus, the currently added target flow entry includes a flow identifier and a corresponding outbound interface identifier. Furthermore, the flow identifier in the currently added target flow entry is a flow identifier of a first data flow, and the outbound interface identifier in the currently added target flow entry is an identifier of a first interface, where the first interface is an interface in a first network device configured to receive second data packets from a user terminal at the first site.

[0145] It should be noted that when the same data flow enters the first network device, the data flow may enter the first network device through an interface for communicating with a user terminal at the first site, or through an interface for communicating with another network device at the first site. Thus, the outbound interface identifier in the target flow entry currently added by the first network device may be an interface in the first network device that communicates with a user terminal at the first site, or may be an interface in the first network device that communicates with another network device at the first site.

[0146] Step 605: If the target tunnel is a tunnel established between the first network device and a network device at a second site, the first network device sends a second data packet through the target tunnel.

[0147] In this case, the first network device may directly send the second data packet through the target tunnel. An implementation process of the first network device sending the second data packet through the target tunnel may include: the first network device may obtain tunnel attribute information of the target tunnel from the target tunnel entry, and further perform tunnel encapsulation on the second data packet according to the obtained tunnel attribute information to obtain a fourth data packet, and send the fourth data packet through the target tunnel.

[0148] Step 605 is for the case where the target tunnel is a tunnel established between the first network device and the network device of the second site. When the target tunnel is a tunnel between the fourth network device and the network device of the second site, the first network device may add a tunnel identifier of the target tunnel to the second data packet to obtain a third data packet. Here, the fourth network device is a network device other than the first network device among the multiple network devices of the first site. The first network device transmits the third data packet to the fourth network device. The fourth network device receives the third data packet and separates the second data packet from the third data packet. The fourth network device determines a flow identifier of the first data flow based on the flow identifier of the second data flow, adds a target flow entry to a flow table stored in the fourth network device, and transmits the second data packet through the target tunnel. The flow identifier included in the target flow entry currently added by the fourth network device is the flow identifier of the first data flow. The outbound interface identifier in the currently added target flow entry is an identifier of a second interface, the second interface being an interface in a fourth network device that is configured to receive the third data packet.

[0149] For the specific implementation of the first network device obtaining the third data packet and sending the third data packet to the fourth network device, and the fourth network device receiving the third data packet and separating the second data packet, please refer to the implementation of steps 403 to 405 in the above embodiment, and the details will not be described again in this specification.

[0150] In this embodiment of the present application, for the specific implementation of the fourth network device determining the flow identifier of the first data flow and adding a target flow entry to the stored flow table, please refer to the implementation of steps 603 and 604 above, and the details will not be described again in this specification.

[0151] It should be noted that because the fourth network device receives the third data packet through the network link between the fourth network device and the first network device, the outbound interface identifier in the target flow entry currently added by the fourth network device is the interface that communicates with the first network device, i.e., the second type interface.

[0152] Please note that the above steps 601 to 605 are the case where the user terminal of the first site transmits a data packet to the user terminal of the second site. It should be understood that, alternatively, the user terminal of the second site may transmit a data packet to the user terminal of the first site. Therefore, in the following, steps 606 to 608 are used to describe the case where the user terminal of the second site transmits a data packet to the user terminal of the first site.

[0153] Step 606: The first network device receives a first data packet from the second site, where the first data packet belongs to a first data flow.

[0154] In this embodiment of the present application, the first data packet is a data packet received by the first network device through a tunnel established between the first network device and a network device at a second site. Alternatively, the first data packet is a data packet received by the first network device and transmitted by a fifth network device, the fifth network device being a network device other than the first network device among the multiple network devices.

[0155] In order to ensure that the transmitted and received data packets for the same application pass through the same network device, after the network device at the first site receives the first data packet through the tunnel between the network device and the second site, the network device needs to search for a target flow entry whose flow identifier is the flow identifier of the first data flow. If the target flow entry does not exist in the network device, it may be indicated that the second data flow does not pass through the network device. In this case, the network device needs to transmit the first data packet to another network device at the first site to discover the network device through which the second data flow passes. Thus, alternatively, the first data packet may be a data packet received by the first network device and transmitted by the fifth network device.

[0156] It should be noted that the fifth network device and the fourth network device may be the same network device, or the fifth network device may be a different network device than the fourth network device.

[0157] Step 607: The first network device searches for a target flow entry in a flow table stored in the first network device, whose flow identifier is the flow identifier of the first data flow.

[0158] Based on the above description, the flow table includes a plurality of flow entries, each of the plurality of flow entries includes a flow identifier and a corresponding outbound interface identifier, and the first data flow is a data flow to which the first data packet belongs. Thus, the first network device may compare the flow identifier of the first data flow with the flow identifiers included in each flow entry in the flow table to search for a target flow entry whose flow identifier is the flow identifier of the first data flow.

[0159] Step 608: If the target flow entry is found, the first network device transmits the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry.

[0160] In some embodiments, when finding the target flow entry, the first network device may obtain an outbound interface identifier included in the target flow entry, and then send the first data packet based on an interface corresponding to the outbound interface identifier. The interface corresponding to the outbound interface identifier included in the target flow entry may be an interface for communicating with a user terminal at the first site, or may be an interface for communicating with another network device at the first site. Therefore, in the following, the method for sending the first data packet in the two cases will be described separately.

[0161] In a possible case, if the interface corresponding to the outbound interface identifier in the target flow entry is a first type interface, the first network device transmits the first data packet to the user terminal at the first site through the interface corresponding to the outbound interface identifier in the target flow entry, where the first type interface is an interface for communicating with the user terminal at the first site.

[0162] In another possible case, if the interface corresponding to the outbound interface identifier in the target flow entry is a second type interface, the first network device sends the first data packet to the third network device through the interface corresponding to the outbound interface identifier in the target flow entry to instruct the third network device to search for the target flow entry in a flow table stored in the third network device, where the second type interface is an interface for communicating with another network device among the plurality of network devices at the first site, and the third network device is a device among the plurality of network devices at the first site that communicates with the first network device through the interface corresponding to the outbound interface identifier in the target flow entry.

[0163] It should be noted that the third network device and the fifth network device may be different network devices, but the third network device and the fourth network device may be the same network device or the third network device may be a different network device from the fourth network device.

[0164] In some other embodiments, when the first network device does not find the target flow entry, the first network device searches for the target flow entry. attitudeThe method may further comprise: determining whether the network device that is not included in the first site still exists among the plurality of network devices at the first site; attitude If there is still a network device that does not match the target flow entry among the plurality of network devices at the first site, the first network device sends the first data packet to the second network device to instruct the second network device to search for the target flow entry in a flow table stored in the second network device. The second network device searches for the target flow entry among the plurality of network devices at the first site. attitude All the network devices at the first site search for the target flow entry. did If so, the first network device transmits the first data packet through the local route.

[0165] In one example, the network devices at the first site may be connected through network links two by two, i.e., the network devices may communicate with each other two by two. In this case, the first data packet may carry a device identifier of each network device through which the first data packet passes. In this manner, the target flow entry is searched for. attitude When determining whether there is still a network device in the first site that does not have a target flow entry, the first network device searches for a target flow entry among the plurality of network devices in the first site based on a device identifier of the network device carried in the first data packet. attitude You may decide not to use the network devices.

[0166] Optionally, in this case, a device identifier field may be added to the first data packet, and the device identifier field may include a device identifier of each network device through which the first data packet passes. In this way, searching for a target flow entry attitudeWhen determining whether there is still a network device at the first site that does not have a target flow entry, the first network device searches for a target flow entry among the plurality of network devices at the first site based on a device identifier included in a device identifier field in the first data packet. attitude You may decide not to use the network devices.

[0167] For example, as shown in Fig. 7, three network devices, network device 701, network device 702, and network device 703, are disposed at a first site. Furthermore, there is a network link between network device 701 and network device 702, there is a network link between network device 702 and network device 703, and there is a network link between network device 701 and network device 703. After network device 701 receives a first data packet, if the target flow entry is not found in the flow table, network device 701 obtains a device identifier field carried in the first data packet, and searches for a target flow entry based on the device identifier of the network device included in the device identifier field. attitudeIt is assumed that neither network device 702 nor network device 703 searches for a target flow entry. In this case, network device 701 may add a device identifier of network device 701 to a device identifier field carried in the first data packet, and transmit the first data packet to network device 702 or network device 703 through a network link. In this specification, transmission to network device 702 is used as an example. After network device 702 receives the first data packet, if the target flow entry is not found in the flow table, network device 702 obtains the device identifier field carried in the first data packet, and searches for a target flow entry based on the device identifier of the network device included in the device identifier field. attitude The network device 702 may determine that the network device in the first site that is not present is network device 703. Network device 702 may then add a device identifier of network device 702 to a device identifier field carried in the first data packet and transmit the first data packet further to network device 703.

[0168] It should be noted that each network device at the first site stores a local route, which stores routing information between the corresponding network device and the user terminal at the first site. Thus, after the first network device receives the first data packet and the multiple network devices at the first site all search for the target flow entry, the first network device may send the first data packet to the user terminal at the first site based on the local route.

[0169] Further, the second network device and the fifth network device may be different network devices, while the second network device, the third network device, and the fourth network device may be the same network device, or the second network device may be a different network device from the third network device and the fourth network device.

[0170] Optionally, when the data packet included in the first data flow is transmitted to the second site through a tunnel between the first network device and the network device of the second site, after the first network device adds a target flow entry to a flow table stored in the first network device, the first network device may transmit the target flow entry to another network device of the first site through a network link. After receiving the target flow entry, the other network device may modify an outbound interface of the target flow entry to a second type of interface, i.e., an interface through which each other network device communicates with the first network device, and store the modified target flow entry in the flow table. In this way, when receiving the first data packet, the other network device may find the target flow entry in the stored flow table, and transmit the first data packet to the first network device through an interface corresponding to the outbound interface identifier included in the target flow entry. The first network device may then transmit the first data packet to a user terminal of the first site based on the target flow entry. It can be seen that by synchronizing the target flow entry with another network device at the first site, the case where the first data packet continues to be traversed and queried between network devices when the target flow entry is not found can be significantly reduced, thereby improving the efficiency of transmission of the first data packet.

[0171] In this embodiment of the present application, when receiving a first data packet from a second site, the first network device may search in the flow table for a target flow entry whose flow identifier is the flow identifier of the first data flow. The first data flow is the data flow to which the first data packet belongs. The target flow entry is created when the first site sends a second data flow to the second site. The source address of the second data flow is the destination address of the first data flow, and the destination address of the second data flow is the source address of the first data flow. Thus, the target flow entry is present in the flow table of the first network device only when the second data flow passes through the first network device. Only in this way can the first network device find the target flow entry and then send the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry. It can be seen that in this embodiment of the present application, it is possible to ensure that packets sent and packets received for the same application pass through the same network device.

[0172] In the above embodiment, the packet transmission method provided in the embodiment of the present application is described using an example in which a plurality of network devices are disposed at a first site. In the following, the packet transmission method provided in the embodiment of the present application is described using an example in which a first network device and a second network device are disposed at a first site. Figure 8 is a flow diagram of the packet transmission method according to the embodiment of the present application. In this embodiment of the present application, the first network device and the second network device respectively establish a tunnel to a third network device, and the second site is a site that performs data transmission with the first site. The method includes the following steps:

[0173] Step 801: A first network device receives a second data packet from a user terminal at a first site, where the second data packet carries a destination address, and the second data packet belongs to a second data flow.

[0174] In this embodiment of the present application, for the relevant description of step 801, please refer to the relevant description of step 401 in the above embodiment, and details will not be described again in this specification.

[0175] Step 802: The first network device selects a tunnel as a target tunnel from a plurality of tunnels established between the first site and the second site based on a destination address carried in the second data packet.

[0176] In this embodiment of the present application, for the relevant description of step 802, please refer to the relevant description of step 402 in the above embodiment, and details will not be described again in this specification.

[0177] Step 803: The first network device determines a flow identifier of the first data flow based on the flow identifier of the second data flow.

[0178] In this embodiment of the present application, for the relevant description of step 803, please refer to the relevant description of step 603 in the above embodiment, and details will not be described again in this specification.

[0179] Step 804: The first network device adds the target flow entry to a flow table stored in the first network device.

[0180] In this embodiment of the present application, for the relevant description of step 804, please refer to the relevant description of step 604 in the above embodiment, and details will not be described again in this specification.

[0181] Step 805: If the target tunnel is a tunnel established between the first network device and a network device at a second site, the first network device sends a second data packet through the target tunnel.

[0182] In this embodiment of the present application, for the relevant description of step 805, please refer to the relevant description of step 605 in the above embodiment, and details will not be described again in this specification.

[0183] Step 805 is for the case where the target tunnel is a tunnel established between the first network device and the network device at the second site. When the target tunnel is a tunnel between the second network device and the network device at the second site, the first network device may add a tunnel identifier of the target tunnel to the second data packet to obtain a third data packet. The first network device sends the third data packet to the second network device to instruct the second network device to separate the second data packet. The second network device determines a flow identifier of the first data flow based on the flow identifier of the second data flow, adds a target flow entry to a flow table stored in the second network device, and sends the second data packet through the target tunnel. The flow identifier included in the currently added target flow entry is the flow identifier of the first data flow. The outbound interface identifier in the currently added target flow entry is an identifier of the second interface, and the second interface is an interface in the second network device configured to receive the third data packet.

[0184] For the specific implementation of the first network device acquiring the third data packet and sending the third data packet to the second network device, and the second network device receiving the third data packet and separating the second data packet, please refer to the implementation of steps 403 to 405 in the above embodiment, and the details will not be described again in this specification.

[0185] In this embodiment of the present application, for the specific implementation of the second network device determining the flow identifier of the first data flow and adding a target flow entry to the stored flow table, please refer to the implementation of steps 603 and 604 in the above embodiment, and the details will not be described again in this specification.

[0186] Please note that the above steps 801 to 805 are the case where the user terminal of the first site transmits a data packet to the user terminal of the second site. It should be understood that, alternatively, the user terminal of the second site may transmit a data packet to the user terminal of the first site. Therefore, in the following, steps 806 to 808 are used to describe the case where the user terminal of the second site transmits a data packet to the user terminal of the first site.

[0187] Step 806: The first network device receives a first data packet from the second site, where the first data packet belongs to the first data flow.

[0188] In this embodiment of the present application, for the relevant description of step 806, please refer to the relevant description of step 606 in the above embodiment, and details will not be described again in this specification.

[0189] Step 807: The first network device searches for a target flow entry in a flow table stored in the first network device, whose flow identifier is the flow identifier of the first data flow.

[0190] In this embodiment of the present application, for the relevant description of step 807, please refer to the relevant description of step 607 in the above embodiment, and details will not be described again in this specification.

[0191] Step 808: If the target flow entry is found, the first network device transmits the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry.

[0192] In some embodiments, when finding the target flow entry, the first network device may obtain an outbound interface identifier included in the target flow entry, and then send the first data packet based on an interface corresponding to the outbound interface identifier. The interface corresponding to the outbound interface identifier included in the target flow entry may be an interface for communicating with a user terminal of the first site, or may be an interface for communicating with a second network device. Therefore, in the following, the method for sending the first data packet in the two cases will be described separately.

[0193] In a possible case, if the interface corresponding to the outbound interface identifier in the target flow entry is a first type interface, the first network device transmits the first data packet to the user terminal at the first site through the interface corresponding to the outbound interface identifier in the target flow entry, where the first type interface is an interface for communicating with the user terminal at the first site.

[0194] In another possible case, if the interface corresponding to the outbound interface identifier in the target flow entry is a second type interface, the first network device sends the first data packet to the second network device through the interface corresponding to the outbound interface identifier in the target flow entry to instruct the second network device to search for the target flow entry in a flow table stored in the second network device, where the second type interface is an interface for communicating with the second network device.

[0195] In some other embodiments, if the first network device does not find the target flow entry and the first data packet is received through a tunnel established between the first network device and the network device at the second site, the first network device may send the first data packet to the second network device to instruct the second network device to search for the target flow entry in a flow table stored in the second network device. If the second network device finds the target flow entry from the stored flow table, the second network device may send the first data packet to the user terminal at the first site based on an interface corresponding to an outbound interface identifier included in the target flow entry. If the second network device does not find the target flow entry from the stored flow table, the second network device may send the first data packet to the user terminal at the first site based on an interface indicated by a configured local route.

[0196] If the first network device does not find the target flow entry and the first data packet is received through a network link between the first network device and the second network device, the first network device may transmit the first data packet to a user terminal at the first site based on an interface indicated by a configured local route.

[0197] It should be noted that the first network device and the second network device each store a local route, the local route stored in the first network device stores routing information between the first network device and the user terminal at the first site, and the local route stored in the second network device stores routing information between the second network device and the user terminal at the first site. Thus, when sending a first data packet to the user terminal at the first site, the first network device or the second network device may send the first data packet to the user terminal at the first site based on the local route stored in the first network device or the second network device.

[0198] In this embodiment of the present application, when receiving a first data packet from a second site, the first network device may search in the flow table for a target flow entry whose flow identifier is the flow identifier of the first data flow. The first data flow is the data flow to which the first data packet belongs. The target flow entry is created when the first site sends a second data flow to the second site. The source address of the second data flow is the destination address of the first data flow, and the destination address of the second data flow is the source address of the first data flow. Thus, the target flow entry is present in the flow table of the first network device only when the second data flow passes through the first network device. Only in this way can the first network device find the target flow entry and then send the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry. It can be seen that in this embodiment of the present application, it is possible to ensure that packets sent and packets received for the same application pass through the same network device.

[0199] FIG. 9 is a schematic diagram of the structure of a packet transmission device according to an embodiment of the present application. The packet transmission device may be implemented as a part or the whole of a first network device using software, hardware, or a combination thereof. A plurality of network devices are disposed at a first site. A plurality of tunnels are established between these network devices disposed at the first site and a network device disposed at a second site. The second site is a site that performs data transmission with the first site. The first network device is any one of the plurality of network devices at the first site. As shown in FIG. 9, the device includes a first receiving module 901, a searching module 902, and a first sending module 903.

[0200] The first receiving module 901 is configured to receive a first data packet from a second site.

[0201] The search module 902 is configured to search a flow table stored in the first network device for a target flow entry whose flow identifier is the flow identifier of the first data flow. The flow table includes a plurality of flow entries, each of the plurality of flow entries including a flow identifier and a corresponding outbound interface identifier. The first data flow is a data flow to which the first data packet belongs, and the target flow entry is created when the first site sends a second data flow to the second site. The source address of the second data flow is the destination address of the first data flow, and the destination address of the second data flow is the source address of the first data flow.

[0202] The first sending module 903 is configured to send the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry if the target entry is found.

[0203] Optionally, the apparatus further comprises: The target flow entry is not found and the target flow entry is searched. attitude a second sending module configured to send the first data packet to a second network device to instruct the second network device to search for a target flow entry in a flow table stored in the second network device when there is still a network device among the plurality of network devices that does not include the target flow entry, attitude a second transmitting module that is a network device that is not The target entry is not found, and all multiple network devices search for the target flow entry. dida third transmitting module configured to transmit the first data packet through a local route if Further includes:

[0204] Optionally, the first sending module 903 is mainly configured as follows: Send a first data packet to a user terminal at the first site through an interface corresponding to an outbound interface identifier in the target flow entry if the interface corresponding to the outbound interface identifier in the target flow entry is a first type interface, where the first type interface is an interface for communicating with the user terminal at the first site. or, if an interface corresponding to the outbound interface identifier in the target flow entry is a second type interface, send the first data packet to a third network device through the interface corresponding to the outbound interface identifier in the target flow entry, and instruct the third network device to search for the target flow entry in a flow table stored in the third network device, where the second type interface is an interface for communicating with another network device among the plurality of network devices, and the third network device is a device among the plurality of network devices that communicates with the first network device through the interface corresponding to the outbound interface identifier in the target flow entry.

[0205] Optionally, the apparatus further comprises: a second receiving module configured to receive a second data packet from a user terminal at the first site, where the second data packet carries a destination address and where the second data packet belongs to a second data flow; a selection module configured to select a tunnel as a target tunnel from the plurality of tunnels based on a destination address; a determination module configured to determine a flow identifier of the first data flow based on a flow identifier of the second data flow; a first adding module configured to add a target flow entry to a flow table stored in a first network device, wherein a flow identifier in the currently added target flow entry is a flow identifier of a first data flow, and an outbound interface identifier in the currently added target flow entry is an identifier of a first interface, the first interface being an interface in the first network device configured to receive second data packets from a user terminal at the first site; and a fourth sending module configured to send a second data packet through the target tunnel when the target tunnel is a tunnel established between the first network device and a network device at a second site; Further includes:

[0206] Optionally, the first network device stores a routing table, the routing table including a plurality of routing entries, each of the plurality of routing entries including a site prefix and a corresponding site identifier.

[0207] The selection module is mainly configured as follows. determining a target routing entry from the routing table based on a destination address carried in the second data packet, where the destination address carried in the second data packet matches a site prefix included in the target routing entry; Determine one or more tunnel entries based on a site identifier included in the target routing entry, where the one or more tunnel entries are tunnel entries corresponding to a tunnel established between the first site and the second site. From the one or more tunnel entries, a tunnel entry is selected as a target tunnel entry, and a tunnel corresponding to the target tunnel entry is used as the target tunnel.

[0208] Optionally, the flow identifier of the second data flow includes source port information and destination port information.

[0209] The decision module mainly consists of: Swap the source and destination port information in the flow identifier of the second data flow By , get the flow identifier of the first data flow It is configured as follows.

[0210] Optionally, the apparatus further comprises: a second additional module configured to add a tunnel identifier of the target tunnel to the second data packet to obtain a third data packet when the target tunnel is a tunnel established between a fourth network device and a network device at a second site, where the fourth network device is a network device other than the first network device among the plurality of network devices; a fifth transmitting module configured to transmit the third data packet to a fourth network device to separate the second data packet, determine a flow identifier of the first data flow based on the flow identifier of the second data flow, add a target flow entry to a flow table stored in the fourth network device, and instruct the fourth network device to transmit the second data packet through the target tunnel, wherein a flow identifier included in the currently-added target flow entry is a flow identifier of the first data flow, an outbound interface identifier in the currently-added target flow entry is an identifier of a second interface, and the second interface is an interface in the fourth network device configured to receive the third data packet; Further includes:

[0211] Optionally, the first data packet is a data packet received by the first network device through a tunnel established between the first network device and the network device at the second site. Alternatively, the first data packet is a data packet received by the first network device and transmitted by a fifth network device, the fifth network device being a network device other than the first network device among the above plurality of network devices.

[0212] Optionally, a network link is established between the plurality of network devices, and the plurality of network devices communicate through the network link, the network link being a physical link or a network tunnel, the network tunnel including a GRE tunnel.

[0213] In this embodiment of the present application, when receiving a first packet from a second site, the first network device may search in the flow table for a target flow entry whose flow identifier is the flow identifier of the first data flow. The first data flow is the data flow to which the first data packet belongs. The target flow entry is created when the first site sends a second data flow to the second site. The source address of the second data flow is the destination address of the first data flow, and the destination address of the second data flow is the source address of the first data flow. Thus, the target flow entry is present in the flow table of the first network device only when the second data flow passes through the first network device. Only in this way can the first network device find the target flow entry and then send the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry. It can be seen that in this embodiment of the present application, it is possible to ensure that packets sent and packets received for the same application pass through the same network device.

[0214] FIG. 10 is a schematic diagram of the structure of another packet sending device according to an embodiment of the present application. The packet sending device may be implemented as a part or the whole of a first network device using software, hardware, or a combination thereof. A plurality of network devices are disposed at a first site, and a network link is established between the plurality of network devices. A plurality of tunnels are established between the network devices disposed at the first site and a network device disposed at a second site. The second site is a site that performs data transmission with the first site. The first network device is any one of the above plurality of network devices. As shown in FIG. 10, the device includes a receiving module 1001 and a sending module 1002.

[0215] The receiving module 1001 is configured to receive a first data packet from a second site, the first data packet being a data packet received by the first network device through a network link between the first network device and a second network device, the second network device being a network device among the plurality of network devices that establishes a network link with the first network device.

[0216] The transmitting module 1002 is configured to transmit a first data packet to a user terminal at a first site.

[0217] In this embodiment of the present application, since a network link is established between a plurality of network devices at a first site, the tunnel table of the first network device includes not only a tunnel entry corresponding to a tunnel between the first network device and a network device at a second site, but also a tunnel entry corresponding to a tunnel between another network device at the first site and a network device at the second site. Thus, when the first network device receives a second data packet from a user terminal at the first site, and the selected target tunnel is a tunnel between a third network device and a network device at the second site, the first network device may transmit the second data packet to the third network device through the network link between the first network device and the third network device. Then, the third network device transmits the second data packet to the second site through the target tunnel. In this way, the interworking between the first network device and the third network device is implemented, and the communication between the first site and the second site can be implemented without creating excessive tunnels.

[0218] It should be noted that when the packet transmitting device provided in the above embodiment transmits a packet, the above functional module division is merely used as an example for explanation. In practical application, the above functions may be allocated and implemented in different functional modules according to requirements. In other words, the internal structure of the device may be divided into different functional modules to implement all or part of the above functions. Furthermore, the packet transmitting device and the packet transmitting method provided in the above embodiment belong to the same concept. For specific implementation processes, please refer to the method embodiments. This specification will not repeat the details.

[0219] All or part of the above embodiments may be implemented using software, hardware, firmware, or a combination thereof. When software is used to implement the embodiments, all or part of the embodiments may also be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded into a computer and executed, all or part of the procedures or functions according to the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or another programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired manner (e.g., coaxial cable, optical fiber, or Digital Subscriber Line (DSL)) or wireless manner (e.g., infrared, radio, or microwave). The computer-readable storage medium may be any available medium accessible by a computer, or a data storage device, such as a server or a data center, that integrates one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a Digital Versatile Disc (DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)). It should be noted that the computer-readable storage medium referred to in this application may be a non-volatile storage medium. In other words, the computer-readable storage medium may be a non-transitory storage medium.

[0220] In this application, terms such as "first" and "second" are used to distinguish between the same item or similar items having essentially the same function. It should be understood that there is no logical or chronological order dependency between "first", "second" and "nth", and the quantity and execution order are not limited. In addition, in the following description, terms such as first and second are used to describe various elements, but it should be understood that these elements are not limited by these terms. These terms are merely used to distinguish one element from another element. For example, a first image may be referred to as a second image, and similarly, a second image may be referred to as a first image, without departing from the scope of various examples. Both the first image and the second image may be images, and in some cases, they may be separate and different images.

[0221] The term "at least one" in this application means one or more, and the term "plurality" in this application means two or more. For example, "plurality of second packets" means two or more second packets. The terms "system" and "network" are sometimes used interchangeably herein.

[0222] It should be understood that the terms used in the description of the various examples herein are merely for illustrative purposes and are not intended to be limiting. The singular forms "a" and "an" and "the" used in the description of the various examples and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise.

[0223] Furthermore, it should be understood that the term "and / or" as used herein indicates and includes any or all possible combinations of one or more of the associated listed items. The term "and / or" in this specification describes an association to describe associated objects and indicates that a three-way relationship may exist. For example, A and / or B may indicate that only A is present, both A and B are present, and only B is present. Furthermore, the character " / " in this application generally indicates an "or" relationship between associated objects.

[0224] In addition, it should be understood that the sequence numbers of the above processes do not mean the execution order in various embodiments of the present application. The execution order of the processes is determined based on the functions and internal logic of the processes, and should not be construed as any limitation on the implementation process of the embodiments of the present application.

[0225] It should be understood that determining B based on A does not mean that B is determined solely based on A. Alternatively, B may be determined based on A and / or other information.

[0226] Furthermore, it is to be understood that the terms "include" ("includes," "including," "comprises," and / or "comprising") as used herein specify the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or components thereof.

[0227] Further, it should be understood that the term "when" may be interpreted as meaning "when" ("when" or "when"), "in response to determining," or "in response to detecting." Similarly, depending on the context, the phrase "when it is determined that" or "when (a described condition or event) is detected" may also be interpreted as meaning "when it is determined that," "in response to determining that," "when (a described condition or event) is detected," or "in response to detecting (a described condition or event)."

[0228] It should be understood that references throughout this specification to "one embodiment," "an embodiment," or "a possible implementation" mean that the particular features, structures, or characteristics associated with that embodiment or implementation are included in at least one embodiment of the application. Thus, the appearances of "in one embodiment," "in an embodiment," or "in a possible implementation" throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0229] The above description is merely an embodiment of the present application, and is not intended to limit the present application. Nohara Any modification, equivalent replacement, or improvement made without departing from the principles shall fall within the protection scope of this application.

Claims

1. A packet transmission method, comprising: a plurality of network devices disposed at a first site; a plurality of tunnels established between the network devices disposed at the first site and a network device disposed at a second site; the second site performing data transmission with the first site; and receiving, by a first network device, a second data packet from a user terminal at the first site, the second data packet carrying a destination address, the second data packet belonging to a second data flow; selecting, by the first network device, a tunnel from the plurality of tunnels as a target tunnel based on the destination address; determining, by the first network device, a flow identifier for a first data flow based on a flow identifier for the second data flow; adding, by the first network device, a target flow entry to a flow table stored in the first network device, wherein the flow identifier in the currently added target flow entry is the flow identifier of the first data flow, and an outbound interface identifier in the currently added target flow entry is an identifier of a first interface, the first interface being an interface in the first network device configured to receive the second data packet from the user terminal at the first site; If the target tunnel is a tunnel established between the first network device and the network device at the second site, transmitting the second data packet through the target tunnel by the first network device; receiving, by the first network device, a first data packet from the second site, the first network device being any one of the plurality of network devices; searching, by the first network device, in the flow table stored in the first network device for the target flow entry, whose flow identifier is the flow identifier of the first data flow, wherein the flow table includes a plurality of flow entries, each of the plurality of flow entries including a flow identifier and a corresponding outbound interface identifier, the first data flow is a data flow to which the first data packet belongs, the target flow entry was created when the first site sends the second data flow to the second site, the source address of the second data flow is the destination address of the first data flow, and the destination address of the second data flow is the source address of the first data flow; if the target flow entry is found, transmitting, by the first network device, the first data packet through an interface corresponding to the outbound interface identifier in the target flow entry; A method comprising:

2. After the step of searching, by the first network device, in a flow table stored in the first network device for a target flow entry whose flow identifier is the flow identifier of a first data flow, the method further comprises: If the target flow entry is not found and there are still network devices among the plurality of network devices that have not searched for the target flow entry, sending the first data packet to a second network device to instruct the second network device to search for the target flow entry in a flow table stored in the second network device, wherein the second network device is one of the plurality of network devices that has not searched for the target flow entry; If the target flow entry is not found and all of the plurality of network devices have searched for the target flow entry, transmitting the first data packet through a local route by the first network device; The method of claim 1 further comprising:

3. The step of transmitting, by the first network device, the first data packet through an interface corresponding to an outbound interface identifier in the target flow entry, comprises: If the interface corresponding to the outbound interface identifier in the target flow entry is a first type interface, transmitting, by the first network device, the first data packet to a user terminal at the first site through the interface corresponding to the outbound interface identifier in the target flow entry, wherein the first type interface is an interface for communicating with the user terminal at the first site; or if the interface corresponding to the outbound interface identifier in the target flow entry is a second type interface, transmitting, by the first network device, the first data packet to a third network device through the interface corresponding to the outbound interface identifier in the target flow entry, and instructing the third network device to search for the target flow entry in a flow table stored in the third network device, wherein the second type interface is an interface for communicating with another network device of the plurality of network devices, and the third network device is a device of the plurality of network devices that communicates with the first network device through the interface corresponding to the outbound interface identifier in the target flow entry. The method of claim 1 , comprising:

4. the first network device stores a routing table, the routing table including a plurality of routing entries, each of the plurality of routing entries including a site prefix and a corresponding site identifier; The step of selecting, by the first network device, a tunnel from the plurality of tunnels as a target tunnel based on the destination address includes: determining, by the first network device, a target routing entry from the routing table based on the destination address, wherein the destination address matches a site prefix included in the target routing entry; determining, by the first network device, one or more tunnel entries based on a site identifier included in the target routing entry, the one or more tunnel entries being tunnel entries corresponding to the tunnel established between the first site and the second site; selecting, by the first network device, a tunnel entry from the one or more tunnel entries as a target tunnel entry, and using a tunnel corresponding to the target tunnel entry as the target tunnel; The method of claim 1 , comprising:

5. the flow identifier of the second data flow includes source port information and destination port information; determining, by the first network device, the flow identifier of the first data flow based on the flow identifier of the second data flow, 2. The method of claim 1, comprising: obtaining, by the first network device, the flow identifier of the first data flow by swapping the source port information and the destination port information in a flow identifier of the second data flow.

6. After the step of adding, by the first network device, the target flow entry to the flow table stored in the first network device, the method further comprises: If the target tunnel is a tunnel established between a fourth network device and the network device at the second site, adding a tunnel identifier of the target tunnel to the second data packet by the first network device to obtain a third data packet, wherein the fourth network device is a network device other than the first network device among the plurality of network devices; transmitting, by the first network device, the third data packet to the fourth network device, instructing the fourth network device to separate the second data packet, determine the flow identifier of the first data flow based on the flow identifier of the second data flow, add the target flow entry to a flow table stored in the fourth network device, and send the second data packet through the target tunnel, wherein the flow identifier included in the currently added target flow entry is the flow identifier of the first data flow, and the outbound interface identifier in the currently added target flow entry is an identifier of a second interface, the second interface being an interface in the fourth network device configured to receive the third data packet; The method of claim 1 further comprising:

7. 7. The method of claim 1, wherein the first data packet is a data packet received by the first network device through the tunnel established between the first network device and the network device at the second site, or the first data packet is a data packet received by the first network device and transmitted by a fifth network device, the fifth network device being a network device other than the first network device among the plurality of network devices.

8. 8. The method of claim 1, wherein a network link is established between the plurality of network devices, and the plurality of network devices communicate through the network link, the network link being a physical link or a network tunnel, and the network tunnel comprising a Generic Routing Encapsulation (GRE) tunnel.

9. 9. A packet transmission apparatus for use in a first network device, wherein a plurality of network devices are arranged at a first site, a plurality of tunnels are established between the network devices arranged at the first site and network devices arranged at a second site, the second site is a site that performs data transmission with the first site, the first network device is any one of the plurality of network devices, and the first network device is configured to implement the method of any one of claims 1 to 8.

10. A computer readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the method of any one of claims 1 to 8.

11. 9. A packet transmission system comprising a plurality of network devices disposed at a first site, wherein network links are established between the plurality of network devices, and wherein a plurality of tunnels are established between the network devices disposed at the first site and network devices disposed at a second site, the second site being a site that performs data transmission with the first site, and wherein a first network device of the plurality of network devices is configured to implement the method of any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and system for remote outbound control

    JP2008512971A

  • Network relay device, network relay system, and network relay method

    JP2012054731A

  • Bi-directional flow stickiness in a network environment

    US20160006654A1

  • Asymmetric routing minimization

    US20190140940A1

  • Switch system, and data forwarding method

    WO2012049925A1