MAC address learning method, device, electronic device and readable storage medium

By setting the server in the de-stacked network and using the BGP and LLDP protocols to enable multiple access devices to learn the server MAC address, the problem of insufficient bandwidth utilization between the server and multiple access devices is solved, and the effect of traffic load balancing is achieved.

CN115766556BActive Publication Date: 2025-04-25MAIPU COMM TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211104625.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-09
Publication Date
2025-04-25
Estimated Expiration
2042-09-09

AI Technical Summary

Technical Problem

In de-stack network application scenarios, the server can only send messages to one access device of multiple access devices in the stacking system, resulting in the inability to fully utilize the network bandwidth between the server and multiple access devices.

Method used

By setting a server identifier for the server, the second access device uses the acquired server MAC address and server identifier to fill the server MAC address and server identifier in the BGP message, and sends the BGP message to the first access device through the core network. When the first access device obtains the server identification and the server identification in the BGP packet sent by the server, it updates the server MAC address to the MAC address table to learn the server MAC address.

Benefits of technology

This allows the server to send messages to multiple access devices in the stacking system at the same time, making full use of the network bandwidth between the server and access devices, and achieving load balancing of traffic between access devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115766556B_ABST
    Figure CN115766556B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of network communication technology, and provides a MAC address learning method, device, electronic device and readable storage medium. The method applied to a first access device includes: receiving a Border Gateway Protocol BGP message forwarded by a second access device through a core network, wherein the extended attribute of the BGP message carries a server identifier and a server MAC address; receiving a Link Layer Discovery Protocol LLDP message sent by a server, wherein the extended attribute of the LLDP message carries a server identifier; if the server identifier in the BGP message is the same as the server identifier in the LLDP message, then updating the server MAC address to the MAC address table of the device, so that the device learns the server MAC address. The present invention enables the server to send messages to multiple access devices in a stacking system at the same time, so as to fully utilize the network bandwidth between the server and the multiple access devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a MAC address learning method, device, electronic device and readable storage medium. Background Art

[0002] With the development of technologies such as big data, cloud computing, 5G, and artificial intelligence (AI), the network is required to have characteristics such as high reliability and scalability. As a result, the network form has also changed from single-home access to active-standby dual-home access, to stacking, and finally to de-stacking. In the de-stacking network application scenario, the server can only send messages to one access device among multiple access devices in the stacking system, resulting in the network bandwidth between the server and multiple access devices cannot be fully utilized. Summary of the invention

[0003] The purpose of the present invention is to provide a MAC address learning method, device, electronic device and readable storage medium, which can enable a server to simultaneously send messages to multiple access devices in a stacking system to fully utilize the network bandwidth between the server and the multiple access devices.

[0004] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:

[0005] In a first aspect, an embodiment of the present invention provides a MAC address learning method, which is applied to a first access device in a stacking system, wherein the stacking system further includes a second access device, wherein the first access device and the second access device are both communicatively connected to a server and a core network, and the method includes:

[0006] Receiving a Border Gateway Protocol (BGP) message forwarded by the second access device through the core network, wherein an extended attribute of the BGP message carries a server identifier and a server MAC address;

[0007] Receiving a Link Layer Discovery Protocol (LLDP) message sent by the server, wherein an extended attribute of the LLDP message carries a server identifier;

[0008] If the server identifier in the BGP message is the same as the server identifier in the LLDP message, the server MAC address is updated to the MAC address table of the local device, so that the local device learns the server MAC address.

[0009] Optionally, the step of updating the server MAC address to the MAC address table of the device includes:

[0010] Establishing a mapping relationship between the port receiving the LLDP message and the server MAC address;

[0011] The mapping relationship is updated to the MAC address table.

[0012] Optionally, the method further comprises:

[0013] If the server identifier in the BGP message is different from the server identifier in the LLDP message, the BGP message is ignored.

[0014] Optionally, the method further comprises:

[0015] The server identifier in the LLDP message is saved.

