Method, device and electronic device for maintaining table item consistency
By sending synchronization request messages between network devices within the MLAG-Lite system, detecting and adding table entries, the problem of inconsistent table entries within the MLAG-Lite system is resolved, ensuring the uniformity of DHCP address allocation and the security of devices.
Patent Information
- Application Number
- CN202111387521.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-22
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-11-22
AI Technical Summary
The inability to achieve consistency of entries among network devices within the MLAG-Lite system leads to disordered DHCP address allocation and inconsistent processing of DHCP Snooping entries, affecting the security and reliability of the devices.
The second network device sends a synchronization request message carrying key information of the table entries to each first network device in the MLAG-Lite system. The first network device checks the local table entries and adds table entries if they are not recorded, and clears the released table entries to ensure the consistency of the table entries.
It unifies DHCP entries and DHCP Snooping entries among network devices within the MLAG-Lite system, avoiding address allocation disorder and improving device security and reliability.
Smart Images

Figure CN114124812B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of MLAG-Lite technology, and in particular to a method, device and electronic device for maintaining table item consistency. Background Art
[0002] MLAG (Multichassis Link Aggregation Group) is a mechanism for implementing cross-device link aggregation. It can aggregate a device or server (such as a storage server, computing server, etc.) with two other devices, thereby improving link reliability from the single-board level to the device level to form an active-active system. MLAG is a type of horizontal virtualization technology and is widely used in data center scenarios.
[0003] MLAG-Lite is a lightweight MLAG that has the advantages of higher scalability and simpler configuration compared to existing MLAGs, and is increasingly favored by users in data center scenarios. Existing MLAGs require dedicated links for message interaction, device role election, and synchronization of table information between devices through dedicated links. In addition, the implementation methods of different manufacturers are inconsistent, resulting in incompatibility between devices from different manufacturers. Compared with existing MLAGs, MLAG-Lite is simpler to implement. It does not use dedicated links and does not maintain the MLAG protocol, which saves port resources and reduces the pressure on the device processing system. MLAG-Lite only needs to configure the same MAC (Media Access Control) address and extended port number for the network devices in the system, so that multiple network devices in the system can appear as the same device to the LACP (Link Aggregation Control Protocol) ports of other devices outside the MLAG-Lite system, thereby realizing cross-device link aggregation without vendor compatibility issues. However, since MLAG-Lite does not have a dedicated protocol or dedicated link to synchronize table entries, it is impossible to achieve consistency of table entries between network devices in the MLAG-Lite system.
[0004] For example, in a DHCP (Dynamic Host Configuration Protocol) scenario, the network devices in the MLAG-Lite system can be used as DHCP servers, and can also be used to enable the DHCP Snooping function (DHCP Snooping is a security feature of DHCP, which is used to ensure that DHCP clients obtain IP addresses from legitimate DHCP servers, and record the correspondence between DHCP client IP addresses and MAC addresses and other parameters to prevent DHCP attacks on the network). However, since MLAG-Lite does not have a dedicated protocol or dedicated link to synchronize table items, the network devices in the system cannot synchronize DHCP table items and DHCP Snooping table items. In the MLAG-Lite environment, when the network device acts as a DHCP server, if the network device does not synchronize DHCP table items, it is very likely to cause address allocation disorder (such as different DHCP servers assigning the same address to different devices, a DHCP server has released an IP address, but the peer device cannot release it, etc.). When the DHCP Snooping table item exists on some network devices but not on some network devices, when the attack message is loaded to the end where the DHCP Snooping table item does not exist, the device will not be able to suppress the attack. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method, an apparatus and an electronic device for maintaining table entry consistency, so as to achieve consistency of table entries between first network devices.
[0006] An embodiment of the present application provides a method for maintaining table item consistency, which is applied to a first network device, where the first network device is a network device within an MLAG-Lite system, including: receiving a synchronization request message reported by a second network device; the second network device is an external network device connected to the MLAG-Lite system; the synchronization request message is sent by the second network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system; the synchronization request message carries key information of table items to be synchronized; detecting whether the key information of the table items has been recorded in a local table item; if the key information of the table items is not recorded in the local table item, adding a new table item entry in the local table item according to the key information of the table item.
[0007] In the above implementation process, when there is key information of the table item that needs to be maintained consistent by each first network device in the MLAG-Lite system, the second network device sends a synchronization request message carrying the key information of the table item through all the aggregation group member ports connected to each first network device in the MLAG-Lite system, and each first network device in the MLAG-Lite system can detect whether the key information of the table item has been recorded in its own local table item, and then add a new table item entry in the local table item according to the key information of the table item if it has not been recorded. In this way, through the role of the second network device, each first network device in the MLAG-Lite system that has not recorded relevant information can autonomously generate corresponding table item entries, thereby maintaining the consistency of the table items between each first network device.
[0008] Furthermore, the local entry is a DHCP entry or a DHCP Snooping entry.
[0009] Through the solution of the embodiment of the present application, the consistency of DHCP entries between the first network devices can be achieved through the role of the second network device, thereby avoiding the problem of disordered address allocation. Alternatively, through the solution of the embodiment of the present application, the consistency of DHCP Snooping entries between the first network devices can be achieved through the role of the second network device, so that the first network devices have the same DHCP attack suppression capability.
[0010] Furthermore, the synchronization request message is a DHCP request message; and the key information of the table entry is carried in an option field of the DHCP request message.
[0011] It should be understood that the option field in the DHCP request message can be used to store control information and parameters that are not defined in the common protocol. Therefore, in the above implementation process, the option field is used to carry the key information of the table item, and the protocol definition of the conventional DHCP request message can be kept unchanged, so as to facilitate promotion and application in industrial practice.
[0012] Furthermore, the method also includes: when receiving a DHCP release message from the second network device, clearing the table entry in the local table; the DHCP release message is sent by the second network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system; the table entry is the table entry requested to be released by the DHCP release message.
[0013] In the above implementation process, through the role of the second network device, each first network device in the MLAG-Lite system can effectively clear the same table entries, thereby maintaining the consistency of the table entries between the first network devices in the MLAG-Lite system.
[0014] An embodiment of the present application also provides a method for maintaining table item consistency, which is applied to a second network device, where the second network device is an external network device connected to the MLAG-Lite system; comprising: sending a synchronization request message carrying table item key information to be synchronized to each first network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system, so that each first network device can detect whether the table item key information has been recorded in the local table item, and when the table item key information is not recorded in the local table item, add a table item entry to the local table item according to the table item key information.
[0015] In the above implementation process, the second network device sends a synchronization request message carrying key information of the table items to be synchronized on all aggregation group member ports, so that the first network devices in the MLAG-Lite system that do not record relevant information can autonomously generate corresponding table items, thereby maintaining the consistency of the table items between the first network devices.
[0016] Furthermore, the local entry is a DHCP entry or a DHCP Snooping entry.
[0017] Furthermore, the method further includes: upon monitoring that the use of the IP address allocated by the DHCP server ends, sending a DHCP release message through all the aggregation group member ports, so that each of the first network devices clears the table entry requested to be released by the DHCP release message in the local table.
[0018] In the DHCP scenario, when the second network device ends the use of the IP address assigned by the DHCP server (for example, the service execution ends, the IP address reaches the lease time, etc.), the DHCP table item and DHCPSnooping table item corresponding to the IP address should be released. In the above implementation process, the second network device sends a DHCP release message through all the aggregation group member ports when it detects that the use of the IP address assigned by the DHCP server ends, so that all the first network devices in the MLAG-Lite system can clear the corresponding table items, thereby maintaining the consistency of the table items between the first network devices during the table item clearing process.
[0019] An embodiment of the present application also provides a device for maintaining table item consistency, which is applied to a first network device, wherein the first network device is a network device within an MLAG-Lite system; the device includes: a receiving module, used to receive a synchronization request message reported by a second network device; the second network device is an external network device connected to the MLAG-Lite system; the synchronization request message is sent by the second network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system; the synchronization request message carries key information of table items to be synchronized; a detection module, used to detect whether the key information of the table items has been recorded in a local table item; and a table item control module, used to add a new table item entry in the local table item according to the key information of the table item when the key information of the table item is not recorded in the local table item.
[0020] An embodiment of the present application also provides a device for maintaining table item consistency, which is applied to a second network device, and the second network device is an external network device connected to the MLAG-Lite system; the device includes: a sending module, which is used to send synchronization request messages carrying table item key information to be synchronized to each first network device in the MLAG-Lite system through all aggregation group member ports connected to each first network device in the MLAG-Lite system, so that each first network device can detect whether the table item key information has been recorded in the local table item, and when the table item key information is not recorded in the local table item, add a table item entry to the local table item according to the table item key information; wherein the MLAG-Lite system is an MLAG-Lite system with a table item consistency requirement for the table item key information.
[0021] An embodiment of the present application also provides an electronic device, including a processor, a memory and a communication bus; the communication bus is used to realize connection and communication between the processor and the memory; the processor is used to execute one or more programs stored in the memory to implement any of the above-mentioned methods for maintaining table item consistency.
[0022] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores one or more programs. The one or more programs can be executed by one or more processors to implement any of the above-mentioned methods for maintaining table item consistency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application 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 paying creative work.
[0024] Figure 1 A schematic diagram of two-end interaction of a method for maintaining table item consistency provided in an embodiment of the present application;
[0025] Figure 2 A schematic diagram of a system structure when a first network device is used as a DHCP server according to an embodiment of the present application;
[0026] Figure 3 A schematic diagram of a system structure when a first network device is used to maintain a DHCP Snooping entry provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of the structure of an apparatus for maintaining table item consistency applied to a first network device provided in an embodiment of the present application;
[0028] Figure 5 A schematic diagram of the structure of a device for maintaining table item consistency applied to a second network device provided in an embodiment of the present application;
[0029] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0031] Embodiment 1:
[0032] In order to achieve consistency of table entries between first network devices in the MLAG-Lite system, a method for maintaining table entry consistency is provided in an embodiment of the present application. The first network device refers to each network device in the MLAG-Lite system. Figure 1 As shown, Figure 1 A schematic diagram of two-end interaction of a method for maintaining table item consistency provided in an embodiment of the present application includes:
[0033] S101: The second network device sends a synchronization request message to each first network device in the MLAG-Lite system through all aggregation group member ports connected to the first network devices.
[0034] In the embodiment of the present application, the second network device refers to an external network device connected to the MLAG-Lite system.
[0035] In the embodiment of the present application, the synchronization request message will carry key information of the table items to be synchronized.
[0036] The key information of the table item to be synchronized can be determined by the second network device according to the currently completed task. For example, in a DHCP scenario, assuming that the first network device acts as a DHCP server and the second device acts as a DHCP client, when the second network device successfully obtains the IP address used this time from the first network device, the key information such as the IP address used to generate the DHCP table item and the MAC address of the second network device can be used as the key information of the table item, and then reported to each first network device.
[0037] It should also be noted that the MLAG-Lite system described in the embodiments of the present application refers to a collection of multiple first network devices that implement cross-device link aggregation in accordance with the MLAG-Lite technology. These devices appear to be the same device to the LACP port of the second network device, but the second network device can be connected to different first network devices of the MLAG-Lite system according to the member ports of each aggregation group.
[0038] In an embodiment of the present application, a synchronization request message carrying key information of table items to be synchronized will be sent on all aggregation group member ports of the second network device connected to each first network device in the MLAG-Lite system, so that each first network device in the MLAG-Lite system can obtain the synchronization request message.
[0039] It should be understood that in a DHCP scenario, the synchronization request message may be a DHCP request message. The option field in the DHCP request message may be used to store control information and parameters that are not defined in the general protocol. To this end, in an embodiment of the present application, in a DHCP scenario, the key information of the table item may be carried in the option field of the DHCP request message, so as to facilitate the promotion and application of the solution of the embodiment of the present application in industrial practice without changing the protocol definition of the DHCP request message.
[0040] In the embodiment of the present application, in order to realize that the option field can carry key information of the table entry, a feasible way is to adopt multiple existing option structures. Exemplarily, the option field structure in the embodiment of the present application can be shown in the following Table 1:
[0041] Table 1
[0042] Type Length Value Type Length Value Type Length Value Type Length Value 61 X Value 12 X Value 50 X Value 51 X Value
[0043] Among them, Type represents the type, Length represents the data length, Value represents the information content value, and X is a variable, which can be any constant value greater than 0. In the option field, when the Type value is 61 (i.e. option61), it represents that the function of the option field is to set the client identification option; when the Type value is 12 (i.e. option12), it represents that the function of the option field is to set the host name option of the DHCP client; when the Type value is 50 (i.e. option50), it represents that the function of the option field is to set the request IP address option; when the Type value is 51 (i.e. option51), it represents that the function of the option field is to set the IP address lease time option.
[0044] It should be understood that in different scenarios, the value of each Type in the above Table 1, the value of Length corresponding to each Type, and the value of Value should be set differently according to the different key information of the table item to be carried.
[0045] In addition, in order to realize that the option field can carry key information of the table item, another feasible way is to define the required information as different sub-items of the option and fill its value in the sub-item. For example, see the option field structure shown in Table 2:
[0046] Table 2
[0047]
[0048] Among them, Type represents the type, Length represents the data length of the option field, Agent InformationField represents the supplementary information field, i1 represents the first sub-item, in represents the nth sub-item, SubOpt represents the type of information to be filled in the sub-item (such as IP address, MAC address, lease time, Syn tag, VLAN (Virtual Local Area Network) ID (Identity document), interface ID, etc.), Len represents the data length of the sub-item, and Sub-option Value represents the information content value of the sub-item.
[0049] In addition, in order to realize that the option field can carry key information of the table item, another feasible way is to construct a specific option structure, as shown in Table 3. The Value field in the option structure records the required key information of each table item (such as IP address, MAC address, lease time, Syn tag, VLAN (Virtual Local Area Network) ID (Identity document), interface ID and other information content values):
[0050] Table 3
[0051]
[0052] Among them, Type represents the type, Length represents the data length of the option field, and each option Value represents the content value of key information of different types of table items.
[0053] It should be understood that the above three option field structures are merely several optional implementation methods exemplified in the embodiments of the present application, but are not intended to limit the embodiments of the present application.
[0054] S102: After receiving the synchronization request message reported by the second network device, the first network device detects whether the key information of the entry has been recorded in the local entry. If not, go to step S103; if recorded, end the process.
[0055] S103: Add a new entry to the local entry according to the key information of the entry.
[0056] Optionally, in an embodiment of the present application, when the key information of the table item is not recorded in the local table item, a new table item entry can be generated according to the data recording format and rules of the local table item, and the key information of each table item can be written into the table item entry respectively, thereby realizing the addition of the table item entry.
[0057] In the embodiment of the present application, each first network device respectively detects whether the key information of the table item has been recorded in its own local table item, and then adds a corresponding table item entry if it has not been recorded. In this way, all first network devices in the MLAG-Lite system can record the table item entry corresponding to the key information of the table item, thereby maintaining the consistency of the table items between the first network devices.
[0058] It should be noted that, in the embodiment of the present application, the local table items maintained in the first network device may be, but are not limited to, DHCP table items, DHCP Snooping table items, etc.
[0059] It should be understood that different local entries may have different corresponding entry key information. In the embodiment of the present application, the required entry key information corresponding to the local entry may be preset.
[0060] Exemplarily, when the local table item is a DHCP table item, the key information of the table item may include: at least one of the MAC address of the second network device, the IP address assigned to the second network device, the lease time, etc. When the local table item is a DHCP Snooping table item, the key information of the table item may include: at least one of the MAC address of the second network device, the VLAN information of the second network device, the interface information of the second network device, the IP address assigned to the second network device, the lease time, etc.
[0061] It should be understood that the above process can ensure the consistency of the table entries between the first network devices during the process of adding table entries. However, in actual application, there may be a situation where one or some table entries in the table need to be deleted.
[0062] To this end, in the embodiment of the present application, the consistency of the table entries between the first network devices can also be ensured by the second network device.
[0063] When the second network device detects that the corresponding entry release trigger condition is triggered, that is, through all aggregation group member ports of each network device in the MLAG-Lite system connected to the entry release trigger condition, the second network device can send a DHCP release message to each first network device in the MLAG-Lite system respectively.
[0064] In the embodiment of the present application, the DHCP release message may carry corresponding clearing indication information, so that the first network device can clear the table entry according to the table entry indicated by the clearing indication information.
[0065] In the embodiment of the present application, the clearing indication information may be identification information of each table entry, or may be content in the table entry, or may be content of key information that can be distinguished from other table entries. For example, for DHCP table entries and DHCP Snooping table entries, the clearing indication information may be an IP address.
[0066] In an embodiment of the present application, the table entry release trigger condition can be set by an engineer according to the different scenario requirements of the actual business. For example, in a DHCP scenario, if the maintained local table entry is a DHCP table entry or a DHCPSnooping table entry, then the table entry release trigger condition can be set to the end of use of the IP address assigned by the DHCP server. That is, when the second network device detects that the use of the IP address assigned by the DHCP server has ended, it can send a DHCP release message through all the aggregation group member ports, so that each first network device clears the table entry entry requested to be released by the DHCP release message in the local table entry.
[0067] The method for maintaining table item consistency provided by the embodiment of the present application is that when there is table item key information that requires each first network device in the MLAG-Lite system to maintain consistency, the second network device sends a synchronization request message carrying the table item key information through all aggregation group member ports connected to each first network device in the MLAG-Lite system, and each first network device in the MLAG-Lite system can detect whether the table item key information has been recorded in its own local table item, and then, if it has not been recorded, add a table item entry to the local table item according to the table item key information. In this way, through the role of the second network device, each first network device in the MLAG-Lite system that has not recorded relevant information can autonomously generate a corresponding table item entry, thereby maintaining the consistency of the table items between each first network device.
[0068] In addition, when it is necessary to clear table entries, the second network device can also be used to enable each first network device to clear the same table entry, thereby maintaining the consistency of the table entries between the first network devices.
[0069] Embodiment 2:
[0070] Based on the first embodiment, this embodiment takes the process of implementing the consistency maintenance of DHCP entries and the process of implementing the consistency maintenance of DHCP Snooping entries as examples to further illustrate the present application.
[0071] Example 1:
[0072] See also Figure 2As shown, the MLAG-Lite system consists of a first network device 1 and a first network device 2. The second network device is connected to the first network device 1 through a member port of an aggregation group, and is connected to the first network device 2 through another member port of an aggregation group. The second network device acts as a DHCP client, and the first network device 1 and the first network device 2 both act as DHCP servers. The second network device can ensure that the Discover message sent by any member port of the aggregation group will be received by the DHCP server.
[0073] Each first network device acts as a DHCP server and maintains a DHCP table entry.
[0074] The process of maintaining DHCP entry consistency includes:
[0075] S10. The DHCP client (second network device) starts and sends a Discover message through any member port of the aggregation group (usually the root port). The message carries information such as the MAC address of the DHCP client, the parameter list options to be requested, and the broadcast flag.
[0076] It should be noted that in S10, the message is sent only through any member port of the aggregation group, and not all first network devices can receive the Discover message.
[0077] S11. After the first network device receives the Discover message, the server manages the network parameters such as the IP addresses available for allocation through the address pool.
[0078] After receiving the Discover message, the first network device as the DHCP server selects an address pool in the same network segment as the IP address of the interface receiving the Discover message, selects an available IP address from it, and then sends it to the DHCP client via a DHCP Offer message. The DHCP Offer message carries the IP address of the DHCP client that is expected to be assigned to the specified MAC address (carried in the yiaddr (allocated DHCP client IP address) field in the DHCP Offer message) and its lease time and other configuration parameters.
[0079] S12, the DHCP client receives the first received DHCP Offer message, and then sends a DHCPRequest message in a broadcast mode. The DHCPRequest message contains the DHCP server identifier (ie, option 54) that the DHCP client wants to select and the client IP address (ie, option 50, which is filled with the IP address in the yiaddr field of the received DHCP Offer message).
[0080] S13. After the DHCP server (ie, the first network device 1 or the first network device 2) receives the DHCP Request message sent by the DHCP client, the DHCP server responds with a DHCP ACK (Acknowledgement) message, indicating that the IP address requested in the DHCP Request message (filled with option 50) is allocated to the DHCP client for use.
[0081] S14. After receiving the DHCP ACK message, the DHCP client will broadcast a free ARP (Address Resolution Protocol) message to detect whether there are other terminals in the network segment using the IP address assigned by the DHCP server. If no response is received within the specified time, it means that the DHCP client can use this address.
[0082] If a response is received in S15 and S14, it means that other DHCP clients have used this IP address. At this time, the DHCP client can send a Decline message (containing specific fields, the main field is the IP address) to all DHCP servers (i.e., the first network device 1 and the first network device 2) based on all member ports of the aggregation group (i.e., the same message is sent to all member ports of the aggregation group) to inform that the IP address is occupied.
[0083] At this time, the DHCP client will re-request an IP address based on any member port of the aggregation group (usually the root port). After the DHCP server corresponding to the member port of the aggregation group receives the Decline message in S15, it lists the address as a conflicting address. The DHCP server will only select a conflicting address for allocation when there is no free address to allocate.
[0084] If no response is received within the specified time in S16 and S14, the IP address is used and a DHCP Request message containing a specific option field (the method of constructing the option field is not particularly required in this embodiment and can be implemented in any of the methods in Tables 1 to 3) is sent to all DHCP servers (i.e., the first network device 1 and the first network device 2) based on all member ports of the aggregation group (i.e., the same message is sent to all member ports of the aggregation group).
[0085] The option field of the DHCP Request message must contain information such as the currently used IP address, MAC address, lease time, etc.
[0086] After receiving the DHCPRequest message containing the specific option field, the first network device 1 and the first network device 2 can check the option value in the DHCPRequest message. If the syn flag is 1, it indicates that the DHCPRequest message is a synchronization request message, rather than the Request message in step S12 in the process of requesting an IP address.
[0087] S17, for the first network device 1 and the first network device 2, if the syn mark in the option of the specific option field in S16 is 1, it can be further determined whether the IP address carried in the option field of the DHCP Request message is already in the allocated state in the DHCP table item, and if it is in the allocated state, no processing is performed. If it is in the unallocated state, the IP address is added to the DHCP table item, indicating that the address is already in the allocated state.
[0088] At this time, if Figure 2 In the network architecture shown, for the newly allocated IP address, the IP address is allocated between multiple DHCP servers (ie, between the first network device 1 and the first network device 2), and the consistency of the DHCP table items is maintained.
[0089] When the renewal period reaches T1 (renewal T1 time, generally refers to 50% of the lease time) or T2 (renewal T2 time, generally refers to 87.5% of the lease time), the renewal message sent is also sent based on all member ports of the aggregation group. After receiving the renewal message, the DHCP server renews the IP address.
[0090] S18. When the DHCP client no longer needs to use the IP address, the DHCP client sends a DHCP Release message (ie, a DHCP Release message) containing a specific option field to the first network device 1 and the first network device 2 based on all member ports of all aggregation groups.
[0091] The option field of the Release message carries at least the IP address.
[0092] S19: For each first network device (first network device 1, first network device 2), after receiving a DHCP Release message containing a specific option field, the IP address may be released, that is, the entry containing the IP address may be cleared from the DHCP table.
[0093] Example 2:
[0094] See also Figure 3As shown, the second network device is a DHCP client (the DHCP client can be a switch or other device with similar functions), and the DHCP client is connected to multiple first network devices (first network device 1 and first network device 2) in an aggregation group manner. Each first network device is connected to a DHCP server. Each first network device maintains a DHCP Snooping table entry.
[0095] It should be understood that for DHCP Snooping entries, Figure 2 In the network architecture shown, when each first network device acts as a DHCP server, each first network device can also maintain a DHCP Snooping entry, and can also be applied Figure 3 A method for achieving consistency of DHCP Snooping entries in the network architecture shown.
[0096] The process of maintaining DHCP snooping entry consistency includes:
[0097] S20. The DHCP client (second network device) starts and sends a Discover message through any member port of the aggregation group (usually a root port). The message carries information such as the MAC address of the DHCP client, the parameter list options to be requested, and a broadcast flag.
[0098] It should be noted that in S20, the second network device only sends the Discover message to the first network device 1 or the first network device 2 through any member port of the aggregation group, and then the Discover message is sent to the DHCP server by the first network device 1 or the first network device 2. It should be understood that in this process, it is only necessary to send the Discover message to one first network device, and it is not necessary to send the Discover message to all first network devices.
[0099] S21. After receiving the Discover message, the DHCP server manages the network parameters such as the IP addresses available for allocation through the address pool.
[0100] After receiving the Discover message, the DHCP server selects an address pool in the same network segment as the IP address of the interface receiving the Discover message, selects an available IP address from it, and then sends it to the DHCP client via a DHCP Offer message. The DHCP Offer message carries the IP address (carried in the yiaddr field in the DHCP Offer message) that the DHCP client hopes to assign to the specified MAC address and its lease time and other configuration parameters.
[0101] S22, the DHCP client receives the first received DHCP Offer message, and then sends a DHCP Request message in a broadcast mode. The DHCP Request message contains the DHCP server identifier (ie, option 54) that the DHCP client wants to select and the client IP address (ie, option 50, which is filled with the IP address in the yiaddr field of the received DHCP Offer message).
[0102] S23. After receiving the DHCP Request message sent by the DHCP client, the DHCP server responds with a DHCP ACK message, indicating that the IP address requested in the DHCP Request message (filled with option 50) is allocated to the DHCP client for use.
[0103] S24. After receiving the DHCP ACK message, the DHCP client will broadcast a free ARP message to detect whether there are other terminals in the network segment using the IP address assigned by the DHCP server. If no response is received within the specified time, it means that the DHCP client can use this address.
[0104] If a response is received in S25 and S24, it means that another DHCP client has used this IP address. At this time, the DHCP client can send a Decline message (containing specific fields, the main field is the IP address) to the DHCP server to inform that the IP address is occupied.
[0105] At this time, the DHCP client will re-request an IP address based on any member port of the aggregation group (usually the root port). After receiving the Decline message in S25, the DHCP server lists the address as a conflicting address. The DHCP server will only select a conflicting address for allocation when there is no free address to allocate.
[0106] If no response is received within the specified time in S26 and S24, the IP address is used and a DHCP Request message containing a specific option field (the method of constructing the option field is not particularly required in this embodiment and can be implemented using any of the methods in Tables 1 to 3) is sent to all first network devices (i.e., first network device 1 and first network device 2) based on all member ports of the aggregation group (i.e., the same message is sent to all member ports of the aggregation group).
[0107] The option field of the DHCP Request message must contain information such as the currently used IP address, MAC address, VLAN ID, interface ID, lease time, etc.
[0108] S27, for each first network device (first network device 1, first network device 2), after receiving a DHCP Request message containing a specific option field, if the first network device enables the DHCP Snooping function, the first network device can check its own DHCP Snooping table item according to the received DHCP Request message. If there is a corresponding table item, it will not be processed. If there is no corresponding table item, a DHCP Snooping table item is generated according to the information carried by the option in the DHCP Request message, such as IP address, MAC address, VLAN ID, interface ID, lease time, etc.
[0109] S28. When the DHCP client no longer needs to use the IP address, the DHCP client sends a DHCP Release message (ie, a DHCP release message) containing a specific option field to all first network devices (ie, first network device 1 and first network device 2) based on all member ports of all aggregation groups.
[0110] The option field of the Release message carries at least the IP address.
[0111] S29: For each first network device (including first network device 1 and first network device 2), after receiving a DHCP Release message containing a specific option field, the DHCP Snooping table entry corresponding to the IP address may be aged, that is, the table entry containing the IP address may be cleared from the DHCP Snooping table entry.
[0112] Through the above solution, in the MLAG-Lite scenario, when the first network device acts as a DHCP server or enables the DHCP Snoopin function, the consistency of DHCP entries and DHCP Snooping entries can be maintained between the first network devices, thereby solving problems such as address confusion and failure of device security functions caused by inconsistent entries, which is conducive to the promotion and use of MLAG-Lite technology.
[0113] Embodiment three:
[0114] Based on the same inventive concept, the embodiments of the present application also provide a device 400 for maintaining table item consistency and a device 500 for maintaining table item consistency. It should be understood that the specific functions of the device 400 and the device 500 can be found in the description above. To avoid repetition, the detailed description is appropriately omitted here. The device 400 and the device 500 include at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system of the device 400 and the device 500. Specifically:
[0115] See also Figure 4 As shown, the apparatus 400 is applied to a first network device, which is a network device in the MLAG-Lite system. The apparatus 400 includes: a receiving module 401, a detection module 402 and a table entry control module 403. Among them:
[0116] The receiving module 401 is used to receive a synchronization request message reported by a second network device; the second network device is an external network device connected to the MLAG-Lite system; the synchronization request message is sent by the second network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system; the synchronization request message carries key information of table items to be synchronized;
[0117] A detection module 402 is used to detect whether the key information of the entry has been recorded in the local entry;
[0118] The entry control module 403 is configured to add a new entry to the local entry according to the key information of the entry when the key information of the entry is not recorded in the local entry.
[0119] In the embodiment of the present application, the local entry is a DHCP entry or a DHCP Snooping entry.
[0120] In the embodiment of the present application, the synchronization request message is a DHCP request message; the key information of the table entry is carried in the option field of the DHCP request message.
[0121] In the embodiment of the present application, the table entry control module 403 is also used to clear the table entry in the local table when receiving the DHCP release message from the second network device; the DHCP release message is sent by the second network device through all aggregation group member ports connected to the network devices connected to each first network device in the MLAG-Lite system; the table entry is the table entry requested to be released by the DHCP release message.
[0122] See also Figure 5 As shown, the apparatus 500 is applied to a second network device, where the second network device is an external network device connected to the MLAG-Lite system; the apparatus 500 includes:
[0123] The sending module 501 is used to send synchronization request messages carrying key information of table items to be synchronized to each first network device in the MLAG-Lite system through all aggregation group member ports connected to the first network devices, so that each first network device can detect whether the key information of the table item has been recorded in the local table item, and when the key information of the table item is not recorded in the local table item, add a new table item entry in the local table item according to the key information of the table item.
[0124] In a feasible implementation of the embodiment of the present application, the local entry is a DHCP entry, or a DHCP Snooping entry.
[0125] In the above feasible implementation manner, the sending module 501 is also used to send a DHCP release message through all the aggregation group member ports when it is monitored that the IP address allocated by the DHCP server has ended its use, so that each of the first network devices clears the table entry requested to be released by the DHCP release message in the local table.
[0126] It should be understood that, for the sake of brevity, some of the contents described in the first embodiment will not be repeated in this embodiment.
[0127] Embodiment 4:
[0128] This embodiment provides an electronic device, see Figure 6 As shown, it includes a processor 601, a memory 602, a communication bus 603, and an external communication interface 604. Among them:
[0129] The communication bus 603 is used to realize the connection and communication between the processor 601 , the memory 602 and the external communication interface 604 .
[0130] The external communication interface 604 is used to communicate with external devices.
[0131] The processor 601 is used to execute one or more programs stored in the memory 602 to implement the steps performed by the first network device or the second network device in the method for maintaining table consistency described in the first embodiment and / or the second embodiment.
[0132] Understandably, Figure 6 The structure shown is for illustration only. The electronic device may also include Figure 6 More or fewer components as shown, or with Figure 6 Different configurations shown.
[0133] This embodiment also provides a computer-readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash disk, an SD (Secure Digital Memory Card) card, an MMC (Multimedia Card) card, etc., in which one or more programs for implementing the above steps are stored, and the one or more programs can be executed by one or more processors to implement the steps performed by the first network device or the second network device in the method for maintaining table item consistency described in the above embodiment 1 and / or embodiment 2. No further details will be given here.
[0134] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0135] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0137] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0138] As used herein, a plurality refers to two or more than two.
[0139] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for maintaining table item consistency, It is characterized in that Applied to a first network device, the first network device is a network device in an MLAG-Lite system, and the MLAG-Lite system includes a plurality of the first network devices; the method includes: When a second network device requests an IP address from a first network device in the MLAG-Lite system and uses the IP address assigned by the first network device, a DHCP request message reported by the second network device is received; the second network device is an external network device connected to the MLAG-Lite system; the DHCP request message is sent by the second network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system; the DHCP request message carries key information of table items to be synchronized; the key information of the table items includes the IP address and the MAC address of the second network device; Detecting whether the key information of the entry has been recorded in the local entry; If the key information of the entry is not recorded in the local entry, a new entry is added to the local entry according to the key information of the entry.
2. The method according to claim 1, It is characterized in that The local entry is a DHCP entry.
3. The method according to claim 1, It is characterized in that The local entry is a DHCP Snooping entry.
4. The method according to claim 2, It is characterized in that The key information of the table entry is carried in the option field of the DHCP request message.
5. The method according to claim 3, It is characterized in that The key information of the table entry is carried in the option field of the DHCP request message.
6. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: When receiving a DHCP release message from the second network device, clear the corresponding table entry in the local table; the DHCP release message is sent by the second network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system; the corresponding table entry is the table entry requested to be released by the DHCP release message.
7. A method for maintaining consistency of table entries, It is characterized in that Applied to a second network device, the second network device is an external network device connected to an MLAG-Lite system, and the MLAG-Lite system includes a plurality of first network devices; the method includes: When an IP address is requested from a first network device in the MLAG-Lite system and the IP address allocated by the first network device is used, a DHCP request message carrying key information of table items to be synchronized is sent to each first network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system, so that each first network device can detect whether the key information of the table item has been recorded in the local table item, and when the key information of the table item is not recorded in the local table item, a new table item entry is added to the local table item according to the key information of the table item; the key information of the table item includes the IP address and the MAC address of the second network device.
8. The method according to claim 7, It is characterized in that The local entry is a DHCP entry.
9. The method according to claim 7, It is characterized in that The local entry is a DHCP Snooping entry.
10. The method according to claim 8 or 9, It is characterized in that The method further comprises: When it is detected that the IP address allocated by the DHCP server ends its use, a DHCP release message is sent through all the aggregation group member ports, so that each of the first network devices clears the entry requested to be released by the DHCP release message in the local table.
11. A device for maintaining table item consistency, It is characterized in that Applied to a first network device, the first network device is a network device in an MLAG-Lite system, and the MLAG-Lite system includes a plurality of the first network devices; the apparatus includes: A receiving module, configured to receive a DHCP request message reported by a first network device in the MLAG-Lite system when the second network device requests an IP address from the first network device and uses the IP address allocated by the first network device; the second network device is an external network device connected to the MLAG-Lite system; the DHCP request message is sent by the second network device through all aggregation group member ports connected to the first network devices in the MLAG-Lite system; the DHCP request message carries key information of table items to be synchronized; the key information of the table items includes the IP address and the MAC address of the second network device; A detection module, used to detect whether the key information of the table entry has been recorded in the local table entry; The table entry control module is used to add a table entry to the local table entry according to the table entry key information when the table entry key information is not recorded in the local table entry.
12. A device for maintaining consistency of table entries, It is characterized in that Applied to a second network device, the second network device is an external network device connected to an MLAG-Lite system, the MLAG-Lite system includes a plurality of first network devices; the apparatus includes: A sending module, for, when requesting an IP address from a first network device in the MLAG-Lite system and using the IP address allocated by the first network device, sending a DHCP request message carrying key information of table items to be synchronized to each first network device through all aggregation group member ports connected to each first network device in the MLAG-Lite system, so that each first network device can detect whether the key information of table items has been recorded in a local table item, and when the key information of table items is not recorded in the local table item, add a new table item entry in the local table item according to the key information of table items; the key information of table items includes the IP address and the MAC address of the second network device.
13. An electronic device, It is characterized in that include: Processor, memory, internal communication bus, external communication interface; The communication bus is used to realize the connection and communication between the processor, the memory and the external communication interface; The external communication interface is used to communicate with external equipment; The processor is configured to execute the program stored in the memory to implement the method according to any one of claims 1 to 6 or the method according to any one of claims 7 to 10.
