CN112995053A - Method and device for sending message - Google Patents

Method and device for sending message Download PDF

Info

Publication number
CN112995053A
CN112995053A CN201911298548.8A CN201911298548A CN112995053A CN 112995053 A CN112995053 A CN 112995053A CN 201911298548 A CN201911298548 A CN 201911298548A CN 112995053 A CN112995053 A CN 112995053A
Authority
CN
China
Prior art keywords
random number
packet
message
tunnel
free field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911298548.8A
Other languages
Chinese (zh)
Inventor
王卫波
周宇
樊宏伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201911298548.8A priority Critical patent/CN112995053A/en
Publication of CN112995053A publication Critical patent/CN112995053A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/31Flow control; Congestion control by tagging of packets, e.g. using discard eligibility [DE] bits

Abstract

The application discloses a method and a device for sending a message, and belongs to the field of communication. The method comprises the following steps: a first network device receives a first message, wherein the first message comprises a device identifier of a target device; the first network equipment determines a plurality of tunnels between the first network equipment and second network equipment on a forwarding path of the first message according to the equipment identification of the target equipment, wherein the second network equipment is positioned between the first network equipment and the target equipment and is connected with the target equipment; the method comprises the steps that a first network device obtains a random number and selects one tunnel from a plurality of tunnels according to the random number and a device identifier; the first network device sends a second message through the selected one of the tunnels, wherein the second message comprises the first message or a part of the first message. The method and the device can realize load sharing among the plurality of tunnels.

Description