[0016] Optionally, the server identifier in the BGP message is obtained by the second access device from an extended attribute of the LLDP message sent by the server; the server MAC address in the BGP message is obtained by the second access device from an Address Resolution Protocol ARP message sent by the server.

[0017] In a second aspect, an embodiment of the present invention provides a MAC address learning method, which is applied to a server, wherein the server is communicatively connected to a first access device and a second access device in a stacking system, and the first access device and the second access device are communicatively connected to a core network, and the method includes:

[0018] A Link Layer Discovery Protocol (LLDP) message is sent to the first access device, wherein an extended attribute of the LLDP message carries a server identifier, so that when the first access device receives a Border Gateway Protocol (BGP) message forwarded by the second access device through the core network and determines that the server identifier in the BGP message is the same as the server identifier in the LLDP message, the server MAC address is updated to the MAC address table of the first access device, so that the first access device learns the server MAC address.

[0019] In a third aspect, an embodiment of the present invention provides a MAC address learning device, which is applied to a first access device in a stacking system, wherein the stacking system further includes a second access device, wherein the first access device and the second access device are both communicatively connected to a server and a core network, and the device includes:

[0020] A receiving module, configured to receive a Border Gateway Protocol (BGP) message forwarded by the second access device through the core network, wherein an extended attribute of the BGP message carries a server identifier and a server MAC address;

[0021] The receiving module is further used to receive a link layer discovery protocol LLDP message sent by the server, wherein the extended attribute of the LLDP message carries a server identifier;

[0022] A learning module is used to update the server MAC address to the MAC address table of the first access device if the server identifier in the BGP message is the same as the server identifier in the LLDP message, so that the first access device learns the server MAC address.

[0023] In a fourth aspect, an embodiment of the present invention provides a MAC address learning device, which is applied to a server, wherein the server is communicatively connected to a first access device and a second access device in a stacking system, and the first access device and the second access device are communicatively connected to a core network, and the device includes:

[0024] A sending module is used to send a Link Layer Discovery Protocol LLDP message to the first access device, wherein an extended attribute of the LLDP message carries a server identifier, so that when the first access device receives a Border Gateway Protocol BGP message forwarded by the second access device through the core network and determines that the server identifier in the BGP message is the same as the server identifier in the LLDP message, the server MAC address is updated to the MAC address table of the first access device, so that the first access device learns the server MAC address.

[0025] In a fifth aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory is used to store a program, and the processor is used to implement the MAC address learning method as described in the first aspect and / or the MAC address learning method as described in the second aspect when executing the program.

[0026] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the MAC address learning method as described in the first aspect and / or the MAC address learning method as described in the second aspect is implemented.

[0027] Compared with the prior art, the MAC address learning method, device, electronic device and readable storage medium provided in the embodiments of the present invention set a server identifier for the server, and the second access device uses the acquired server media access control address (Media Access Control Address, MAC address) and the server identifier to fill the server MAC address and the server identifier in the Border Gateway Protocol (BGP) message, and sends the BGP message to the first access device through the core network. When the first access device obtains the server identifier in the Link Layer Discovery Protocol (Link Layer Discovery Protocol, LLDP) message sent by the server and the server identifier in the BGP message is consistent, the server MAC address is updated to the MAC address table, thereby learning the server MAC address, and finally enabling the server to send messages to the first access device and the second access device at the same time, making full use of the network bandwidth between the server and the first access device and the second access device, and realizing load balancing of traffic between the first access device and the second access device. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] 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.

[0029] Figure 1 This is an example diagram of message forwarding in the prior art in the de-stacking scenario provided by this embodiment.

[0030] Figure 2 This is an example diagram of message forwarding in a stacking removal scenario provided by this embodiment.

[0031] Figure 3 An exemplary block diagram of an electronic device provided by an embodiment of the present invention.

[0032] Figure 4 An example of a process for a MAC address learning method applied to a first access device provided in an embodiment of the present invention Figure 1 .

[0033] Figure 5 An example of a process for a MAC address learning method applied to a first access device provided in an embodiment of the present invention Figure 2 .

[0034] Figure 6An example flowchart of a MAC address learning method applied to a server provided in an embodiment of the present invention.

