Message forwarding method and device, electronic equipment and computer readable storage medium
By configuring the same interface IP and MAC address in the MLAG system and different MLAG IP and MAC addresses, the problem of occupying Peer-Link bandwidth during load sharing in the MLAG dual-home access IP network is solved, and efficient message forwarding and load sharing are achieved.
Patent Information
- Application Number
- CN202411954820.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-11
AI Technical Summary
In the MLAG dual-home access IP network scenario, the existing technology will occupy the bandwidth of the Peer-Link link when implementing data packet load sharing, or it will need to identify protocol packets, increase device processing overhead, and affect forwarding efficiency.
Message forwarding is realized by configuring the same interface IP address and interface MAC address on the access interfaces of the first network device and the second network device, and configuring different MLAG IP addresses and MLAG MAC addresses. The specific method includes receiving the message to be forwarded and obtaining its destination MAC address. If the destination MAC address is the interface MAC address, performing local layer three forwarding; if it is an MLAG MAC address, it forwards through the Peer-Link link.
The load sharing of data packets between two network devices is realized, avoiding the bandwidth of the Peer-Link link, and no need to identify protocol packets, reducing device processing overhead and improving forwarding efficiency.
Smart Images

Figure CN119814693A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a message forwarding method, device, electronic device and computer-readable storage medium. Background Art
[0002] MLAG (Multichassis Link Aggregation Group) is a mechanism for implementing cross-device link aggregation. It aggregates the cross-device links of an access device with two other paired devices to form an active-active system. It aggregates the ports on different devices into one logical interface. Even if one of the devices fails or one of the aggregated links fails, it will not cause the aggregated link to fail completely, thus ensuring reliable data transmission. Figure 1 As shown in the figure, MLAG performs cross-device link aggregation between access device ServerA (which can be a device or a host) and two other devices DeviceA and DeviceB, just like ServerA and a device DeviceC establish a link aggregation relationship, thereby improving the link reliability from the single-board level to the device level.
[0003] exist Figure 2 In the scenario of MLAG dual-homing access to an IP network, two network devices (Device 1 and Device 2) simultaneously serve as Layer 3 gateways (active-active gateways), and data packets need to be load-balanced between the two network devices to fully utilize the link bandwidth. In the prior art, the following solutions exist:
[0004] exist Figure 3In the scheme shown, the access interfaces of the two network devices are configured with different interface IP addresses and establish neighbors with the dual-homed access devices. In this way, routing on the access devices will form a load (the next hop is 100.0.0.3 and 100.0.0.4, the outbound interfaces are VLAN100, the MAC address corresponding to 100.0.0.3 is ccc, and the MAC address corresponding to 100.0.0.4 is ddd). However, when the aggregation group sends data packets, HASH load balancing will be performed. The packets routed to the next hop 100.0.0.3 may be sent to Device2. Device2 finds The destination MAC address of the message is ccc, which will be forwarded to Device 1 through Peer-Link (a directly connected aggregation link between two network devices, i.e., a peer link). After receiving the message, Device 1 will search for a route to continue forwarding. Therefore, a large number of data messages will be transferred to the peer network device through the Peer-Link link before they can be forwarded, which will occupy the bandwidth of the Peer-Link link. The Peer-Link link is mainly used for interactive protocol messages and should not be occupied by a large number of data messages. The bandwidth of the Peer-Link link is usually small, which will become a bottleneck for message forwarding.
[0005] exist Figure 4 In the scheme shown, two network devices are configured with different MLAG IP addresses and establish neighbors with access devices. In this way, routing on the access device will form a load (the next hop is 100.0.0.3 and 100.0.0.4, and the outbound interfaces are both VLAN100, but the MAC addresses corresponding to 100.0.0.3 and 100.0.0.4 are both aaa). When the aggregation group sends data packets, it will still send the packets routed to the next hop 100.0.0.3 to Device2. After receiving the packet, Device2 finds that the destination MAC of the packet is aaa, which is the MAC address of the local device, and then performs Layer 3 forwarding, searches for the route to send the packet, and will no longer forward it to Device1 through the Peer-Link link. However, for the protocol message that the access device wants to send to Device1 and the destination address is 100.0.0.3, if it is actually sent to Device2, according to the normal processing logic, after Device2 receives it, it finds that the destination MAC of the message is the MAC address of the local device, and will perform three-layer forwarding. Since the TTL (Time ToLive) of the protocol message is 1, it will be discarded due to TTL timeout. Therefore, special processing is required before the protocol message is discarded, that is, the protocol message to be sent to the peer network device is identified, and the protocol message is forwarded to Device1 through the Peer-Link link in advance. Identifying the protocol message from all the messages to be forwarded will obviously increase the processing overhead of the device and affect the forwarding efficiency of the data message.
[0006] It can be seen that in the scenario of MLAG dual-homing access to the IP network, when the existing technical solutions realize load sharing of data packets between two network devices, either the data packets will occupy the bandwidth of the Peer-Link link, or the protocol packets need to be identified, thereby increasing the processing overhead of the device and affecting the forwarding efficiency of the data packets. Summary of the invention
[0007] In view of this, the purpose of the present invention is to provide a message forwarding method, device, electronic device and computer-readable storage medium to solve the problem that in the scenario of MLAG dual-homing access to an IP network, when load sharing of data messages between two network devices is realized, the bandwidth of the Peer-Link link will be occupied, or the protocol message needs to be identified, thereby increasing the processing overhead of the device and affecting the forwarding efficiency of the data message.
[0008] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0009] In a first aspect, the present invention provides a message forwarding method, which is applied to a first network device, wherein the first network device and a second network device form an inter-device link aggregation group MLAG system, and an access device dual-homedly accesses the MLAG system through a first access interface of the first network device and a second access interface of the second network device; the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAGMAC addresses; the method comprises:
[0010] Receiving a message to be forwarded sent by the access device;
[0011] Obtaining the destination MAC address of the message to be forwarded;
[0012] If the destination MAC address is the interface MAC address, local layer 3 forwarding is performed on the message to be forwarded;
[0013] If the destination MAC address is the MLAGMAC address of the second network device, the message to be forwarded is forwarded via the Peer-Link link between the second network device.
[0014] In an optional implementation manner, if the destination MAC address is the MLAGMAC address of the second network device, forwarding the message to be forwarded through the Peer-Link link between the second network device includes:
[0015] If the destination MAC address is the MLAGMAC address of the second network device, the forwarding table entry corresponding to the MLAGMAC address of the second network device is searched in the Layer 2 forwarding table, and the message to be forwarded is forwarded through the forwarding port in the forwarding table entry; wherein, the forwarding table entry corresponding to the MLAGMAC address of the second network device is created by the first network device after sensing the MLAGMAC address of the second network device; and the forwarding port in the forwarding table entry corresponding to the MLAGMAC address of the second network device is the Peer-Link port on the first network device.
[0016] In an optional implementation manner, before receiving the message to be forwarded sent by the access device, the method further includes:
[0017] Establishing a neighbor relationship with the access device according to the MLAG IP address of the first network device;
[0018] Sending a routing advertisement message to the access device; the routing advertisement message is used to instruct the access device to set the next hop address of the route to the interface IP address;
[0019] Upon receiving a first request message sent by the access device according to the interface IP address, generating a first response message according to the interface MAC address corresponding to the interface IP address, so that the access device records the correspondence between the interface IP address and the interface MAC address in the address mapping table according to the first response message;
[0020] When receiving a second request message sent by the access device based on the MLAG IP address of the first network device, a second response message is generated based on the MLAGMAC address corresponding to the MLAG IP address of the first network device, so that the access device records the correspondence between the MLAGIP address and the MLAGMAC address of the first network device in the address mapping table based on the second response message.
[0021] In a second aspect, the present invention provides a message forwarding method, which is applied to an access device, wherein the access device dual-homedly accesses an inter-device link aggregation group MLAG system composed of the first network device and the second network device through a first access interface of a first network device and a second access interface of a second network device, wherein the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAGMAC addresses; the method comprises:
[0022] When the message to be forwarded is a data message and the next hop address of the data message is the interface IP address, setting the destination MAC address of the message to be forwarded to the interface MAC address;
[0023] When the message to be forwarded is a protocol message and the destination address of the protocol message is the MLAG IP address of any network device in the MLAG system, setting the destination MAC address of the message to be forwarded to the MLAG MAC address corresponding to the MLAG IP address of any network device;
[0024] The message to be forwarded is sent to the first network device or the second network device.
[0025] In an optional implementation manner, the access device stores an address mapping table, and the address mapping table records the correspondence between the IP address and the MAC address;
[0026] Before setting the destination MAC address of the message to be forwarded to the interface MAC address, the method further comprises: searching the interface MAC address corresponding to the interface IP address from the address mapping table;
[0027] Before setting the destination MAC address of the message to be forwarded as the MLAGMAC address corresponding to the MLAG IP address, the method further includes: searching the address mapping table for the MLAGMAC address corresponding to the MLAG IP address.
[0028] In an optional embodiment, the method further comprises:
[0029] After establishing a neighbor relationship with the first network device, sending a second request message to the first network device according to the obtained MLAGIP address of the first network device, receiving a second response message generated by the first network device according to the second request message, and recording the correspondence between the MLAG IP address and the MLAGMAC address of the first network device in the address mapping table according to the MLAGMAC address in the second response message;
[0030] After receiving the routing announcement message sent by the first network device, the next hop address of the route is set to the interface IP address of the first network device, a first request message is sent to the first network device according to the interface IP address of the first network device, a first response message generated by the first network device according to the first request message is received, and the correspondence between the interface IP address and the interface MAC address is recorded in the address mapping table according to the interface MAC address in the first response message.
[0031] In a third aspect, the present invention provides a message forwarding device, which is applied to a first network device, wherein the first network device and the second network device form an inter-device link aggregation group MLAG system, and the access device dual-homedly accesses the MLAG system through a first access interface of the first network device and a second access interface of the second network device; the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAG MAC addresses; the device comprises:
[0032] A first transceiver module, used to receive a message to be forwarded sent by the access device;
[0033] An acquisition module, used to acquire the destination MAC address of the message to be forwarded;
[0034] The first transceiver module is also used to perform local layer-3 forwarding on the message to be forwarded if the destination MAC address is the interface MAC address; if the destination MAC address is the MLAGMAC address of the second network device, forward the message to be forwarded via the Peer-Link link between the second network device.
[0035] In a fourth aspect, the present invention provides a message forwarding device, which is applied to an access device, wherein the access device is dual-homed to an inter-device link aggregation group MLAG system composed of the first network device and the second network device through a first access interface of a first network device and a second access interface of a second network device, wherein the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAG MAC addresses; the device comprises:
[0036] a processing module, configured to set the destination MAC address of the message to be forwarded to the interface MAC address when the message to be forwarded is a data message and the next hop address of the data message is the interface IP address; and to set the destination MAC address of the message to be forwarded to the MLAG MAC address corresponding to the MLAG IP address of any network device in the MLAG system when the message to be forwarded is a protocol message and the destination address of the protocol message is the MLAG IP address of any network device in the MLAG system;
[0037] The second transceiver module is used to send the message to be forwarded to the first network device or the second network device.
[0038] In a fifth aspect, the present invention provides an electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of a message forwarding method as described in any one of the aforementioned embodiments.
[0039] In a sixth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the message forwarding method as described in any one of the aforementioned embodiments are implemented.
[0040] The message forwarding method, device, electronic device and computer-readable storage medium provided by the embodiments of the present invention, the first network device and the second network device form an MLAG system, the access device dual-homes to the MLAG system through the first access interface of the first network device and the second access interface of the second network device; the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAGMAC addresses. The first network device receives the message to be forwarded sent by the access device; obtains the destination MAC address of the message to be forwarded; if the destination MAC address is the interface MAC address, performs local Layer 3 forwarding on the message to be forwarded; if the destination MAC address is the MLAG MAC address of the second network device, forwards the message to be forwarded via the Peer-Link link between the first network device and the second network device. Since the interface IP address and interface MAC address configured on the access interface of the first network device and the second network device are the same, and the configured MLAG IP address and MLAG MAC address are different, the first network device and the second network device can directly perform local three-layer forwarding on the received data packets, thereby achieving load sharing while avoiding occupying the bandwidth of the Peer-Link link; and even if the protocol packet is erroneously sent to the first network device, it can reach the second network device through layer 2 forwarding, without the need to identify and specially process the protocol packet, without adding additional processing to the forwarding process, and will not increase the processing overhead of the device, nor will it affect the forwarding efficiency of the data packet.
[0041] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0043] Figure 1 A schematic diagram of cross-device link aggregation in the prior art is shown;
[0044] Figure 2 A schematic diagram of a scenario in which MLAG accesses an IP network in the prior art is shown;
[0045] Figure 3 A schematic diagram showing two network devices respectively configuring different interface IP addresses and establishing neighbors with access devices in the prior art is shown;
[0046] Figure 4 A schematic diagram showing two network devices respectively configuring different MLAG IP addresses and establishing neighbors with access devices in the prior art is shown;
[0047] Figure 5 A schematic diagram of a scenario of MLAG dual-homing access to an IP network applicable to an embodiment of the present invention is shown;
[0048] Figure 6 A schematic flow chart of a message forwarding method applied to a first network device provided in an embodiment of the present invention is shown;
[0049] Figure 7 Another schematic flow chart of a message forwarding method applied to a first network device provided in an embodiment of the present invention is shown;
[0050] Figure 8 A specific example diagram showing MLAG dual-homing access to an IP network applicable to an embodiment of the present invention is shown;
[0051] Fig. 9 A schematic diagram of a flow chart of a message forwarding method applied to an access device provided by an embodiment of the present invention is shown;
[0052] Fig.10 Another schematic diagram of a flow chart of a message forwarding method applied to an access device provided in an embodiment of the present invention is shown;
[0053] Fig.11 A functional module diagram of a message forwarding device applied to a first network device provided by an embodiment of the present invention is shown;
[0054] Fig.12 A functional module diagram of a message forwarding device applied to an access device provided by an embodiment of the present invention is shown;
[0055] Fig.13 A block diagram of an electronic device provided by an embodiment of the present invention is shown.
[0056] Icons: 100 - first network device; 200 - second network device; 300 - access device; 610 - first transceiver module; 620 - acquisition module; 710 - processing module; 720 - second transceiver module; 110 - memory; 120 - processor; 130 - communication module. DETAILED DESCRIPTION
[0057] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0058] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0059] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0060] Please refer to Figure 5 , is a schematic diagram of a scenario in which MLAG dual-homing access to an IP network is applicable to an embodiment of the present invention. Figure 5 As shown, the first network device 100 and the second network device 200 form an MLAG system, the first network device 100 and the second network device 200 are connected to each other through a Peer-Link link, and the access device 300 is dual-homed to the MLAG system through the first access interface of the first network device 100 and the second access interface of the second network device 200. Figure 5 Not shown.
[0061] Among the two network devices (i.e., the first network device 100 and the second network device 200) of the MLAG system, the role of one network device is the master device (MASTER), and the role of the other network device is the slave device (SLAVE). The master-slave relationship between the two network devices can be determined by mutual negotiation or manually specified, and the embodiment of the present invention does not limit this. For example, the first network device 100 is the MLAG master device, and the second network device 200 is the MLAG slave device; or, the first network device 100 is the MLAG slave device, and the second network device 200 is the MLAG master device.
[0062] In this embodiment, the first access interface of the first network device 100 and the second access interface of the second network device 200 are configured with the same IP address (referred to as the interface IP address in the present invention) and MAC address (referred to as the interface MAC address in the present invention), and the first access interface and the second access interface are configured with different MLAG IP addresses and MLAGMACs. Among them, the first access interface of the first network device 100 is the interface on the first network device 100 connected to the access device 300, and the second access interface of the second network device 200 is the interface on the second network device 200 connected to the access device 300.
[0063] In this embodiment, the interface IP address and the MLAG IP address can be an IPv4 address or an IPv6 address. For example, the interface IP addresses of the first access interface and the second access interface are both 100.0.0.1, and the interface MAC addresses are both aaa; the MLAG IP address and MLAGMAC address of the first access interface are 100.0.0.3 and ccc respectively, and the MLAG IP address and MLAGMAC address of the second access interface are 100.0.0.4 and ddd respectively.
[0064] In this embodiment, the first network device 100 and the second network device 200 may be switches, and the access device 300 may be a switch, a server, or other device.
[0065] The message forwarding method provided in the embodiment of the present invention can be applied to the above-mentioned first network device 100, second network device 200 and access device 300. Among them, the specific process of implementing the message forwarding method on the first network device 100 and the second network device 200 is the same, so the embodiment of the present invention mainly describes the message forwarding method applied to the first network device 100 and the message forwarding method applied to the access device 300.
[0066] Please refer to Figure 6, is a flow chart of a message forwarding method applied to the first network device 100 provided in an embodiment of the present invention. It should be noted that the message forwarding method in the embodiment of the present invention is not based on Figure 6 It should be understood that in other embodiments, the order of some steps in the message forwarding method of the embodiment of the present invention can be interchanged according to actual needs, or some steps can be omitted or deleted. Figure 6 The specific process shown is described in detail.
[0067] Step S601: receiving a message to be forwarded sent by an access device.
[0068] Among them, when the message to be forwarded is a data message and the next hop address of the data message is the interface IP address, the access device sets the destination MAC address of the message to be forwarded to the interface MAC address; when the message to be forwarded is a protocol message and the destination address of the protocol message is the MLAG IP address of any network device in the MLAG system, the destination MAC address of the message to be forwarded is set to the MLAGMAC address corresponding to the MLAG IP address of any network device.
[0069] In this embodiment, since the access interfaces of the first network device 100 and the second network device 200 that are connected to the access device 300 for communication are configured with the same IP address and MAC address, when the first network device 100 and the second network device 200 perform route announcements to the access device 300, they will specify the next hop address of the route as the IP address of the access interface in the route announcement message. In this way, when the access device sends a data message, the route found has only one next hop address, that is, the interface IP address. The MAC address corresponding to the interface IP address is found in the address mapping table as the interface MAC address, and the interface MAC address is used as the destination MAC address of the data message. In other words, when the access device sends a data message with the next hop address as the interface IP address, the same interface MAC address is used as the destination MAC address. Among them, the address mapping table can be an ARP (Address Resolution Protocol) table or an ND (Neighbor Discovery Protocol) table.
[0070] Any network device in the MLAG system may be the first network device 100 or the second network device 200. When the access device 300 is to send a protocol message whose destination address is the MLAG IP address configured on the first network device 100, the corresponding MAC address in the address mapping table is the MLAG MAC address configured on the first network device 100, and the MLAG MAC address is used as the destination MAC address of the protocol message. Similarly, when the access device 300 is to send a protocol message whose destination address is the MLAG IP address configured on the second network device 200, the corresponding MAC address in the address mapping table is the MLAG MAC address configured on the second network device 200, and the MLAG MAC address is used as the destination MAC address of the protocol message. The protocol message may be an OSPF (Open Shortest Path First) protocol message, or other dynamic routing protocol messages, such as an ISIS (Intermediate System to Intermediate System) protocol message, a BGP (Border Gateway Protocol) protocol message, and the like.
[0071] In this embodiment, since the messages are load-balanced between the first network device 100 and the second network device 200, the data messages and protocol messages sent by the access device 300 may be received by the first network device 100 or the second network device 200. For example, when a protocol message to be sent to the first network device 100 is sent through the aggregation group, it may actually be sent to the second network device 200 or the first network device 100.
[0072] Step S602: Obtain the destination MAC address of the message to be forwarded.
[0073] In this embodiment, the first network device 100 receives the message to be forwarded sent by the access device 300, and can obtain the destination MAC address from the message to be forwarded.
[0074] Step S603: If the destination MAC address is the interface MAC address, local layer 3 forwarding is performed on the message to be forwarded.
[0075] In this embodiment, when the message to be forwarded is a data message, no matter whether the first network device 100 or the second network device 200 receives the message to be forwarded, it will be found that the destination MAC address of the message to be forwarded is the interface MAC address configured on the access interface of the local device. Therefore, the message to be forwarded can be directly forwarded locally at Layer 3, and the local route is searched to send the message to be forwarded, instead of being sent to the second network device 200 through the Peer-Link link, and the bandwidth of the Peer-Link link will not be occupied.
[0076] Step S604: If the destination MAC address is the MLAGMAC address of the second network device, the message to be forwarded is forwarded via the Peer-Link link between the second network device.
[0077] In this embodiment, when the message to be forwarded is a protocol message, assuming that the access device is to send the protocol message to the second network device 200, the destination MAC address of the message to be forwarded is the MLAGMAC address configured on the access interface of the second network device 200. However, the message to be forwarded is actually sent to the first network device 100. The first network device 100 finds that the destination MAC address of the message to be forwarded is the MLAGMAC address of the second network device 200 (the peer device), and then forwards the message to be forwarded to the second network device 200 through the Peer-Link link between the first network device 100 and the second network device 200. That is, even if the protocol message that should be sent to the second network device 200 is mistakenly sent to the first network device 100, it can reach the second network device 200 through Layer 2 forwarding, so that the protocol message can interact normally, there is no need to identify the protocol message, the processing overhead of the device will not be increased, and the forwarding efficiency of the data message will not be affected.
[0078] It can be seen that in the message forwarding method provided by the embodiment of the present invention, the first network device receives the message to be forwarded sent by the access device; obtains the destination MAC address of the message to be forwarded; if the destination MAC address is the interface MAC address, then the message to be forwarded is forwarded locally at Layer 3; if the destination MAC address is the MLAG MAC address of the second network device, then the message to be forwarded is forwarded via the Peer-Link link between the second network device. Since the interface IP address and interface MAC address configured on the access interface of the first network device and the second network device are the same, and the configured MLAG IP address and MLAG MAC address are different, the first network device and the second network device can directly perform local Layer 3 forwarding on the received data message, realizing load sharing while avoiding occupying the bandwidth of the Peer-Link link; and even if the protocol message is mistakenly sent to the first network device, it can reach the second network device through Layer 2 forwarding, without the need to identify and specially process the protocol message, and without adding additional processing to the forwarding process, it will not increase the processing overhead of the device, and will not affect the forwarding efficiency of the data message.
[0079] In one embodiment, the first network device 100 and the second network device 200 can sense the MLAG MAC address of the opposite device, and then install the corresponding forwarding table entry in the Layer 2 forwarding table, and the forwarding port corresponding to the MLAG MAC address of the opposite device in the forwarding table entry is the Peer-Link port. For example, the Layer 2 forwarding table of the first network device 100 will record the forwarding table entry corresponding to the MLAGMAC address of the second network device 200, and the forwarding port in the forwarding table entry corresponding to the MLAGMAC address of the second network device 200 is the Peer-Link port of the first network device 100; the Layer 2 forwarding table of the second network device 200 will record the forwarding table entry corresponding to the MLAGMAC address of the first network device 100, and the forwarding port in the forwarding table entry corresponding to the MLAGMAC address of the first network device 100 is the Peer-Link port of the second network device 200. Based on this, the above step S204 may specifically include:
[0080] If the destination MAC address is the MLAGMAC address of the second network device, the forwarding table entry corresponding to the MLAGMAC address of the second network device is searched in the Layer 2 forwarding table, and the message to be forwarded is forwarded through the forwarding port in the forwarding table entry; wherein, the forwarding table entry corresponding to the MLAGMAC address of the second network device is created by the first network device after sensing the MLAGMAC address of the second network device; and the forwarding port in the forwarding table entry corresponding to the MLAGMAC address of the second network device is the Peer-Link port on the first network device.
[0081] In this embodiment, after the first access interface of the first network device 100 receives the message to be forwarded, it is found that the destination MAC address is the MLAGMAC address of the second access interface of the second network device 200, rather than the MLAGMAC address of the first access interface of the first network device 100 (that is, not the MAC address of the local device), and Layer 2 forwarding will be performed. Based on the MLAGMAC address of the second access interface of the second network device 200, the Layer 2 forwarding table is searched, and the forwarding port in the matched forwarding table entry is the Peer-Link port on the first network device 100. The message to be forwarded is forwarded through the corresponding forwarding port, thereby achieving the sending of the message to be forwarded to the second network device 200 through the Peer-Link link between the first network device 200 and the second network device 200.
[0082] It can be seen that the first network device can forward the protocol message whose destination MAC address is not the MAC address of the local device according to the normal Layer 2 forwarding logic, without identifying and specially processing the protocol message, without adding additional processing to the forwarding process, will not increase the processing overhead of the device, and will not affect the processing efficiency of the message.
[0083] In one implementation, in order to ensure that the access device can efficiently and accurately forward messages, the access device can pre-generate a mapping relationship between IP addresses and MAC addresses (i.e., an address mapping table) so that the access device 300 can quickly determine the destination MAC address corresponding to the message when sending the message. Figure 7 Before the above step S201, the message forwarding method may further include:
[0084] Step S701: Establish a neighbor relationship with an access device according to the MLAG IP address of the first network device.
[0085] In this embodiment, the first network device 100 and the second network device 200 respectively use different MLAG IP addresses to establish a neighbor relationship based on a dynamic routing protocol with the access device 300, that is, the first network device 100 establishes a neighbor relationship with the access device 300 according to the MLAG IP address of the first access interface of the first network device 100, and the second network device 200 establishes a neighbor relationship with the access device 300 according to the MLAG IP address on the second access interface of the second network device 200. Therefore, there will be two neighbors on the access device 300, namely the first network device 100 and the second network device 200.
[0086] Step S702: Send a routing advertisement message to the access device; the routing advertisement message is used to instruct the access device to set the next hop address of the route to the interface IP address.
[0087] In this embodiment, after the first network device 100 establishes a neighbor relationship with the access device 300, it will send a route advertisement message to the access device 300. The route advertisement message sent by the first network device 100 is used to inform the access device 300 to set the next hop address of the route to the interface IP address of the first access interface of the first network device 100. Similarly, after the second network device 200 establishes a neighbor relationship with the access device 300, it will also send a route advertisement message to the access device 300. The route advertisement message sent by the second network device 200 is used to inform the access device 300 to set the next hop address of the route to the interface IP address of the second access interface of the second network device 200. Since the interface IP addresses of the access interfaces of the first network device 100 and the second network device 200 of MLAG are the same, the route advertisement messages sent by the first network device 100 and the second network device 200 to the access device 300 carry the same interface IP address. In this way, the route calculated on the access device 300 has only one next-hop address, which is the same interface IP address configured on the access interfaces of the first network device 100 and the second network device 200.
[0088] Step S703, when receiving the first request message sent by the access device according to the interface IP address, generate a first response message according to the interface MAC address corresponding to the interface IP address, so that the access device records the correspondence between the interface IP address and the interface MAC address in the address mapping table according to the first response message.
[0089] In this embodiment, after obtaining the interface IP address announced by the first network device 100, the access device 300 will send a first request message to the first network device 100 (for example, it can be an ARP request message or an ND request message based on the interface IP address). After receiving the first request message, the first network device 100 responds using the interface MAC address configured on the access interface. After receiving the first response message, the access device 300 will add a corresponding table entry (for example, an ARP or ND table entry) to the address mapping table to record the correspondence between the interface IP address and the interface MAC address.
[0090] Similarly, after obtaining the interface IP address announced by the second network device 200, the access device 300 will send a first request message to the second network device 200 (for example, it can be an ARP or ND request message based on the interface IP address). After receiving the first request message, the second network device 200 will respond using the interface MAC address configured on the access interface. After receiving the first response message, the access device 300 will add a corresponding table entry (for example, an ARP or ND table entry) to the address mapping table to record the correspondence between the interface IP address and the interface MAC address.
[0091] Step S704, when receiving the second request message sent by the access device according to the MLAG IP address of the first network device, a second response message is generated according to the MLAGMAC address corresponding to the MLAG IP address of the first network device, so that the access device records the correspondence between the MLAG IP address and the MLAGMAC address of the first network device in the address mapping table according to the second response message.
[0092] In this embodiment, after the access device 300 establishes a neighbor relationship with the first network device 100 and the second network device 200, the MLAG IP addresses configured on the access interfaces of the first network device 100 and the second network device 200 can be obtained respectively, and a second request message (for example, an ARP or ND request message based on the MLAG IP address) can be sent to the first network device 100 and the second network device 200 respectively. After receiving the second request message, the first network device 100 and the second network device 200 respond using the MLAGMAC address of their respective access interfaces. After receiving the second response message from the first network device 100 and the second network device 200, the access device 300 adds a corresponding entry (for example, an ARP or ND entry) in the address mapping table to record the correspondence between the MLAG IP address and the MLAGMAC address.
[0093] Next, combine Figure 8 The implementation process of the message forwarding method provided in the embodiment of the present invention is exemplarily described. Figure 8 , Device 1 is the MLAG master device (for example, the first network device 100 mentioned above), Device 2 is the MLAG slave device (for example, the second network device 200 mentioned above), and the access interfaces of the MLAG master and slave devices are configured with the same interface IP address (100.0.0.1) and interface MAC address (aaa). Figure 8 This example uses an IPv4 network. If it is an IPv6 network, the interface IP address can be configured as the same IPv6 address.
[0094] Different MLAG IP addresses and MLAG MAC addresses (100.0.0.3 / ccc, 100.0.0.4 / ddd) are configured on the access interfaces of the MLAG master and slave devices respectively. Figure 8 The IPv4 network is taken as an example. If it is an IPv6 network, the MLAG IP address is configured as a different IPv6 address. The MLAG MAC address can be manually specified, or the system MAC address of the device can be used (the system MAC of each device is different), or other methods can be used, as long as the MLAG MAC addresses of the MLAG master and slave devices are different.
[0095] The MLAG master and slave devices sense the MLAG MAC address of the peer device and install the corresponding Layer 2 forwarding table entry. The forwarding port is the Peer-Link port. The MLAG MAC address ccc of the MLAG master device corresponds to forwarding port 2 (Peer-Link port of Device 2), and the MLAG MAC address ddd of the MLAG slave device corresponds to forwarding port 1 (Peer-Link port of Device 1). The MLAG master and slave devices can sense each other by manual designation or mutual synchronization. The specific method is not limited.
[0096] The MLAG master and slave devices use their respective MLAG IP addresses to establish OSPF neighbors with access devices. The source address for establishing neighbors (i.e., the MLAG IP addresses of the MLAG master and slave devices) can be manually specified. It should be noted that this example uses the OSPF protocol as an example, and is also applicable to other dynamic routing protocols, such as ISIS, BGP, etc.
[0097] The MLAG master and slave devices advertise routes to the access devices based on the OSPF protocol, informing the access devices to set the next hop address of the route to the interface IP address. It should be noted that this example uses the OSPF protocol as an example, which is also applicable to other dynamic routing protocols, such as ISIS and BGP. The next hop address of the route needs to be manually specified, and there are many ways to advertise the next hop. For example, OSPF can carry it through the transit link data of router-lsa, BGP can carry it through the next hop attribute, and the control message of the dynamic routing protocol can also be extended to carry the next hop.
[0098] The MLAG master and slave devices respond to the ARP request for the interface IP address sent by the access device with the interface MAC address, and respond to the ARP request for the MLAG IP address sent by the access device with the MLAG MAC address. Figure 8 Taking IPv4 network as an example, if it is IPv6 network, the access device will send ND request, and the MLAG master and slave devices will respond to the ND request of the interface IP address with the interface MAC address; and respond to the ND request of the MLAG IP address with the MLAG MAC address. The access device generates the corresponding ARP or ND table entry based on the interface MAC address and MLAG MAC address responded by the MLAG master and slave devices.
[0099] Although there are two OSPF neighbors on the access device, the route will not form a load. There is only one next-hop address 100.0.0.1. In the ARP table, the MAC address corresponding to 100.0.0.1 is aaa, the MAC address corresponding to 100.0.0.3 is ccc, and the MAC address corresponding to 100.0.0.4 is ddd. Figure 8 The IPv4 network is taken as an example. If it is an IPv6 network, the next hop is an IPv6 address, and there is a corresponding entry in the ND table. Here, the OSPF protocol is taken as an example, and it is also applicable to other dynamic routing protocols, such as ISIS and BGP protocols.
[0100] The data packets sent by the access device will only be routed to a next-hop address of 100.0.0.1. The access device searches the ARP table for the corresponding MAC address aaa and uses it as the destination MAC address of the packet. Regardless of whether the aggregation group actually sends the packet to Device1 or Device2, when it reaches Device1 / Device2, it finds that the destination MAC address of the packet is aaa, which is the MAC address of the local device. It will then perform Layer 3 forwarding, search for a route and send the packet, and will not forward it through the Peer-Link link. Figure 8 This is an example of an IPv4 network. If it is an IPv6 network, the next hop is an IPv6 address, and the corresponding MAC address is found in the ND table.
[0101] For the OSPF protocol message that the access device wants to send to Device1 with a destination address of 100.0.0.3, the access device searches the ARP table for the corresponding MAC address ccc and uses it as the destination MAC address of the message. If the message is actually sent to Device2 when it is sent through the aggregation group, Device2 finds that the destination MAC address of the message is ccc, and searches the Layer 2 forwarding table for the corresponding forwarding port, which is forwarding port 2. Finally, it forwards the message to Device1 through the Peer-Link link. Figure 8 The IPv4 network is taken as an example. If it is an IPv6 network, the destination address of the OSPF protocol message is the IPv6 address, and the corresponding MAC address is found in the ND table. Here, the OSPF protocol is taken as an example, which is also applicable to other dynamic routing protocols, such as ISIS, BGP, etc.
[0102] Please refer to Fig. 9 , is a flow chart of a message forwarding method applied to access device 300 provided in an embodiment of the present invention. It should be noted that the message forwarding method in the embodiment of the present invention is not based on Fig. 9It should be understood that in other embodiments, the order of some steps in the message forwarding method of the embodiment of the present invention can be interchanged according to actual needs, or some steps can be omitted or deleted. Fig. 9 The specific process shown is described in detail.
[0103] Step S901, when the message to be forwarded is a data message and the next hop address of the data message is the interface IP address, the destination MAC address of the message to be forwarded is set to the interface MAC address; when the message to be forwarded is a protocol message and the destination address of the protocol message is the MLAG IP address of any network device in the MLAG system, the destination MAC address of the message to be forwarded is set to the MLAGMAC address corresponding to the MLAG IP address of any network device.
[0104] In this embodiment, since the interface IP address and interface MAC address configured on the access interface of the first network device and the second network device that are connected to the access device for communication are the same, when the first network device 100 and the second network device 200 perform route announcement to the access device 300, the next hop address of the route will be specified as the interface IP address in the route announcement message. In this way, when the access device sends a data message, the route found has only one next hop address, that is, the interface IP address, and the interface MAC address corresponding to the interface IP address is used as the destination MAC address of the data message. When the access device 300 is to send a protocol message whose destination address is the MLAG IP address configured on the first network device 100, the MLAGMAC address corresponding to the MLAG IP address configured on the first network device 100 is used as the destination MAC address of the protocol message; similarly, when the access device 300 is to send a protocol message whose destination address is the MLAG IP address configured on the second network device 200, the MLAGMAC address configured on the second network device 200 is used as the destination MAC address of the protocol message.
[0105] Step S902: Send the message to be forwarded to the first network device or the second network device.
[0106] Among them, when the first network device or the second network device receives a data message to be forwarded, it performs local three-layer forwarding on the message to be forwarded; when the first network device receives a protocol message to be forwarded and the destination MAC address of the protocol message is the MLAGMAC address of the second network device, it forwards the message to be forwarded through the Peer-Link link between the first network device and the second network device; when the second network device receives a protocol message to be forwarded and the destination MAC address of the protocol message is the MLAGMAC address of the first network device, it forwards the message to be forwarded through the Peer-Link link between the first network device and the first network device.
[0107] In this embodiment, since the message will be load-shared between the first network device 100 and the second network device 200, the message to be forwarded may be sent to the first network device 100 or the second network device 200. When the message to be forwarded is a data message, no matter whether the first network device 100 or the second network device 200 receives the message to be forwarded, it will be found that the destination MAC address of the message to be forwarded is the interface MAC address of the local device, and then the message to be forwarded is forwarded locally at Layer 3, and the local route is searched to send the message to be forwarded, but it will not be sent to the opposite device through the Peer-Link link, and the bandwidth of the Peer-Link link will not be occupied.
[0108] When the message to be forwarded is a protocol message, assuming that the access device 300 is to send the protocol message to the second network device 200, the destination MAC address of the message to be forwarded is the MLAGMAC address of the second network device 200. However, the message to be forwarded is actually sent to the first network device 100, and the first network device 100 will find that the destination MAC address of the message to be forwarded is the MLAGMAC address of the peer device (i.e., the second network device 200), and then forward the message to be forwarded to the second network device 200 through the Peer-Link link between the first network device 100 and the second network device 200. Therefore, even if the protocol message is mistakenly sent to the first network device 100, it can reach the second network device 200 through Layer 2 forwarding, so that the protocol message can interact normally, there is no need to identify the protocol message, the processing overhead of the device will not be increased, and the forwarding efficiency of the data message will not be affected.
[0109] Similarly, if the access device 300 is to send a protocol message to the first network device 100, the destination MAC address of the message to be forwarded is the MLAGMAC address of the first network device 100. However, the message to be forwarded is actually sent to the second network device 200. The second network device 200 will find that the destination MAC address of the message to be forwarded is the MLAGMAC address of the peer device (i.e., the first network device 100), and then forward the message to be forwarded to the first network device 100 through the Peer-Link link between the second network device 100 and the first network device 100. Therefore, even if the protocol message is mistakenly sent to the second network device 200, it can reach the first network device 100 through Layer 2 forwarding, so that the protocol message can interact normally, there is no need to identify the protocol message, the processing overhead of the device will not be increased, and the forwarding efficiency of the data message will not be affected.
[0110] In one embodiment, the access device stores an address mapping table, which records the correspondence between IP addresses and MAC addresses; in the above step S901, before setting the destination MAC address of the message to be forwarded to the interface MAC address, the message forwarding method may also include: searching the address mapping table for the interface MAC address corresponding to the interface IP address; before setting the destination MAC address of the message to be forwarded to the MLAGMAC address corresponding to the MLAG IP address, the message forwarding method may also include: searching the address mapping table for the MLAGMAC address corresponding to the MLAG IP address.
[0111] In this embodiment, when the access device 300 sends a data message, when the next hop address found is the interface IP address, the MAC address corresponding to the interface IP address, that is, the interface MAC address, can be found in the address mapping table, and then the destination MAC address of the data message is set to the interface MAC address. When the access device 300 sends a protocol message, when the destination address is the MLAG IP address configured on the first network device, the MAC address corresponding to the MLAG IP address configured on the first network device 100 can be found in the address mapping table, that is, the MLAG MAC address configured on the first network device 100, and then the destination MAC address of the protocol message is set to the MLAG MAC address configured on the first network device 100. Similarly, when the destination address is the MLAG IP address configured on the second network device 200, the MAC address corresponding to the MLAG IP address configured on the second network device 200 can be found in the address mapping table, that is, the MLAG MAC address configured on the second network device 200, and then the destination MAC address of the protocol message is set to the MLAG MAC address configured on the second network device 200.
[0112] In one embodiment, see Fig.10 , the message forwarding method may further include:
[0113] Step S1001, after establishing a neighbor relationship with the first network device, send a second request message to the first network device according to the obtained MLAGIP address of the first network device, receive a second response message generated by the first network device according to the second request message, and record the correspondence between the MLAG IP address and the MLAGMAC address of the first network device in the address mapping table according to the MLAGMAC address in the second response message.
[0114] In this embodiment, the first network device 100 and the second network device 200 respectively use different MLAG IP addresses to establish a neighbor relationship based on a dynamic routing protocol with the access device 300. After the neighbor relationship is established, the access device 300 can respectively obtain the MLAG IP addresses of the first network device 100 and the second network device 200, and respectively send a second request message to the first network device 100 and the second network device 200. After receiving the second request message, the first network device 100 and the second network device 200 respond using the MLAGMAC addresses configured on their respective access interfaces. After receiving the second response messages from the first network device 100 and the second network device 200, the access device 300 adds a corresponding entry (for example, an ARP or ND entry) in the address mapping table to record the corresponding relationship between the MLAG IP address and the MLAGMAC address.
[0115] Step S1002, after receiving the routing announcement message sent by the first network device, set the next hop address of the route to the interface IP address of the first network device, send a first request message to the first network device according to the interface IP address of the first network device, receive the first response message generated by the first network device according to the first request message, and record the correspondence between the interface IP address and the interface MAC address in the address mapping table according to the interface MAC address in the first response message.
[0116] In this embodiment, after the first network device 100 establishes a neighbor relationship with the access device, it will send a route advertisement message to the access device 300 to instruct the access device 300 to set the next hop address of the route to the interface IP address of the first network device 100. Similarly, after the second network device 200 establishes a neighbor relationship with the access device 300, it will also send a route advertisement message to the access device 300. The route advertisement message sent by the second network device 200 is used to inform the access device 300 to set the next hop address of the route to the interface IP address of the second network device 200. Since the interface IP address configured on the access interface of the first network device 100 and the second network device 200 is the same, the route advertisement message sent by the first network device 100 and the second network device 200 to the access device 300 carries the same interface IP address, so that the route calculated on the access device 300 has only one next hop address, which is the same interface IP address configured on the access interface of the first network device 100 and the second network device 200.
[0117] After obtaining the interface IP address announced by the first network device 100, the access device 300 will send a first request message to the first network device 100. After receiving the first request message, the first network device 100 will respond using the interface MAC address configured on the access interface. After receiving the first response message, the access device 300 will add a corresponding table entry (such as an ARP or ND table entry) to the address mapping table to record the correspondence between the interface IP address and the interface MAC address.
[0118] Similarly, after obtaining the interface IP address announced by the second network device 200, the access device 300 will send a first request message to the second network device 200. After receiving the first request message, the second network device 200 will respond using the interface MAC address configured on the access interface. After receiving the first response message, the access device 300 will add a corresponding table entry (for example, an ARP or ND table entry) to the address mapping table to record the correspondence between the interface IP address and the interface MAC address.
[0119] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing a message forwarding device is provided below. Fig.11 , is a functional module diagram of a message forwarding device applied to the first network device 100 provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the message forwarding device provided in this embodiment are the same as those of the above embodiment. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiment. The message forwarding device includes a first transceiver module 610 and an acquisition module 620.
[0120] The first transceiver module 610 is configured to receive a message to be forwarded sent by an access device.
[0121] Among them, when the message to be forwarded is a data message and the next hop address of the data message is the interface IP address, the access device sets the destination MAC address of the message to be forwarded to the interface MAC address; when the message to be forwarded is a protocol message and the destination address of the protocol message is the MLAG IP address of any network device in the MLAG system, the destination MAC address of the message to be forwarded is set to the MLAGMAC address corresponding to the MLAG IP address of any network device.
[0122] It can be understood that the first transceiver module 610 can execute the above step S601.
[0123] The acquisition module 620 is used to acquire the destination MAC address of the message to be forwarded.
[0124] It can be understood that the acquisition module 620 can execute the above step S602.
[0125] The first transceiver module 610 is also used to perform local layer-3 forwarding on the message to be forwarded if the destination MAC address is the interface MAC address; if the destination MAC address is the MLAGMAC address of the second network device, forward the message to be forwarded through the Peer-Link link between the second network device.
[0126] It can be understood that the first transceiver module 610 can also execute the above step S603.
[0127] Optionally, the first transceiver module 610 is specifically used to search for a forwarding table entry corresponding to the MLAGMAC address of the second network device in the Layer 2 forwarding table if the destination MAC address is the MLAGMAC address of the second network device, and forward the message to be forwarded through the forwarding port in the forwarding table entry; wherein the forwarding table entry corresponding to the MLAGMAC address of the second network device is created by the first network device after sensing the MLAGMAC address of the second network device; and the forwarding port in the forwarding table entry corresponding to the MLAGMAC address of the second network device is the Peer-Link port on the first network device.
[0128] Optionally, the message forwarding device may also include a response module, and the first transceiver module 610 is further used to establish a neighbor relationship with the access device according to the MLAG IP address of the first network device; send a route announcement message to the access device; the route announcement message is used to instruct the access device to set the next hop address of the route to the interface IP address. The response module is used to generate a first response message according to the interface MAC address corresponding to the interface IP address when receiving a first request message sent by the access device according to the interface IP address, so that the access device records the corresponding relationship between the interface IP address and the interface MAC address in the address mapping table according to the first response message; when receiving a second request message sent by the access device according to the MLAG IP address of the first network device, generate a second response message according to the MLAGMAC address corresponding to the MLAG IP address of the first network device, so that the access device records the corresponding relationship between the MLAG IP address and the MLAGMAC address of the first network device in the address mapping table according to the second response message.
[0129] It can be understood that the first transceiver module 610 can also execute the above steps S701 and S702; the response module can execute the above steps S703 and S704.
[0130] Please refer to Fig.12, which is a functional module diagram of a message forwarding device applied to an access device 300 provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the message forwarding device provided in this embodiment are the same as those of the above embodiment. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiment. The message forwarding device includes a processing module 710 and a second transceiver module 720.
[0131] The processing module 710 is used to set the destination MAC address of the message to be forwarded to the interface MAC address when the message to be forwarded is a data message and the next hop address of the data message is the interface IP address; when the message to be forwarded is a protocol message and the destination address of the protocol message is the MLAG IP address of any network device in the MLAG system, set the destination MAC address of the message to be forwarded to the MLAGMAC address corresponding to the MLAG IP address of any network device.
[0132] It can be understood that the processing module 710 can execute the above step S901.
[0133] The second transceiver module 720 is used to send the message to be forwarded to the first network device or the second network device.
[0134] Among them, when the first network device or the second network device receives a data message to be forwarded, it performs local three-layer forwarding on the message to be forwarded; when the first network device receives a protocol message to be forwarded and the destination MAC address of the protocol message is the MLAGMAC address of the second network device, it forwards the message to be forwarded through the Peer-Link link between the first network device and the second network device; when the second network device receives a protocol message to be forwarded and the destination MAC address of the protocol message is the MLAGMAC address of the first network device, it forwards the message to be forwarded through the Peer-Link link between the first network device and the first network device.
[0135] It can be understood that the second transceiver module 720 can execute the above step S902.
[0136] Optionally, the access device stores an address mapping table, which records the correspondence between IP addresses and MAC addresses; the processing module 710 is also used to search for the interface MAC address corresponding to the interface IP address from the address mapping table; before setting the destination MAC address of the message to be forwarded to the MLAGMAC address corresponding to the MLAG IP address, the method also includes: searching for the MLAGMAC address corresponding to the MLAG IP address from the address mapping table.
[0137] Optionally, the second transceiver module 720 is also used to, after establishing a neighbor relationship with the first network device, send a second request message to the first network device according to the acquired MLAG IP address of the first network device, and receive a second response message generated by the first network device according to the second request message; the processing module 710 is also used to record the correspondence between the MLAG IP address and the MLAGMAC address of the first network device in the address mapping table according to the MLAGMAC address in the second response message.
[0138] The second transceiver module 720 is also used to set the next hop address of the route to the interface IP address of the first network device after receiving the route announcement message sent by the first network device, send a first request message to the first network device according to the interface IP address of the first network device, and receive a first response message generated by the first network device according to the first request message; the processing module 710 is also used to record the correspondence between the interface IP address and the interface MAC address in the address mapping table according to the interface MAC address in the first response message.
[0139] It can be understood that the processing module 710 and the second transceiver module 720 can also perform the above steps S1001 and S1002.
[0140] Please refer to Fig.13 , is a block diagram of an electronic device that can implement the above-mentioned first network device 100, second network device 200 and access device 300 provided by an embodiment of the present invention. The electronic device includes a memory 110, a processor 120 and a communication module 130. The memory 110, the processor 120 and the communication module 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0141] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.
[0142] The processor 120 is used to read / write data or programs stored in the memory 110 and execute corresponding functions. For example, when the computer program stored in the memory 110 is executed by the processor 120, the message forwarding method disclosed in the above embodiments can be implemented.
[0143] The communication module 130 is used to establish a communication connection between the electronic device and other devices through a network, and to send and receive data through the network.
[0144] It should be understood that Fig.13 The structure shown is only a schematic diagram of the structure of the electronic device. The electronic device may also include Fig.13 More or fewer components as shown, or with Fig.13 Different configurations are shown. Fig.13 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0145] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by the processor 120, the message forwarding method disclosed in the above embodiments is implemented.
[0146] In summary, the message forwarding method, device, electronic device and computer-readable storage medium provided by the embodiments of the present invention realize load sharing of messages between two network devices in the MLAG system, fully utilize the link bandwidth, and do not occupy the bandwidth of the Peer-Link link. At the same time, whether it is a data message or a protocol message, it is forwarded according to the normal three-layer forwarding or two-layer forwarding logic, and there is no need to identify and specially process the protocol message, no additional processing is added to the forwarding process, the processing overhead of the device will not be increased, the processing efficiency of the message will not be affected, and it is also applicable to all dynamic routing protocols.
[0147] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0148] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0149] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0150] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A message forwarding method, characterized in that: Applied to a first network device, the first network device and the second network device form an inter-device link aggregation group MLAG system, and the access device dual-homedly accesses the MLAG system through a first access interface of the first network device and a second access interface of the second network device; the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAGMAC addresses; the method comprises: Receiving a message to be forwarded sent by the access device; Obtaining the destination MAC address of the message to be forwarded; If the destination MAC address is the interface MAC address, local layer 3 forwarding is performed on the message to be forwarded; If the destination MAC address is the MLAGMAC address of the second network device, the message to be forwarded is forwarded via the Peer-Link link between the second network device.
2. The message forwarding method according to claim 1, characterized in that: If the destination MAC address is the MLAGMAC address of the second network device, forwarding the message to be forwarded through the Peer-Link link between the second network device includes: If the destination MAC address is the MLAGMAC address of the second network device, the forwarding table entry corresponding to the MLAGMAC address of the second network device is searched in the Layer 2 forwarding table, and the message to be forwarded is forwarded through the forwarding port in the forwarding table entry; wherein, the forwarding table entry corresponding to the MLAGMAC address of the second network device is created by the first network device after sensing the MLAGMAC address of the second network device; and the forwarding port in the forwarding table entry corresponding to the MLAGMAC address of the second network device is the Peer-Link port on the first network device.
3. The message forwarding method according to claim 1, characterized in that: Before receiving the message to be forwarded sent by the access device, the method further includes: Establishing a neighbor relationship with the access device according to the MLAG IP address of the first network device; Sending a routing advertisement message to the access device; the routing advertisement message is used to instruct the access device to set the next hop address of the route to the interface IP address; Upon receiving a first request message sent by the access device according to the interface IP address, generating a first response message according to the interface MAC address corresponding to the interface IP address, so that the access device records the correspondence between the interface IP address and the interface MAC address in the address mapping table according to the first response message; When receiving a second request message sent by the access device based on the MLAG IP address of the first network device, a second response message is generated based on the MLAGMAC address corresponding to the MLAG IP address of the first network device, so that the access device records the correspondence between the MLAG IP address and the MLAGMAC address of the first network device in the address mapping table based on the second response message.
4. A message forwarding method, characterized in that: Applied to an access device, the access device dual-homedly accesses an inter-device link aggregation group MLAG system composed of the first network device and the second network device through a first access interface of a first network device and a second access interface of a second network device, the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAGMAC addresses; the method comprises: When the message to be forwarded is a data message and the next hop address of the data message is the interface IP address, setting the destination MAC address of the message to be forwarded to the interface MAC address; When the message to be forwarded is a protocol message and the destination address of the protocol message is the MLAG IP address of any network device in the MLAG system, setting the destination MAC address of the message to be forwarded to the MLAG MAC address corresponding to the MLAG IP address of any network device; The message to be forwarded is sent to the first network device or the second network device.
5. The message forwarding method according to claim 4, characterized in that: The access device stores an address mapping table, and the address mapping table records the correspondence between the IP address and the MAC address; Before setting the destination MAC address of the message to be forwarded to the interface MAC address, the method further comprises: searching the interface MAC address corresponding to the interface IP address from the address mapping table; Before setting the destination MAC address of the message to be forwarded as the MLAGMAC address corresponding to the MLAG IP address, the method further includes: searching the address mapping table for the MLAGMAC address corresponding to the MLAG IP address.
6. The message forwarding method according to claim 5, characterized in that: The method further comprises: After establishing a neighbor relationship with the first network device, sending a second request message to the first network device according to the acquired MLAG IP address of the first network device, receiving a second response message generated by the first network device according to the second request message, and recording the correspondence between the MLAG IP address and the MLAGMAC address of the first network device in the address mapping table according to the MLAGMAC address in the second response message; After receiving the routing announcement message sent by the first network device, the next hop address of the route is set to the interface IP address of the first network device, a first request message is sent to the first network device according to the interface IP address of the first network device, a first response message generated by the first network device according to the first request message is received, and the correspondence between the interface IP address and the interface MAC address is recorded in the address mapping table according to the interface MAC address in the first response message.
7. A message forwarding device, characterized in that: Applied to a first network device, the first network device and the second network device form an inter-device link aggregation group MLAG system, and the access device dual-homedly accesses the MLAG system through a first access interface of the first network device and a second access interface of the second network device; the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAGMAC addresses; the device comprises: A first transceiver module, used to receive a message to be forwarded sent by the access device; An acquisition module, used to acquire the destination MAC address of the message to be forwarded; The first transceiver module is also used to perform local layer-3 forwarding on the message to be forwarded if the destination MAC address is the interface MAC address; if the destination MAC address is the MLAGMAC address of the second network device, forward the message to be forwarded via the Peer-Link link between the second network device.
8. A message forwarding device, characterized in that: Applied to an access device, the access device dual-homedly accesses an inter-device link aggregation group MLAG system composed of the first network device and the second network device through a first access interface of a first network device and a second access interface of a second network device, the first access interface and the second access interface are configured with the same interface IP address and interface MAC address, and are configured with different MLAG IP addresses and MLAG MAC addresses; the device comprises: a processing module, configured to set the destination MAC address of the message to be forwarded to the interface MAC address when the message to be forwarded is a data message and the next hop address of the data message is the interface IP address; and to set the destination MAC address of the message to be forwarded to the MLAG MAC address corresponding to the MLAG IP address of any network device in the MLAG system when the message to be forwarded is a protocol message and the destination address of the protocol message is the MLAG IP address of any network device in the MLAG system; The second transceiver module is used to send the message to be forwarded to the first network device or the second network device.
9. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the message forwarding method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the message forwarding method according to any one of claims 1 to 6 are implemented.