Method and device for sending message
Technical Field
The present application relates to the field of communications, and in particular, to a method and an apparatus for sending a packet.
Background
In the communication field, data traffic can be transmitted between network devices through tunnels, when a plurality of tunnels exist between two network devices, the data traffic can perform load sharing among the plurality of tunnels, and how to perform load sharing among the plurality of tunnels is a problem which needs to be solved urgently at present.
Disclosure of Invention
The application provides a method and a device for sending messages, which are used for realizing load sharing among a plurality of tunnels. The technical scheme is as follows:
in a first aspect, the present application provides a method for sending a packet, where: the first network equipment receives a first message, wherein the first message comprises the equipment identification of the destination equipment. The first network device determines a plurality of tunnels between the first network device and a second network device on a forwarding path of the first packet according to the device identifier of the destination device, wherein the second network device is located between the first network device and the destination device and connected with the destination device. The first network device obtains a random number and selects one tunnel from the plurality of tunnels according to the random number and the device identification. The first network device sends a second message through the selected one of the tunnels, wherein the second message comprises the first message or a part of the first message. The first network device selects one tunnel from the multiple tunnels according to the acquired random number and the device identifier of the destination device of the message, thereby realizing load sharing among the multiple tunnels and improving the effect of load sharing.
In a possible implementation manner, the first packet includes an identification bit, where the identification bit is used to indicate whether the first packet includes a tunnel endpoint identifier TEID, and the first network device obtains the random number when the identification bit indicates that the first packet does not include the TEID. Therefore, under the condition that the first message does not include the TEID, the random number can be obtained, the random number and the device identification of the target device are used, load sharing among the plurality of tunnels can be realized, and the effect of load sharing is ensured.
In another possible implementation manner, the first packet includes a random number, the random number is generated by the first device, the first device is a source device corresponding to the first packet or an access device connected to the source device, and the first network device extracts the random number from the first packet. The random number can be included in the first message, so that the random number can be directly extracted from the first message, the efficiency of acquiring the random number can be improved, and the efficiency of sending the message is further improved.
In another possible implementation manner, the first packet includes a first idle field, the first idle field is adjacent to the identification bit, the first idle field is located after the identification bit, and the first idle field includes the random number.
In another possible implementation manner, the first packet includes a first idle field and a second idle field, the first idle field is adjacent to the identification bit, the first idle field is located after the identification bit, the second idle field is located after the first idle field, and the first idle field includes indication information, where the indication information is used to indicate whether the second idle field includes a random number. And the first network equipment extracts the random number from the second idle field of the first message under the condition that the indication information is used for indicating that the second idle field comprises the random number. The position of the random number is indicated through the indication information, so that the network equipment can conveniently extract the random number from the first message, and the efficiency of extracting the random number is improved.
In another possible implementation manner, the first network device generates a random number according to the first packet. Since the first network device may generate the random number, the first message may not include the random number, and the occupation of network resources may also be reduced.
In another possible implementation manner, the first network device adds a random number to the first packet to obtain a second packet. The first network device may add the random number to the first packet, and when the first packet including the random number reaches the forwarding device on the packet forwarding path, the forwarding device may perform load sharing by using the random number in the first packet, and select a desired tunnel through the random number.
In another possible implementation manner, the first network device performs a hash operation according to the random number and the device identifier to obtain a hash value. The specific calculation mode of the first network device for load sharing may be hash operation, that is, the first network device selects one tunnel from the multiple tunnels through a load sharing algorithm according to the hash value. Thus, load sharing is carried out according to the random number and the equipment identification.
In a second aspect, the present application provides an apparatus for sending a packet, configured to execute the method in the first aspect or any one of the possible implementation manners of the first aspect. In particular, the apparatus comprises means for performing the method of the first aspect or any one of its possible implementations.
In a third aspect, the present application provides an apparatus for sending a packet, where the apparatus includes: a processor, a memory, and a transceiver. The processor, the memory and the transceiver can be connected through a bus system. The memory is configured to store one or more programs, and the processor is configured to execute the one or more programs in the memory, so that the migration apparatus performs the method of the first aspect or any possible implementation manner of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having program code stored therein, which when run on a computer, causes the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
In a fifth aspect, the present application provides a computer program product comprising program code which, when run on a computer, causes the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
Drawings
Fig. 1 is a schematic diagram of a network architecture provided in an embodiment of the present application;
fig. 2 is a schematic diagram of another network architecture provided in the embodiments of the present application;
fig. 3 is a flowchart of a method for sending a message according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a message according to an embodiment of the present application;
fig. 5 is a flowchart of another method for sending a message according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an apparatus for sending a packet according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of another apparatus for sending a message according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
A forwarding path for transmitting a packet may be established in the communication network between the source device and the destination device, where the forwarding path passes through a plurality of network devices in the communication network, and some two network devices may exist in the plurality of network devices, and are referred to as a first network device and a second network device for convenience of description. Multiple tunnels exist between the first network device and the second network device. Thus, the network connection between the source device and the destination device includes a path from the source device to the first network device, a plurality of tunnels from the first network device to the second network device, and a path from the second network device to the destination device.
The multiple tunnels from the first network device to the second network device may be general packet radio service tunnel protocol (GTP) tunnels. The source device may send a packet to the destination device, where the packet may include a Tunnel Endpoint Identifier (TEID) and a device identifier of the destination device. After the message is sent by the source device, the first network device receives the message, and determines a plurality of tunnels from the first network device to the second network device according to the device identifier of the destination device included in the message; and carrying out hash operation on the TEID and the equipment identification of the target equipment to obtain a hash value. And selecting one tunnel from the tunnels according to the hash value through a load sharing algorithm, sending the message to the second network equipment through the selected tunnel, receiving the message by the second network equipment, and sending the message to the target equipment.
Optionally, the first network device and the second network device may be access devices of a communication network. The access devices are typically located at the edge of the communication network and may be edge routers (PEs) or the like. For example, referring to fig. 1, the first network device and the second network device may be a first access device and a second access device, respectively, in the communication network shown in fig. 1. The forwarding path between the source device and the destination device includes a first path between the source device and the first access device, a first tunnel and a second tunnel between the first access device and the second access device, and a second path between the second access device and the destination device.
Thus, the source device may send a message including the TEID and the device identifier of the destination device to the first access device through the first path. When receiving the message, the first access device determines a first tunnel and a second tunnel between the first access device and the second access device according to the device identifier of the destination device, performs hash operation on the TEID and the device identifier to obtain a hash value, selects one tunnel from the first tunnel and the second tunnel through a load sharing algorithm, sends the message to the second access device through the selected tunnel, receives the message by the second access device, and sends the message to the destination device through the second path.
For any tunnel between the first access device and the second access device, the tunnel passes through at least one forwarding device, and some two forwarding devices may exist in the at least one forwarding device, and are referred to as the first forwarding device and the second forwarding device for convenience of description. Multiple tunnels exist between the first forwarding device and the second forwarding device. Thus, any of the tunnels includes a tunnel from the first access device to the first forwarding device, multiple tunnels from the first forwarding device to the second forwarding device, and a tunnel from the second forwarding device to the second access device.
For example, referring to fig. 2, the forwarding devices traversed by the first tunnel include a first forwarding device and a second forwarding device. A third tunnel and a fourth tunnel exist between the first forwarding device and the second forwarding device, that is, the first tunnel includes a tunnel from the first access device to the first forwarding device, a third tunnel and a fourth tunnel from the first forwarding device to the second forwarding device, and a tunnel from the second forwarding device to the second access device.
Optionally, the first network device and the second network device may also be the first forwarding device and the second forwarding device, respectively, that is, after the first access device selects the first tunnel from the first tunnel and the second tunnel through a load sharing algorithm, and sends a message on the first tunnel, the first forwarding device receives the message, and determines a third tunnel and a fourth tunnel between the first forwarding device and the second forwarding device according to a device identifier of a destination device included in the message; and carrying out hash operation on the TEID and the equipment identification of the target equipment to obtain a hash value. And selecting one tunnel from the third tunnel and the fourth tunnel through a load sharing algorithm according to the hash value, sending the message to the second forwarding equipment through the selected tunnel, receiving the message by the second forwarding equipment, and sending the message to the target equipment.
Alternatively, the device identification of the destination device may be an address of the destination device. For example, it may be an Internet Protocol (IP) address or a Media Access Control (MAC) address of the destination device. The forwarding device may be a router or a switch, the source device may be a Serving GPRS Support Node (SGSN), and the destination device may be a serving gateway (S-GW); or, the source device is an S-GW, and the destination device is a Mobility Management Entity (MME), and the like. The GPRS chinese is a general packet radio service and is generally called generic packet radio service in english.
Among them, it should be noted that: the first network device (the first access device or the first forwarding device) needs the TEID in the message when selecting the tunnel. However, sometimes the message sent by the source device may not include the TEID, in this case, the first network device only performs the hash operation on the device identifier of the destination device in the message to obtain a hash value, and selects one tunnel from the multiple tunnels by using the hash value. The granularity of hash operation on the device identifier of the destination device is relatively coarse, and the effect of load sharing among the multiple tunnels is relatively poor.
In order to solve the problem, an embodiment of the present application provides a method for sending a packet, where, when a packet sent by a source device does not include a TEID, with the method, a first network device may perform load sharing in multiple tunnels between the first network device and a second network device, and improve an effect of load sharing among the multiple tunnels. The detailed implementation process can be seen in the embodiments shown in the subsequent fig. 3 or fig. 5.
Referring to fig. 3, an embodiment of the present application provides a method for sending a packet, where the method may be applied to a network architecture shown in fig. 1 or fig. 2, in the method, a first access device receives a packet sent by a source device, selects one tunnel from multiple tunnels between the first access device and a second access device, and sends the packet to the second access device through the selected tunnel. The method comprises the following steps:
step 301: the source device sends a first message, wherein the first message comprises a device identifier of the destination device.
The first message may include a random number or the first message may not include a random number.
Optionally, when the first packet includes the random number, the source device further generates the random number before sending the first packet.
Optionally, the first message further includes an identification bit, where the identification bit is used to identify whether the first message includes a TEID.
Optionally, the source device generates a random number when the identification bit included in the first packet is used to identify that the first packet does not include the TEID, where the first packet includes the random number generated by the source device. Or, in the case that the identification bit included in the first packet is used to identify that the first packet includes the TEID, the source device may also generate a random number, and the first packet may also include the random number generated by the source device.
Optionally, the source device generates a random number according to the first packet. For example, the source device may read a part of the content from the first packet, use the part of the content as a random number, or transform the part of the content to obtain a random number. For example, the source device may calculate an MD5 value for the portion of content, taking the MD5 value as a random number; alternatively, a hash value of the part of the content is calculated, and the hash value is used as a random number.
Optionally, in a case that the first message includes the random number, the first message further includes indication information, where the indication information is used to indicate a position of the random number in the first message, and in implementation, the identification information may be used to indicate whether a certain field in the first message includes the random number.
Optionally, referring to the Message header structure shown in fig. 4 in the case that the first Message does not include the TEID, the Message header includes a Version field (Version), a P field, a T (TEID) field, a first free field (Spare), a Message Type field (Message Type), a Message Length field (Message Length), a Sequence Number field (Sequence Number), and a second free field (Spare).
The message header comprises eight bytes, the first byte comprises a version field, a P field, a T field and a first idle field, the version field comprises three bits, the first idle field comprises three bits, and the P field and the T field respectively comprise one bit. The message type field includes a second byte, the message length field includes a third byte and a fourth byte, the sequence number field includes a fifth byte, a sixth byte and a seventh byte, and the second idle field includes an eighth byte.
Optionally, the T field includes the identification bit, and the first idle field includes a random number generated by the source device. Alternatively, the first and second electrodes may be,
optionally, the T field includes the identification bit, the first idle field includes the indication information, and the second idle field includes a random number generated by the source device, where the indication information is used to indicate whether the second idle field includes the random number.
Optionally, the identification bit is bit 0 to identify that the first packet does not include the TEID, or the identification bit is bit 1 to identify that the first packet includes the TEID. Alternatively, the first and second electrodes may be,
optionally, the identification bit is bit 1 to identify that the first packet does not include the TEID, or the identification bit is bit 0 to identify that the first packet includes the TEID.
Optionally, one or more bits in the first idle field are used to include the indication information. For example, the indication information may be included using the third bit, the second bit, or the first bit in the first idle field, and the indication information may be bit 1. Or, for another example, the indication information may be included using the third bit and the second bit in the first idle field, or the indication information may be included using the second bit and the first bit in the first idle field, where the indication information is 11, 01, or 10, etc. Alternatively, for example, three bits in the third idle field may be used to include the indication information, which may be 111, 110, 101, 100, 011, 010, or 001.
Step 302: the first access device receives the first message, and determines a plurality of tunnels between the first access device and a second access device on a forwarding path of the first message, wherein the second access device is located between the first access device and a target device and is connected with the target device.
The first access device stores the corresponding relation between the device identification of the destination device and the identification of the tunnel. When a forwarding path for transmitting a packet between a source device and a destination device is established, a first access device may obtain an identifier of each tunnel between the first access device and a second access device and obtain a device identifier of the destination device, and store the device identifier of the destination device and the identifier of each tunnel in a corresponding relationship between the device identifier of the destination device and the identifier of the tunnel.
Optionally, the identifier of the tunnel may be an endpoint identifier of the tunnel on the first access device side, or a port number of a port included in the first access device and connected to the tunnel.
For example, for the first access device shown in fig. 1 or fig. 2, when the forwarding path between the source device and the destination device is established, the first access device obtains the destination device identifier Ter1, the identifier of the first tunnel is Tun1, and the identifier of the second tunnel is Tun 2. The device identifier Ter1 of the destination device, the identifier Tun1 of the first tunnel, and the identifier Tun2 of the second tunnel are correspondingly stored in the correspondence relationship between the device identifier of the destination device and the identifier of the tunnel as shown in table 1 below.
TABLE 1
Device identification of destination device Identification of tunnels
Ter1 Tun1 and Tun2
…… ……
In this step, the first access device obtains identifiers of multiple tunnels between the first access device and the second access device from a correspondence between the device identifier of the destination device and the identifier of the tunnel according to the device identifier of the destination device included in the first message, and determines the tunnel corresponding to the identifier of each tunnel to obtain multiple tunnels between the first access device and the second access device.
For example, referring to fig. 1 or fig. 2, a first access device receives a first packet sent by a source device, where the first packet includes a device identifier Ter1 of a destination device, obtains, according to a device identifier Ter1 of the destination device, an identifier Tun1 of a first tunnel and an identifier Tun2 of a second tunnel from a correspondence between a device identifier of the destination device and an identifier of the tunnel shown in table 1, and determines, according to the identifier Tun1 of the first tunnel and the identifier Tun2 of the second tunnel, the first tunnel and the second tunnel between the first access device and the second access device.
Step 303: the first access device acquires a random number.
Optionally, the first access device obtains the random number when the first packet does not include the TEID. Or, the first access device may also obtain the random number when the first packet includes the TEID.
Optionally, the first packet includes an identification bit, the first access device determines the identification bit, and the first access device obtains the random number when the identification bit is used to identify that the first packet does not include the TEID.
Optionally, the first access device may obtain the random number in the following two ways. The two modes are respectively as follows:
in a first manner, the first packet includes a random number, and the first access device reads the random number from the first packet.
Optionally, the first idle field of the header of the first packet includes a random number, and the first access device reads the random number from the first idle field. Alternatively, the first and second electrodes may be,
optionally, a first idle field in a header of the first packet includes the indication information, and a second idle field in the header of the first packet includes the random number. The first access equipment reads the indication information from the first idle field, and reads the random number from the second idle field when the indication information is used for indicating that the second idle field comprises the random number.
In a second way, the first access device generates a random number.
Optionally, the first access device generates a random number according to the first packet. For example, the first access device may read a part of the content from the first packet, use the part of the content as a random number, or transform the part of the content to obtain a random number. For example, the first access device may calculate an MD5 value of the portion of content, taking the MD5 value as a random number; alternatively, a hash value of the part of the content is calculated, and the hash value is used as a random number.
The execution sequence between the operation of determining the plurality of tunnels and the operation of acquiring the random number is not limited, that is, the operation of determining the plurality of tunnels and then the operation of acquiring the random number may be executed first, or the operation of acquiring the random number and then the operation of determining the plurality of tunnels may be executed first, or the operation of determining the plurality of tunnels and the operation of acquiring the random number may be executed simultaneously.
Step 304: the first access device selects a tunnel from the plurality of tunnels according to the random number and the device identification of the destination device in the first message.
In this step, the first access device performs hash operation on the random number and the device identifier of the destination device in the first message to obtain a hash value, and selects one tunnel from the plurality of tunnels through a load sharing algorithm according to the hash value.
The first access device may select one tunnel from the plurality of tunnels according to the hash value through any load sharing algorithm. For example, the first access device may perform a modulo operation on the hash value according to the number of the tunnels of the multiple tunnels to obtain an identifier of the tunnel, and select a tunnel corresponding to the identifier of the tunnel.
Step 305: and the first access equipment sends a second message to the second access equipment through the selected tunnel, wherein the second message comprises the first message or the part of the first message.
The second message may include the random number, or the second message may not include the random number.
Optionally, for the case that the second packet includes the random number, in this step, when the first packet includes the random number, the second packet includes the first packet, that is, the second packet is the same as the first packet. When the first message does not include the random number, the first access device may add the random number generated by the first access device to the first message to obtain the second message.
Optionally, the first access device adds the random number to the first idle field of the first packet. Or, the first access device adds indication information in a first idle field of the first packet, and adds the random number in a third idle field of the first packet, where the indication information is used to indicate that the third idle field includes the random number.
Among them, it should be noted that: under the condition that the second message includes the random number, multiple tunnels may exist between two forwarding devices, where the two forwarding devices are the first forwarding device and the second forwarding device, in the forwarding device through which the tunnel selected by the first access device passes, so that the first forwarding device also needs to select one tunnel from the multiple tunnels to forward the second message to the second access device according to the random number in the second message. The detailed implementation process will be described in detail in the embodiment shown in fig. 5.
For example, for the network architecture shown in fig. 2, it is assumed that the first access device selects one tunnel as the first tunnel, and thus after the first access device sends the second packet, the first forwarding device receives the second packet. A third tunnel and a fourth tunnel are included between the first forwarding device and the second forwarding device, and at this time, the first forwarding device needs to select one tunnel from the third tunnel and the fourth tunnel to forward the second packet to the second access device.
Optionally, for the case that the second packet does not include the random number, in this step, when the first packet includes the random number, the first access device deletes the random number from the first packet to obtain the second packet. When the first message does not include the random number, the second message includes the first message, that is, the second message is the same as the first message.
Optionally, when the first idle field of the first packet includes the random number, the first access device deletes the random number from the first idle field. Optionally, the first access device may set the first idle field to include bit 0, so as to delete the random number from the first idle field. Alternatively, the first and second electrodes may be,
optionally, in a case that the first idle field of the first packet includes the indication information and the second idle field of the first packet includes the random number, the first access device deletes the indication information from the first idle field and deletes the random number from the second idle field. Optionally, the first access device may set the first idle field to include bit 0 and set the second idle field to include bit 0, so as to delete the indication information from the first idle field and delete the random number from the second idle field.
Among them, it should be noted that: under the condition that the second message does not include the random number, multiple tunnels may exist between two forwarding devices, namely the first forwarding device and the second forwarding device, in the forwarding devices through which one tunnel selected by the first access device passes, so that the first forwarding device also needs to generate the random number, and selects one tunnel from the multiple tunnels to forward the second message to the second access device according to the generated random number. The detailed implementation process will be described in detail in the embodiment shown in fig. 5.
Step 306: and the second access equipment receives the second message and sends the second message to the destination equipment.
In the case that the second message includes the random number, the second access device may delete the random number from the second message, and then send the deleted second message to the destination device. Or, the second access device may also directly send the second packet to the destination device without deleting the random number, so that the destination device deletes the random number from the second packet.
The second access device may directly send the second packet to the destination device when the second packet does not include the random number.
In this embodiment of the application, since the first access device may obtain the random number, for example, the first access device may generate the random number or read the random number from the first packet, according to the random number and the device identifier of the destination device, select one tunnel from the multiple tunnels between the first access device and the second access device through a load sharing algorithm, and send a packet through the selected tunnel, thereby implementing load sharing among the multiple tunnels. In this way, even if the message sent by the source device does not include the TEID, the first access device can perform load sharing among the plurality of tunnels, thereby improving the effect of load sharing.
Referring to fig. 5, an embodiment of the present application provides a method for sending a packet, where the method may be applied to a network architecture shown in fig. 2, in the method, a first forwarding device receives a packet sent by a first access device, selects one tunnel from multiple tunnels between the first forwarding device and a second forwarding device, and sends the packet to the second access device through the selected tunnel. The method comprises the following steps:
step 501: and the first forwarding equipment receives the second message, and determines a plurality of tunnels between the first forwarding equipment and second forwarding equipment on a forwarding path of the second message, wherein the second forwarding equipment is positioned between the first forwarding equipment and the second access equipment and is connected with the second access equipment.
The first forwarding device stores the corresponding relation between the device identification of the destination device and the identification of the tunnel. In establishing a forwarding path for transmitting a packet between a source device and a destination device, a first forwarding device may obtain an identifier of each tunnel between the first forwarding device and a second forwarding device, obtain a device identifier of the destination device, and store the device identifier of the destination device and the identifier of each tunnel in a correspondence relationship between the device identifier of the destination device and the identifier of the tunnel.
For the first forwarding device shown in fig. 2, when the forwarding path between the source device and the destination device is established, the first forwarding device obtains the destination device identifier Ter1, the identifier Tun3 of the third tunnel, and the identifier Tun4 of the fourth tunnel. The device identifier Ter1 of the destination device, the identifier Tun3 of the third tunnel, and the identifier Tun4 of the fourth tunnel are correspondingly stored in the correspondence relationship between the device identifier of the destination device and the identifier of the tunnel as shown in table 2 below.
TABLE 2
Device identification of destination device Identification of tunnels
Ter1 Tun3 and Tun4
…… ……
In this step, the first forwarding device obtains, according to the device identifier of the destination device included in the first packet, identifiers of multiple tunnels between the first forwarding device and the second forwarding device from a correspondence between the device identifier of the destination device and the identifiers of the tunnels, and determines a tunnel corresponding to the identifier of each tunnel, thereby obtaining multiple tunnels between the first forwarding device and the second forwarding device.
For example, referring to fig. 2, the first forwarding device receives the second packet, where the second packet includes the device identifier Ter1 of the destination device, and obtains the identifier Tun3 of the third tunnel and the identifier Tun4 of the fourth tunnel from the correspondence between the device identifier of the destination device and the identifier of the tunnel as shown in table 2 according to the device identifier Ter1 of the destination device. Determining a third tunnel and a fourth tunnel between the first forwarding device and the second forwarding device according to the identification Tun3 of the third tunnel and the identification Tun4 of the fourth tunnel.
Step 502: the first forwarding device obtains a random number.
Optionally, the process of acquiring the random number by the first forwarding device is the same as the process of acquiring the random number by the first access device in step 303 of the embodiment shown in fig. 3, and is not described in detail here.
The execution sequence between the operation of determining the plurality of tunnels and the operation of acquiring the random number is not limited, that is, the operation of determining the plurality of tunnels and then the operation of acquiring the random number may be executed first, or the operation of acquiring the random number and then the operation of determining the plurality of tunnels may be executed first, or the operation of determining the plurality of tunnels and the operation of acquiring the random number may be executed simultaneously.
Step 503: and the first forwarding equipment selects one tunnel from the plurality of tunnels according to the random number and the equipment identification of the destination equipment in the second message.
Optionally, the process of the first forwarding device selecting one tunnel is the same as the process of the first access device selecting one tunnel in step 304 of the embodiment shown in fig. 3, and is not described in detail here.
Step 504: and the first forwarding equipment sends the second message to the second forwarding equipment through the selected tunnel.
Step 505: and the second forwarding equipment receives the second message and sends the second message to the second access equipment.
In this embodiment of the present application, since the first forwarding device may obtain the random number, according to the random number and the device identifier of the destination device, a tunnel is selected from multiple tunnels between the first forwarding device and the second forwarding device through a load sharing algorithm, and the second packet is sent through the selected tunnel, thereby implementing load sharing among the multiple tunnels.
Referring to fig. 6, an embodiment of the present application provides an apparatus 600 for sending a packet, where the apparatus 600 may be deployed on a network device described in any one of the foregoing embodiments of fig. 1 to 5, for example, the apparatus 600 may be deployed on a first access device in the embodiment shown in fig. 3 or a first forwarding device in the embodiment shown in fig. 5, and includes:
a receiving unit 601, configured to receive a first message, where the first message includes a device identifier of a destination device;
a processing unit 602, configured to determine, according to a device identifier of a destination device, multiple tunnels between the apparatus 600 and a second network device on a forwarding path of the first packet, where the second network device is located between the apparatus 600 and the destination device and connected to the destination device;
the processing unit 602 is further configured to obtain a random number, and select one tunnel from the multiple tunnels according to the random number and the device identifier;
a sending unit 603, configured to send a second packet through the selected one of the tunnels, where the second packet includes the first packet or a part of the first packet.
Optionally, the processing unit 602 determines the multiple tunnels and selects detailed implementation procedures of the tunnels, see the operation performed by the first access device in step 302 and step 304 in the embodiment shown in fig. 3, or see the operation performed by the first forwarding device in step 501 and step 503 in the embodiment shown in fig. 5.
Optionally, the first packet includes an identification bit, where the identification bit is used to indicate whether the first packet includes a tunnel endpoint identifier TEID, and the processing unit 602 is used to obtain the random number when the identification bit indicates that the first packet does not include the TEID.
Optionally, the detailed implementation procedure of the processing unit 602 to obtain the random number is as shown in the operation performed by the first access device in step 303 in the embodiment shown in fig. 3, or as shown in the operation performed by the first forwarding device in step 502 in the embodiment shown in fig. 5.
Optionally, the first packet includes a random number, where the random number is generated by the first device, the first device is a source device corresponding to the first packet or an access device connected to the source device, and the processing unit 602 is configured to extract the random number from the first packet.
Optionally, the first packet includes a first idle field, where the first idle field is adjacent to the identification bit, and the first idle field is located after the identification bit, and the first idle field includes the random number.
Optionally, the first packet includes a first idle field and a second idle field, where the first idle field is adjacent to the identification bit, the first idle field is located behind the identification bit, and the second idle field is located behind the first idle field, where the first idle field includes indication information, and the indication information is used to indicate whether the second idle field includes the random number;
a processing unit 602, configured to, in a case that the indication information is used to indicate that the second idle field includes the random number, extract the random number from the second idle field of the first packet.
Optionally, the processing unit 602 is configured to generate a random number according to the first packet.
Optionally, the detailed implementation procedure of the processing unit 602 to generate the random number is as shown in the operation performed by the first access device in step 303 in the embodiment shown in fig. 3, or as shown in the operation performed by the first forwarding device in step 502 in the embodiment shown in fig. 5.
Optionally, the processing unit 602 is further configured to add the random number to the first packet to obtain a second packet.
Optionally, the processing unit 602 adds a detailed implementation procedure of the random number, referring to the operation performed by the first access device in step 305 in the embodiment shown in fig. 3.
Optionally, the processing unit 602 is configured to:
performing hash operation according to the random number and the equipment identifier to obtain a hash value;
and selecting one tunnel from the plurality of tunnels through a load sharing algorithm according to the hash value.
Optionally, the processing unit 602 performs a detailed implementation process of the hash operation and the tunnel selection, referring to the operation performed by the first access device in step 304 in the embodiment shown in fig. 3, or referring to the operation performed by the first forwarding device in step 504 in the embodiment shown in fig. 5.
In this embodiment of the present application, a receiving unit receives a first message, where the first message includes a device identifier of a destination device. The processing unit determines a plurality of tunnels between the first network device and a second network device on a forwarding path of the first packet according to the device identifier of the destination device, wherein the second network device is located between the first network device and the destination device and connected with the destination device. The processing unit obtains a random number and selects one tunnel from the plurality of tunnels according to the random number and the equipment identifier. The sending unit sends a second message through the selected one of the tunnels, wherein the second message comprises the first message or a part of the first message. Because the processing unit obtains the random number, the processing unit can select one tunnel from the plurality of tunnels according to the random number and the equipment identification, thereby realizing the load sharing among the plurality of tunnels and improving the load sharing effect.
Referring to fig. 7, an embodiment of the present application provides a schematic diagram of an apparatus 700 for sending a message. The apparatus 700 may be a network device in any of the above embodiments, and for example, may be a first access device in the embodiment shown in fig. 3 or a first forwarding device in the embodiment shown in fig. 5. The apparatus 700 comprises at least one processor 701, a bus system 702, a memory 703 and at least one transceiver 704.
The apparatus 700 is a hardware structure apparatus, and can be used to implement the functional modules in the apparatus 600 described in fig. 6. For example, one skilled in the art may appreciate that the processing unit 602 in the apparatus 600 shown in fig. 6 may be implemented by the at least one processor 701 calling code in the memory 703, and the receiving unit 601 and the transmitting unit 603 in the apparatus 600 shown in fig. 6 may be implemented by the transceiver 704.
Optionally, the apparatus 700 may also be used to implement the function of the network device (the first access device or the first forwarding device) in any of the embodiments described above.
Alternatively, the processor 701 may be a general processing unit (CPU), a Network Processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program according to the present disclosure.
The bus system 702 may include a path that transfers information between the components.
The transceiver 704 is used to communicate with other devices or communication networks.
The memory 703 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these. The memory may be self-contained and coupled to the processor via a bus. The memory may also be integral to the processor.
The memory 703 is used for storing application program codes for executing the present application, and is controlled by the processor 701 to execute. The processor 701 is configured to execute application program code stored in the memory 703 to implement the functions of the method of the present patent.
In particular implementations, processor 701 may include one or more CPUs such as CPU0 and CPU1 of fig. 7 for one embodiment.
In particular implementations, the apparatus 700 may include multiple processors, such as the processor 701 and the processor 707 in fig. 7, for example, as an example. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In a specific embodiment, the processor 701 is configured to receive a first packet through the transceiver 704, where the first packet includes a device identifier of a destination device; determining a plurality of tunnels between the device and second network equipment on a forwarding path of the first message according to the equipment identifier of the destination equipment, wherein the second network equipment is positioned between the device and the destination equipment and is connected with the destination equipment; acquiring a random number, and selecting one tunnel from the plurality of tunnels according to the random number and the equipment identifier; sending a second message through the selected one of the tunnels via the transceiver 704, the second message including the first message or a portion of the first message.
For the detailed processing procedure of the processor, please refer to the detailed descriptions of the procedures S302, S303, S304, S305, and S501, S502, S503, S504 in the above embodiments, which are not repeated herein.
The transceiver 704 is used for the device 700 to receive and transmit messages through the network system. For a specific process, please refer to the detailed description of S305 and S504 in the above embodiment, which is not repeated herein.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only an example of the present application and should not be taken as limiting the present application, and any modifications, equivalents, improvements and the like that are made within the principles of the present application should be included in the scope of the present application.