[0035] Figure 7 A block diagram of a MAC address learning apparatus applied to a first access device provided by an embodiment of the present invention.

[0036] Figure 8 A block diagram of a MAC address learning device applied to a server provided in an embodiment of the present invention.

[0037] Icons: 10 - first access device; 20 - second access device; 30 - server; 40 - electronic device; 41 - processor; 42 - memory; 43 - bus; 44 - communication interface; 100 - MAC address learning device applied to the first access device; 110 - receiving module; 120 - learning module; 200 - MAC address learning device applied to the server; 210 - sending module. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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.

[0039] 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0041] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0042] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.

[0043] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0044] In the de-stacking application scenario, only one of the multiple access devices in the stacking system communicates with the server because only one access device can learn the MAC address of the server and then exchange messages with the server. Figure 1 , Figure 1 This is an example diagram of message forwarding in the prior art in the de-stacking scenario provided by this embodiment. Figure 1 The stacking system in the embodiment includes a first access device 10 and a second access device 20. The server 30 is configured with dual network cards set in convergence mode. The server 30 communicates with the first access device through one of the dual network cards and communicates with the second access device through the other network card in the dual network card. In the convergence mode, the Address Resolution Protocol (ARP) message sent by the server 30 will only be hashed to the root port in the two network cards for sending, that is, only the second access device 20 connected to the server 30 through the root port can receive the ARP message sent by the network card, and only the second access device 20 can learn the MAC address of the server 30. However, because the first access device 10 cannot receive the ARP message sent by the server 30, it cannot learn the MAC address of the server 30, resulting in that the traffic between the server 30 and the stacking system can only be sent and received through the second access device 20. In this way, the bandwidth between the server and the stacking system cannot be fully utilized.

[0045] In this embodiment, the first access device 10 and the second access device 20 may both be switches for implementing message forwarding between the server 30 and the core network.

[0046] The server 30 may be a physical computer device, or a virtual machine that can realize the same functions as the physical computer device, or a server cluster composed of multiple servers.

[0047] The functions of the core network are mainly to provide user connections, user management and business carrying, and to provide an interface to the external network as a bearer network.

[0048] However, in actual application scenarios, it is usually necessary to fully utilize the bandwidth between the server and the stacking system, and to form a load balance between the two access devices of the stacking system. The existing solution is to modify the LINUX kernel of the server. This implementation method, on the one hand, has a high technical threshold and requires technical personnel in this field to have a comprehensive and in-depth understanding of the LINUX kernel, and is cumbersome and complicated to implement. On the other hand, it will occupy additional server resources and affect server performance.

[0049] In view of this, the embodiment of the present invention provides a MAC address learning method, device, electronic device and readable storage medium, which can enable both access devices in the stacking system to learn the MAC address of the server 30, so that the traffic between the server and the stacking system can be sent and received simultaneously on the two access devices in the stacking system. The core idea is that the access device in the stacking system that can learn the MAC address of the server forwards the learned MAC address to another access device that cannot directly learn the MAC address of the server through the core network, and finally enables both access devices in the stacking system to know the MAC address of the server, thereby realizing the sending and receiving of messages between the two access devices and the server 30, which will be described in detail below.

[0050] Please refer to Figure 2 , Figure 2 This is an example diagram of message forwarding in a de-stacking scenario provided in this embodiment. Figure 2 The message forwarding is Figure 1 The equipment is improved on the basis of Figure 1On the basis of the connection method in, the following improvements are made: the first access device 10, the second access device 20 and the server 30 are also LLDP configured, so the server 30 can send LLDP messages to the first access device 10 and the second access device 20, and the first access device 10 and the second access device 20 also have BGP communication with the core network, so the first access device 10 and the second access device 20 can exchange BGP messages through the core network. In addition, the server 30 is configured with an identifier, which uniquely represents the server 30. The server 30 sends the identifier to the first access device 10 and the second access device 20 through the LLDP message. The server sends the server's MAC address to the second access device 20 through the ARP message. The second access device 20 sends a BGP message to the first access device 10 through the core network. The BGP message carries the server's identifier and the server's MAC address. Therefore, although the first access device 10 cannot receive the ARP message sent by the server 30, it can receive the server's MAC address sent by the second access device 20 through the core network. Therefore, the first access device 10 can also learn the server's MAC address, thereby realizing the sending and receiving of messages between the two access devices and the server 30.

