CN-119052340-B - Communication method and device
Abstract
The application provides a communication method and a communication device, wherein the method is applied to first network equipment, the first network equipment comprises an aggregation interface, when an upper layer protocol included in the first network equipment generates a first protocol message, an output interface identifier for forwarding the first protocol message is obtained according to a destination IP address included in the first protocol message, the output interface identifier is indicated as the aggregation interface, a member port for forwarding the first protocol message is selected from the aggregation interface according to a packet-by-packet forwarding mode, and a second protocol message is sent to second network equipment through the member port, wherein the second protocol message comprises the first protocol message.
Inventors
- WANG MENG
Assignees
- 新华三技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20240813
Claims (8)
- 1. A method of communication, the method being applied to a first network device, the first network device comprising an aggregation interface, the method comprising: When an upper layer protocol included in the first network device generates a first protocol message, acquiring an outgoing interface identifier for forwarding the first protocol message according to a destination IP address included in the first protocol message, wherein the outgoing interface identifier indicates the aggregation interface; according to the packet-by-packet forwarding mode, a member port for forwarding the first protocol message is selected from the aggregation interfaces; sending a second protocol message to a second network device through the member port, wherein the second protocol message comprises the first protocol message; the first network device comprises a plurality of single boards, and each single board comprises a plurality of chip units and a plurality of member ports belonging to the aggregation interface; When the upper layer protocol included in the first network device generates a first protocol packet, before obtaining the interface identifier for forwarding the first protocol packet according to the destination IP address included in the first protocol packet, the method further includes: Sequentially polling each single board, each chip unit and each member port; And generating an interface polling list according to the sequential polling result, wherein the interface polling list comprises member port numbers, and the member port numbers comprise single board numbers, chip unit numbers and interface numbers.
- 2. The method according to claim 1, wherein the selecting, from the aggregation interfaces, a member port for forwarding the first protocol packet according to a packet-by-packet forwarding manner specifically includes: And determining the member port from the interface polling list.
- 3. The method according to claim 2, wherein said determining the member port from the interface polling list comprises: Acquiring a message sequence number of the first protocol message and the number of member ports; Performing remainder operation on the message sequence number and the number of the member ports to obtain an interface index; acquiring a member port number corresponding to the interface index from the interface polling list according to the interface index; and taking the member port corresponding to the member port number as a member port for forwarding the first protocol message.
- 4. The method of claim 1, wherein the single board numbers optimal polls, the chip unit numbers suboptimal polls, and the interface numbers suboptimal polls.
- 5. A communication apparatus, the apparatus being applied to a first network device, the first network device comprising an aggregation interface, the apparatus comprising: an obtaining unit, configured to obtain, when an upper layer protocol included in the first network device generates a first protocol packet, an outgoing interface identifier for forwarding the first protocol packet according to a destination IP address included in the first protocol packet, where the outgoing interface identifier indicates the aggregation interface; A selecting unit, configured to select, from the aggregation interfaces, a member port for forwarding the first protocol packet according to a packet-by-packet forwarding manner; A sending unit, configured to send a second protocol packet to a second network device through the member port, where the second protocol packet includes the first protocol packet; the first network device comprises a plurality of single boards, and each single board comprises a plurality of chip units and a plurality of member ports belonging to the aggregation interface; The apparatus further comprises: The polling unit is used for sequentially polling each single board, each chip unit and each member port; The generating unit is used for generating an interface polling list according to the sequential polling result, wherein the interface polling list comprises member port numbers, and the member port numbers comprise single board numbers, chip unit numbers and interface numbers.
- 6. The apparatus of claim 5, wherein the selection unit is specifically configured to determine the member port from the interface polling list.
- 7. The apparatus of claim 6, wherein the selecting unit is further specifically configured to obtain a message sequence number of the first protocol message and the number of member ports; Performing remainder operation on the message sequence number and the number of the member ports to obtain an interface index; acquiring a member port number corresponding to the interface index from the interface polling list according to the interface index; and taking the member port corresponding to the member port number as a member port for forwarding the first protocol message.
- 8. The apparatus of claim 6, wherein the single board numbers optimal polls, the chip unit numbers suboptimal polls, and the interface numbers suboptimal polls.
Description
Communication method and device Technical Field The present application relates to the field of communications technologies, and in particular, to a communications method and apparatus. Background The ethernet link aggregation refers to the purpose of increasing the link bandwidth by binding a plurality of ethernet physical links together to form one ethernet logical link. Meanwhile, the links which are bound together can effectively improve the reliability of the links through mutual dynamic backup. As shown in fig. 1, fig. 1 is a schematic diagram of a conventional link aggregation. In fig. 1, a network Device (Device) a and a network Device B are connected by 3 physical links. The 3 physical links are bundled together into one logical Link aggregation 1. The link binding is implemented by port binding, a plurality of ethernet interfaces are bound together to form an aggregation group, and the ethernet interfaces bound together are called member ports of the aggregation group. Each aggregation group uniquely corresponds to a logical interface, referred to as an aggregation interface. After the logic link is formed between the network device A and the network device B, the load sharing of the traffic in the aggregation group can be realized by adopting different aggregation load sharing types. The aggregate load sharing type includes packet-by-packet load sharing and stream-by-stream load sharing. The packet-by-packet load sharing refers to that traffic is not distinguished, but is shared to different member links for transmission by taking a message as a unit, and the flow-by-flow load sharing refers to that traffic is distinguished according to the characteristics of the message, so that messages belonging to the same traffic pass through the same member link. However, although any mode included in the aggregate load sharing type can be selected to realize load sharing of traffic in the aggregate group, the two load sharing modes also respectively expose the following defects that 1) when adopting the progressive load sharing mode, one physical link in the aggregate group is failed and unstable, the upper protocol oscillation and protocol message discarding are easy to be caused, and 2) when adopting the progressive load sharing mode, message disorder and service function invalidation are easy to be caused. Disclosure of Invention In view of this, the present application provides a communication method and apparatus, which are used to solve the problems of upper protocol oscillation, protocol packet discarding, packet disorder, service function failure, etc. that occur when the load sharing is performed on the flows in the aggregation group in the existing flow-by-flow and packet-by-packet load sharing manner. In a first aspect, the present application provides a communication method applied to a first network device, the first network device including an aggregation interface, the method comprising: When an upper layer protocol included in the first network device generates a first protocol message, acquiring an outgoing interface identifier for forwarding the first protocol message according to a destination IP address included in the first protocol message, wherein the outgoing interface identifier indicates the aggregation interface; according to the packet-by-packet forwarding mode, a member port for forwarding the first protocol message is selected from the aggregation interfaces; and sending a second protocol message to second network equipment through the member port, wherein the second protocol message comprises the first protocol message. In a second aspect, the present application provides a communications apparatus for application to a first network device, the first network device comprising an aggregation interface, the apparatus comprising: an obtaining unit, configured to obtain, when an upper layer protocol included in the first network device generates a first protocol packet, an outgoing interface identifier for forwarding the first protocol packet according to a destination IP address included in the first protocol packet, where the outgoing interface identifier indicates the aggregation interface; A selecting unit, configured to select, from the aggregation interfaces, a member port for forwarding the first protocol packet according to a packet-by-packet forwarding manner; and the sending unit is used for sending a second protocol message to the second network equipment through the member port, wherein the second protocol message comprises the first protocol message. In a third aspect, the application provides a network device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor to cause the processor to perform the method provided by the first aspect of the application. Therefore, when the upper layer protocol included in the first network device generates the first protocol message, the first network device