Claims (16)

1. A method for sending a message, the method comprising:
a first network device receives a first message, wherein the first message comprises a device identifier of a destination device;
the first network device determines a plurality of tunnels between the first network device and a second network device on a forwarding path of the first packet according to the device identifier of the destination device, wherein the second network device is located between the first network device and the destination device and is connected with the destination device;
the first network equipment acquires a random number and selects one tunnel from the plurality of tunnels according to the random number and the equipment identification;
and the first network equipment sends a second message through the selected tunnel, wherein the second message comprises the first message or the part of the first message.
2. The method of claim 1, wherein the first packet includes an identification bit, the identification bit indicating whether the first packet includes a Tunnel Endpoint Identification (TEID), and wherein the obtaining, by the first network device, a random number comprises:
and the first network equipment acquires a random number under the condition that the identification bit indicates that the first message does not comprise the TEID.
3. The method of claim 2, wherein the first packet includes the random number, the random number is generated by a first device, the first device is a source device corresponding to the first packet or an access device connected to the source device, and the obtaining, by the first network device, the random number includes:
and the first network equipment extracts the random number from the first message.
4. The method of claim 3, wherein the first packet includes a first free field, the first free field being adjacent to the identification bit, the first free field being located after the identification bit, the first free field including the random number.
5. The method of claim 3, wherein the first packet includes a first free field and a second free field, the first free field being adjacent to the identification bit, the first free field being located after the identification bit, the second free field being located after the first free field, the first free field including indication information indicating whether the second free field includes the random number;
the extracting, by the first network device, the random number from the first packet includes:
and the first network equipment extracts the random number from the second idle field of the first message under the condition that the indication information is used for indicating that the second idle field comprises the random number.
6. The method of claim 2, wherein the first network device obtaining a random number comprises:
and the first network equipment generates the random number according to the first message.
7. The method of claim 6, wherein after the first network device generates the random number from the first packet, the method further comprises:
and the first network equipment adds the random number in the first message to obtain the second message.
8. The method of any of claims 1 to 7, wherein the first network device selecting a tunnel from the plurality of tunnels based on the random number and the device identification comprises:
the first network equipment carries out hash operation according to the random number and the equipment identification to obtain a hash value;
and the first network equipment selects one tunnel from the plurality of tunnels through a load sharing algorithm according to the hash value.
9. An apparatus for sending a message, the apparatus comprising:
a receiving unit, configured to receive a first packet, where the first packet includes a device identifier of a destination device;
a processing unit, configured to determine, according to a device identifier of the destination device, multiple tunnels between the apparatus and a second network device on a forwarding path of the first packet, where the second network device is located between the apparatus and the destination device and connected to the destination device;
the processing unit is further configured to acquire a random number, and select one tunnel from the multiple tunnels according to the random number and the device identifier;
a sending unit, configured to send a second packet through the selected one tunnel, where the second packet includes the first packet or a part of the first packet.
10. The apparatus of claim 9, wherein the first packet comprises an identification bit, the identification bit being used to indicate whether the first packet includes a Tunnel Endpoint Identification (TEID), and wherein the processing unit is configured to obtain a random number if the identification bit indicates that the first packet does not include the TEID.
11. The apparatus according to claim 10, wherein the first packet includes the random number, the random number is generated by a first device, the first device is a source device corresponding to the first packet or an access device connected to the source device, and the processing unit is configured to extract the random number from the first packet.
12. The apparatus of claim 11, wherein the first packet comprises a first free field, the first free field being adjacent to the identification bit, the first free field being located after the identification bit, the first free field comprising the random number.
13. The apparatus of claim 11, wherein the first packet comprises a first free field and a second free field, the first free field being adjacent to the identification bit, the first free field being located after the identification bit, the second free field being located after the first free field, the first free field comprising indication information indicating whether the second free field comprises the random number;
the processing unit is configured to extract the random number from the second idle field of the first packet when the indication information is used to indicate that the second idle field includes the random number.
14. The apparatus of claim 10, wherein the processing unit is configured to generate the random number according to the first packet.
15. The apparatus of claim 14, wherein the processing unit is further configured to add the random number to the first packet to obtain the second packet.
16. The apparatus according to any of claims 9 to 15, wherein the processing unit is configured to:
performing hash operation according to the random number and the equipment identifier to obtain a hash value;
and selecting one tunnel from the plurality of tunnels through a load sharing algorithm according to the hash value.
CN201911298548.8A 2019-12-17 2019-12-17 Method and device for sending message Pending CN112995053A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911298548.8A CN112995053A (en) 2019-12-17 2019-12-17 Method and device for sending message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911298548.8A CN112995053A (en) 2019-12-17 2019-12-17 Method and device for sending message