[0051] It should be noted that Figure 2 This is just an example. In fact, the stacking system may include more than two access devices, that is, there may be multiple second access devices 20, and each second access device 20 can learn the MAC address of the server 30 using the MAC address learning method provided in this embodiment.

[0052] based on Figure 2 This embodiment provides a block diagram of an electronic device 40, please refer to Figure 3 , Figure 3 The electronic device 40 is a block diagram of an electronic device provided by an embodiment of the present invention. Figure 2 The first access device 10 in the embodiment may also be Figure 2 In the server 30 , the electronic device 40 includes a processor 41 , a memory 42 , a bus 43 and a communication interface 44 , and the processor 41 , the memory 42 , and the communication interface 44 are connected via the bus 43 .

[0053] The processor 41 may be an integrated circuit chip having signal processing capability. In the implementation process, each step of the MAC address learning method may be completed by an integrated logic circuit of hardware in the processor 41 or by instructions in the form of software. The processor 41 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0054] The memory 42 is used to store programs, such as the MAC address learning device applied to the first access device or the MAC address learning device applied to the server in the following embodiments. The MAC address learning device applied to the first access device or the MAC address learning device applied to the server includes at least one software function module that can be stored in the memory 42 in the form of software or firmware or fixed in the operating system (OS) of the electronic device 40. After receiving the execution instruction, the processor 41 executes the program to implement the MAC address learning method applied to the first access device or the MAC address learning method applied to the server disclosed in the above embodiments.

[0055] The electronic device 40 communicates with other devices via the communication interface 44 .

[0056] exist Figure 2 and Figure 3 Based on Figure 4 , Figure 4 An example of a process for a MAC address learning method applied to a first access device provided in an embodiment of the present invention Figure 1 , this method is applied to Figure 2 When the electronic device 40 is the first access device 10, the method is executed, and the method includes the following steps:

[0057] Step S100: receiving a Border Gateway Protocol (BGP) message forwarded by the second access device through the core network, wherein an extended attribute of the BGP message carries a server identifier and a server MAC address.

[0058] In this embodiment, the server identifier can be a system identifier that the network administrator configures on the server 30 to uniquely represent the server 30. The server 30 fills the server identifier into the type-length-value (TLV) extension field of the LLDP message. The second access device 20 can obtain the server identifier by receiving the LLDP message sent by the server 30. In addition, the second access device 20 can also obtain the server MAC address by receiving the ARP message sent by the server 30. The second access device 20 fills the obtained server identifier and server MAC address into the TLV extension attribute of the BGP message, and sends the BGP message carrying the server identifier and server MAC address to the second access device 20 through the core network.

[0059] In this embodiment, as a specific implementation manner, the message type of the BGP message is an Update message type, and the Update type message is used to transmit routing information between BGP peers.

[0060] Step S101: receiving a Link Layer Discovery Protocol (LLDP) message sent by a server, wherein an extended attribute of the LLDP message carries a server identifier.

[0061] In this embodiment, the LLDP message is a message based on the LLDP protocol. The LLDP protocol can encapsulate the TLV of the management address, device identification, interface identification and other information of the local device in the LLDP unit and publish it to the neighbors directly connected to itself. After receiving this information, the neighbor saves it in a standard management information base (MIB) for the network management system to query and judge the communication status of the link.

[0062] Step S102: If the server identifier in the BGP message is the same as the server identifier in the LLDP message, the server MAC address is updated to the MAC address table of the local device, so that the local device learns the server MAC address.

[0063] In this embodiment, if the first access device determines that the server identifier in the BGP message is the same as the server identifier in the LLDP message, it means that the BGP message comes from the second access device 20 that belongs to the same stacking system as the first access device 10, and the server MAC address carried therein is the MAC address of the server 30 connected to the first access device 10 through the aggregate network card communication, that is, the MAC address that the first access device 10 needs to learn.

[0064] In the above method provided in this embodiment, the second access device 20 sends a BGP message carrying the server MAC address and the server identifier to the first access device through the core network. The first access device learns the server MAC address according to the BGP message, so that the server can eventually send messages to the first access device and the second access device at the same time, making full use of the network bandwidth between the server and the first access device and the second access device, and realizing load balancing of traffic between the first access device and the second access device.

[0065] In order to make the MAC address learning method provided in this embodiment more complete and more robust, Figure 4 Based on this, this embodiment also provides a method for processing when the server identifier in the BGP message is different from the server identifier in the LLDP message, please refer to Figure 5 , Figure 5 An example of a process for a MAC address learning method applied to a first access device provided in an embodiment of the present invention Figure 2 The method further comprises step S103:

[0066] Step S103: If the server identifier in the BGP message is different from the server identifier in the LLDP message, the BGP message is ignored.

[0067] In this embodiment, if the first access device determines that the server identifier in the BGP message is different from the server identifier in the LLDP message, it means that the server MAC address in the BGP message is not the MAC address that the first access device 10 needs to learn. In order to avoid the first access device 10 learning the wrong MAC address, the BGP message is ignored. The ignoring method can be that the first access device determines to directly discard the BGP message, or it can be that the server identifier in the BGP message is not processed.

[0068] It should also be noted that when the MAC address learning method provided in this embodiment cannot normally enable the first access device 10 to learn the MAC address of the server 30, Figure 1 In the method shown, the traffic between the server 30 and the stacking system is only sent and received from the second access device 20 .

[0069] For the first access device, in order to be able to send and receive messages normally, a MAC address table is usually recorded locally. Each entry in the MAC address table contains information such as a MAC address and a port. Through the MAC address table, the first access device can know which port the received message should be sent to and to where. In order for the first access device to learn the server MAC address, this embodiment also provides a specific implementation method for learning the server MAC address by updating the MAC address table of the first access device:

[0070] First, a mapping relationship between the port receiving LLDP messages and the server MAC address is established.

[0071] In this embodiment, the first access device 10 has at least one port, and only through the port that receives the LLDP message can the first access device 10 exchange messages with the server 30. Therefore, the port and the server MAC address must be written into the MAC address table of the first access device 10 to establish normal communication between the first access device 10 and the server 30. For example, the first access device 10 has three ports a, b, and c, and the port that receives the LLDP message is a, then a mapping relationship between a and the server MAC address needs to be established.

[0072] Secondly, the mapping relationship is updated to the MAC address table.

[0073] In this embodiment, the MAC address table generally includes information such as a MAC address, a port, and a type. Table 1 is an example of an updated MAC address table of the first access device 10 .

[0074] Table 1

[0075] MAC Address port type 1111-11ab-22d3 GE0 / 0 / 1 dynamic

[0076] The MAC address in Table 1 is the MAC address of the server 30 learned by the first access device 10, and the corresponding port is the port for receiving the LLDP message sent by the server 30. The type of the MAC address table is dynamic, which means that the corresponding MAC address is obtained through learning rather than manual configuration by the user. The dynamic MAC address table also includes an aging time. For example, if the aging time is 300 seconds, then from the time the corresponding MAC address is added to the MAC address table, if the corresponding port does not receive a message with the source address as the MAC address within 300 seconds, then the MAC address will be deleted from the MAC address table.

[0077] It should be noted that Table 1 is only an example of a MAC address table. In fact, in addition to the above information, the MAC address table generally also includes the identifier of the virtual local area network (VLAN) to which the port belongs.

[0078] In this embodiment, under normal circumstances, once the server identifier is set, it will not change frequently. In order to avoid having to obtain the server identifier from the LLDP message sent by the server each time, this embodiment also provides a method of storing the server identifier after the server identifier is obtained through the LLDP message sent by the server for the first time. If it is necessary to compare with the server identifier in the BGP message later, the server identifier can be directly read from the local storage for comparison. The specific implementation steps are as follows:

[0079] Saves the server ID in LLDP packets.

[0080] It should be noted that since LLDP messages and BGP messages are independent messages, in addition to the scenario where the server identifier does not change frequently, the following scenario may also exist: the first access device 10 receives the LLDP message at a first moment and receives the BGP message at a second moment. In order to enable a normal server identifier judgment to be performed at the second moment, the first access device 10 saves the server identifier in the LLDP message when receiving the LLDP message at the first moment, so that at the second moment, the stored server identifier can be directly read and compared with the server identifier in the BGP message to make a correct judgment on whether the MAC address table needs to be updated.

[0081] It should also be noted that when the server identifier is reset, the server will send LLDP messages carrying the latest server identifier to the first access device and the second access device respectively, so that the first access device and the second access device can obtain the latest server identifier in time.

[0082] In this embodiment, as a specific implementation method, the second access device 20 obtains the server identifier by obtaining it from the extended attributes of the LLDP message sent from the server 30 to the second access device 20; the second access device 20 obtains the MAC address by obtaining it from the ARP message sent from the server 30 to the second access device 20.

[0083] In this embodiment, in order to enable the first access device 10 to ensure that the server identifier and the server MAC address sent by the second access device 20 are the MAC addresses of the servers that the first access device 10 needs to learn, this embodiment also provides a method for applying Figure 2 The MAC address learning method of the server 30 in the embodiment of the present invention is used to cooperate with the first access device 10 and the second access device 20. Figure 6 , Figure 6 The present invention provides a flow chart of a MAC address learning method for a server, the method comprising the following steps:

[0084] Step S200, sending a Link Layer Discovery Protocol LLDP message to the first access device, wherein an extended attribute of the LLDP message carries a server identifier, so that when the first access device receives a Border Gateway Protocol BGP message forwarded by the second access device through the core network and determines that the server identifier in the BGP message is the same as the server identifier in the LLDP message, the server MAC address is updated to the MAC address table of the first access device, so that the first access device learns the server MAC address.

[0085] In this embodiment, the server 30 sends LLDP messages to the first access device 10 and the second access device 20 respectively. The TLV extended attribute of each LLDP message carries the server identifier of the server 30, so that the first access device 10 and the second access device 20 can both know the server identifier of the server 30. In addition, the server 30 also sends an ARP message to the second access device 20, so that the second access device 20 obtains the server MAC address of the server 30 from the ARP message. Therefore, the second access device 20 can fill the server identifier and the server MAC address into the TLV extended attribute of the BGP message, and send it to the first access device 10 through the core network. When the first access device 10 determines that the server identifier in the BGP message is consistent with the server identifier obtained by itself through the LLDP message, it can determine that the server MAC address in the BGP message is the MAC address that it needs to learn, and finally achieves the learning of the correct MAC address.

[0086] The above method provided in this embodiment, the first access device 10 can accurately determine whether the currently received BGP message is the server MAC address that needs to be learned through the server identifier in the LLDP message sent by the server and the server identifier in the BGP message sent by the second access device 20, and finally realizes the learning of the correct MAC address.

[0087] In order to execute the corresponding steps in the above embodiment and each possible implementation method, an implementation method of a MAC address learning device 100 applied to a first access device is given below. Figure 7 , Figure 7 A block diagram of a MAC address learning device 100 applied to a first access device provided in an embodiment of the present invention is shown. It should be noted that the basic principle and technical effect of the MAC address learning device 100 applied to a first access device provided in this embodiment are the same as those in the above embodiment, and are not mentioned in this embodiment for the sake of brief description.

[0088] The MAC address learning device 100 applied to a first access device includes a receiving module 110 and a learning module 120 .

[0089] The receiving module 110 is used to receive a Border Gateway Protocol BGP message forwarded by the second access device through the core network, and the extended attribute of the BGP message carries a server identifier and a server MAC address.