Publications (1)

Publication Number Publication Date
CN112995053A true CN112995053A (en) 2021-06-18

Family

ID=76341892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911298548.8A Pending CN112995053A (en) 2019-12-17 2019-12-17 Method and device for sending message

Country Status (1)

Country Link
CN (1) CN112995053A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113438172A (en) * 2021-08-26 2021-09-24 北京华云安信息技术有限公司 Data transmission method and device based on multi-level node network
CN113595911A (en) * 2021-09-28 2021-11-02 深圳艾灵网络有限公司 Data forwarding method and device, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113438172A (en) * 2021-08-26 2021-09-24 北京华云安信息技术有限公司 Data transmission method and device based on multi-level node network
CN113595911A (en) * 2021-09-28 2021-11-02 深圳艾灵网络有限公司 Data forwarding method and device, electronic equipment and storage medium
CN113595911B (en) * 2021-09-28 2021-12-03 深圳艾灵网络有限公司 Data forwarding method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108011837B (en) Message processing method and device
KR102555671B1 (en) Packet processing methods, related devices and computer storage media
US6968393B1 (en) Method and apparatus for an attribute oriented routing update
CN105657748B (en) Communication method and network equipment based on tunnel binding
CN110831094B (en) Method and device for processing data transmission channel
CN113242293B (en) UPF equipment, data processing and capacity expansion method and device
EP3972207A1 (en) Message processing method, device, and computer storage medium
EP4068704A1 (en) Packet sending method, routing table entry generation method, device, and storage medium
WO2021083341A1 (en) Method for processing message, and network node and system
WO2016197689A1 (en) Method, apparatus and system for processing packet
CN106533973B (en) Method, equipment and system for distributing service message
CN112887229B (en) Session information synchronization method and device
CN110430135B (en) Message processing method and device
EP3780885A1 (en) Method, apparatus and system for establishing subflows of multipath connection
CN114143283B (en) Tunnel self-adaptive configuration method and device, central terminal equipment and communication system
CN111328108A (en) 5G service data processing method and device and shunting equipment
US10764411B2 (en) Stream control transmission protocol SCTP-based communications method and system, and apparatus
CN112995053A (en) Method and device for sending message
CN113162779B (en) Multi-cloud interconnection method and equipment
CN106850869B (en) IP address configuration method and network equipment
CN112165505B (en) Decentralized data processing method, electronic device and storage medium
CN112583736A (en) Signaling message distribution method, device, equipment and medium
CN114866470A (en) Method, device, system and storage medium for sending message
CN112019492B (en) Access control method, device and storage medium
CN111865751B (en) Centralized gateway deployment method and device, centralized gateway and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20210618

WD01 Invention patent application deemed withdrawn after publication