[0090] The receiving module 110 is further configured to receive a Link Layer Discovery Protocol (LLDP) message sent by a server, wherein an extended attribute of the LLDP message carries a server identifier.

[0091] The learning module 120 is configured to update the server MAC address to the MAC address table of the first access device if the server identifier in the BGP message is the same as the server identifier in the LLDP message, so that the first access device learns the server MAC address.

[0092] The embodiment of the present invention provides a MAC address learning device 100 applied to a first access device. The second access device 20 sends a BGP message carrying a server MAC address and a server identifier to the first access device through a core network. The first access device learns the server MAC address based on the BGP message, so that the server can eventually send messages to the first access device and the second access device at the same time, making full use of the network bandwidth between the server and the first access device and the second access device, and realizing load balancing of traffic between the first access device and the second access device.

[0093] Optionally, the learning module 120 is specifically used to: establish a mapping relationship between a port for receiving LLDP messages and a server MAC address; and update the mapping relationship to a MAC address table.

[0094] Optionally, the learning module 120 is further specifically configured to: if the server identifier in the BGP message is different from the server identifier in the LLDP message, ignore the BGP message.

[0095] Optionally, the learning module 120 is further specifically configured to: save the server identifier in the LLDP message.

[0096] Optionally, the server identifier in the BGP message in the learning module 120 is obtained from the extended attribute of the LLDP message sent by the second access device from the server; the server MAC address in the BGP message is obtained from the Address Resolution Protocol ARP message sent by the second access device from the server.

[0097] In order to execute the corresponding steps in the above embodiment and each possible implementation method, an implementation method of a MAC address learning device 200 applied to a server is given below. Figure 8 , Figure 8 The block diagram of the MAC address learning device 200 applied to the server provided by the embodiment of the present invention is shown. It should be noted that the basic principle and technical effect of the MAC address learning device 200 applied to the server provided by this embodiment are the same as those of the above embodiment, and for the sake of brief description, they are not mentioned in this embodiment.

[0098] The MAC address learning device 200 applied to a server includes a sending module 210 .

[0099] The sending module 210 is used to send a link layer discovery protocol LLDP message to the first access device. The extended attribute of the LLDP message carries a server identifier, so that when the first access device receives a border gateway protocol BGP message forwarded by the second access device through the core network and determines that the server identifier in the BGP message is the same as the server identifier in the LLDP message, the server MAC address is updated to the MAC address table of the first access device, so that the first access device learns the server MAC address.

[0100] The MAC address learning device 200 applied to the server provided in this embodiment can accurately determine whether the currently received BGP message is the server MAC address that needs to be learned through the server identifier in the LLDP message sent by the server and the server identifier in the BGP message sent by the second access device 20, thereby finally realizing the learning of the correct MAC address.

[0101] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the MAC address learning method applied to the first access device as in the above embodiment and / or the MAC address learning method applied to the server is implemented.

[0102] In summary, an embodiment of the present invention provides a MAC address learning method, apparatus, electronic device and readable storage medium, and the method applied to a first access device includes: receiving a Border Gateway Protocol BGP message forwarded by a second access device through a core network, wherein an extended attribute of the BGP message carries a server identifier and a server MAC address; receiving a Link Layer Discovery Protocol LLDP message sent by a server, wherein an extended attribute of the LLDP message carries a server identifier; if the server identifier in the BGP message is the same as the server identifier in the LLDP message, then updating the server MAC address to the MAC address table of the current device, so that the current device learns the server MAC address. Compared with the prior art, by setting a server identifier for the server, the second access device uses the obtained server MAC address and server identifier to fill the server MAC address and server identifier in the BGP message, and sends the BGP message to the first access device through the core network. When the server identifier obtained in the LLDP message sent by the server is consistent with the server identifier in the BGP message, the first access device updates the server MAC address to the MAC address table, thereby learning the server MAC address. Ultimately, the server can send messages to the first access device and the second access device at the same time, making full use of the network bandwidth between the server and the first access device and the second access device, and realizing load balancing of traffic between the first access device and the second access device.

[0103] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A MAC address learning method, characterized in that: A first access device applied to a stacking system, the stacking system further comprising a second access device, the first access device and the second access device being communicatively connected to a server and a core network, the method comprising: Receiving a Border Gateway Protocol (BGP) message forwarded by the second access device through the core network, wherein an extended attribute of the BGP message carries a server identifier and a server MAC address; Receiving a Link Layer Discovery Protocol (LLDP) message sent by the server, wherein an extended attribute of the LLDP message carries a server identifier; If the server identifier in the BGP message is the same as the server identifier in the LLDP message, a mapping relationship is established between the port for receiving the LLDP message and the server MAC address, and the mapping relationship is updated to the MAC address table of the first access device, so that the first access device learns the server MAC address.

2. The MAC address learning method according to claim 1, characterized in that: The method further comprises: If the server identifier in the BGP message is different from the server identifier in the LLDP message, the BGP message is ignored.

3. The MAC address learning method according to claim 1, characterized in that: The method further comprises: The server identifier in the LLDP message is saved.

4. The MAC address learning method according to claim 1, characterized in that: The server identifier in the BGP message is obtained by the second access device from the extended attribute of the LLDP message sent by the server; the server MAC address in the BGP message is obtained by the second access device from the Address Resolution Protocol ARP message sent by the server.

5. A MAC address learning method, characterized in that: Applied to a server, the server is communicatively connected to a first access device and a second access device in a stacking system, the first access device and the second access device are communicatively connected to a core network, and the method includes: A Link Layer Discovery Protocol (LLDP) message is sent to the first access device, wherein an extended attribute of the LLDP message carries a server identifier, so that when the first access device receives a Border Gateway Protocol (BGP) message forwarded by the second access device through the core network, wherein the extended attribute of the BGP message carries a server identifier and a server MAC address, and determines that the server identifier in the BGP message is the same as the server identifier in the LLDP message, a mapping relationship between a port for receiving the LLDP message and the server MAC address is established, and the mapping relationship is updated to a MAC address table of the first access device, so that the first access device learns the server MAC address.

6. A MAC address learning device, characterized in that: A first access device applied to a stacking system, the stacking system further comprising a second access device, the first access device and the second access device being communicatively connected to a server and a core network, the apparatus comprising: A receiving module, configured to receive a Border Gateway Protocol (BGP) message forwarded by the second access device through the core network, wherein an extended attribute of the BGP message carries a server identifier and a server MAC address; The receiving module is further used to receive a link layer discovery protocol LLDP message sent by the server, wherein the extended attribute of the LLDP message carries a server identifier; A learning module is used to establish a mapping relationship between the port receiving the LLDP message and the server MAC address if the server identifier in the BGP message is the same as the server identifier in the LLDP message, and to update the mapping relationship to the MAC address table of the first access device, so that the first access device learns the server MAC address.

7. A MAC address learning device, characterized in that: Applied to a server, the server is communicatively connected to a first access device and a second access device in a stacking system, the first access device and the second access device are communicatively connected to a core network, and the device comprises: A sending module is used to send a Link Layer Discovery Protocol LLDP message to the first access device, wherein an extended attribute of the LLDP message carries a server identifier, so that when the first access device receives a Border Gateway Protocol BGP message forwarded by the second access device through the core network, wherein the extended attribute of the BGP message carries a server identifier and a server MAC address, and determines that the server identifier in the BGP message is the same as the server identifier in the LLDP message, a mapping relationship between a port for receiving the LLDP message and the server MAC address is established, and the mapping relationship is updated to the MAC address table of the first access device, so that the first access device learns the server MAC address.

8. An electronic device, characterized in that: It includes a processor and a memory, the memory is used to store a program, and the processor is used to implement the MAC address learning method described in any one of claims 1 to 4 and / or the MAC address learning method described in claim 5 when executing the program.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the MAC address learning method according to any one of claims 1 to 4 and / or the MAC address learning method according to claim 5 is implemented.

Citation Information

Patent Citations

  • Method and device for discovering network topology

    CN102694689A

  • Configuration information issuing method and device

    CN106059822A