A method and apparatus for master-backup switching

By using the switching chip to determine the ARP message input interface, the problem of limited ARP table refresh speed during primary/backup switchover of gateway devices is solved, thus improving the data transmission reliability of the switching devices.

CN116708353BActive Publication Date: 2026-02-06NEW H3C TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310770238.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-27
Publication Date
2026-02-06
Estimated Expiration
2043-06-27

AI Technical Summary

Technical Problem

During the switchover of gateway devices, the refresh rate of ARP entries stored in the switching devices is limited, resulting in data packet loss and reducing the reliability of the switching devices.

Method used

When receiving ARP packets, the switching chip determines whether the packet belongs to the first interface group based on the incoming interface. If the packet belongs to the first interface group, the chip modifies the outgoing interface of the ARP entry to the index of the second interface group. This avoids the bottleneck of ARP entry refresh due to the limited processing capacity of the switching chip and directly refreshes the interface used for data packet forwarding.

Benefits of technology

This improves the reliability of data interaction between switching devices during gateway device master-slave switching and avoids short-term data interruptions caused by ARP table refresh.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116708353B_ABST
    Figure CN116708353B_ABST
Patent Text Reader

Abstract

The specification provides a master-backup switching method and device, and relates to the technical field of communication. A master-backup switching method comprises the following steps: determining an incoming interface of a received ARP packet, and obtaining MAC address information carried in the ARP packet; searching for corresponding MAC address table entries and ARP table entries according to the MAC address information; if an outgoing interface recorded in the MAC address table entries is different from the incoming interface and the incoming interface belongs to a first interface group, updating the outgoing interface recorded in the searched MAC address table entries to the incoming interface, and modifying interfaces recorded in a second interface group to the incoming interface according to a second interface group index recorded in an interface field of the searched ARP table entries; wherein at least two interfaces of a switching device connected by a virtual gateway formed based on VRRP are recorded in the first interface group, and the interfaces recorded in the second interface group are used for forwarding data packets. Through the above method, the reliability of the switching device can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present specification relates to the technical field of communication, and particularly relates to a master-slave switching method and device. BACKGROUND

[0002] With the development of network technology, the requirement for network reliability is gradually improved. In networking, in order to avoid the data interaction interruption caused by the failure or congestion of a single network device, a plurality of network devices can be used to form redundancy to avoid the interruption of interaction.

[0003] On the side of the gateway device, the virtualization of the gateway device can be realized through VRRP (Virtual Router Redundancy Protocol), and the master-slave of the gateway device can be realized through the virtualization.

[0004] After the virtualization of the switching device and the gateway is realized, a switching device needs to learn a large number of ARP (Address Resolution Protocol) from the gateway. When the ARP message is received by the switching chip of the switching device, it needs to be uploaded to the processor of the switching device for ARP learning. After learning the ARP table item, the learned ARP table item needs to be issued to the switching chip to guide the subsequent data message forwarding. When the gateway device performs master-slave switching based on VRRP, the ARP table item stored in the switching device needs to be refreshed from one interface to another interface. In this process, due to the limitation of the switching chip, the number of ARP table items that can be learned per second is limited. A large number of ARP table item refreshes will cause message loss when forwarding based on the un-refreshed APR table item, and the reliability of the switching device is reduced. SUMMARY

[0005] In order to overcome the problems in the related art, the present specification provides a master-slave switching method and device.

[0006] In combination with the first aspect of the embodiments of the present specification, the present application provides a master-slave switching method applied to a switching chip, comprising:

[0007] determining the incoming interface of the received ARP message, and obtaining the MAC address information carried in the ARP message;

[0008] finding the corresponding MAC address table item in the MAC address table according to the MAC address information, and finding the corresponding ARP table item in the ARP table;

[0009] if the out interface recorded in the MAC address table entry is different from the in interface and the in interface belongs to the first interface group, updating the out interface recorded in the found MAC address table entry to the in interface, and modifying the interface recorded in the second interface group to the in interface according to the second interface group index recorded in the interface field of the found ARP table entry;

[0010] The first interface group records at least two interfaces of a switching device connected by a virtual gateway formed based on VRRP, and the interface recorded in the second interface group is used for forwarding data packets.

[0011] Optionally, the method further comprises:

[0012] receiving a data packet;

[0013] sending the data packet to a gateway device in the virtual gateway through the interface recorded in the second interface group.

[0014] Optionally, the method further comprises:

[0015] sending the received ARP packet to the processor to enable the processor to perform ARP learning according to the ARP packet and generate an ARP table entry;

[0016] After finding the corresponding MAC address table entry in the MAC address table according to the MAC address information and finding the corresponding ARP table entry in the ARP table, the method further comprises:

[0017] if the interface recorded in the interface field of the ARP table entry issued by the processor belongs to the first interface group, updating the interface field to the second interface group index and recording the updated ARP table entry.

[0018] Further, after finding the corresponding MAC address table entry in the MAC address table according to the MAC address information and finding the corresponding ARP table entry in the ARP table, the method further comprises:

[0019] if the interface recorded in the interface field of the issued ARP table entry does not belong to the first interface group, recording the issued ARP table entry.

[0020] Optionally, the method further comprises:

[0021] sending the received ARP packet to the processor to enable the processor to perform ARP learning according to the ARP packet and generate an ARP table entry;

[0022] After updating the out interface recorded in the found MAC address table entry to the in interface and modifying the interface recorded in the second interface group to the in interface according to the second interface group index recorded in the interface field of the found ARP table entry, the method further comprises:

[0023] receiving the ARP entry issued by the processor;

[0024] If the interface recorded in the interface field of the issued ARP entry belongs to the first interface group, the interface field is updated to the second interface group index, and the updated ARP entry is recorded.

[0025] Optionally, after the corresponding MAC address table entry is found in the MAC address table according to the MAC address information, and the corresponding ARP entry is found in the ARP table, the method further comprises:

[0026] If the out interface recorded in the MAC address table entry is different from the in interface and the in interface does not belong to the first interface group, the out interface recorded in the MAC address table entry is updated to the in interface.

[0027] In combination with the second aspect of the embodiments of the present application, the present application provides a master-backup switching device applied to a switching chip, comprising:

[0028] The parsing unit is configured to determine the in interface of the received ARP packet and acquire the MAC address carried in the ARP packet.

[0029] The finding unit is configured to find the corresponding MAC address table entry in the MAC address table according to the MAC address information, and find the corresponding ARP entry in the ARP table.

[0030] The switching unit is configured to, if the out interface recorded in the found MAC address table entry is different from the in interface and the in interface belongs to the first interface group, update the out interface recorded in the found MAC address table entry to the in interface, and modify the interface recorded in the second interface group to the in interface according to the second interface group index recorded in the interface field of the found ARP entry.

[0031] The first interface group records at least two interfaces of the switching device connected by the virtual gateway formed based on the VRRP, and the interface recorded in the second interface group is used for forwarding data packets.

[0032] Optionally, the device further comprises:

[0033] The receiving unit is configured to receive data packets.

[0034] The sending unit is configured to send the data packets to the gateway device in the virtual gateway through the interface recorded in the second interface group.

[0035] Optionally, the device further comprises:

[0036] The sending unit is configured to send the data packets to the gateway device in the virtual gateway through the interface recorded in the second interface group.

[0037] The modification unit is configured to update the interface field to the index of the second interface group and record the updated ARP table item if the interface recorded in the interface field of the ARP table item issued by the processor belongs to the first interface group.

[0038] Optionally, the apparatus further comprises:

[0039] The recording unit is configured to record the issued ARP table item if the interface recorded in the interface field of the issued ARP table item does not belong to the first interface group.

[0040] Optionally, the apparatus further comprises:

[0041] The sending unit is configured to send the received ARP packet to the processor so that the processor performs ARP learning according to the ARP packet and generates an ARP table item.

[0042] The receiving unit is configured to receive the ARP table item issued by the processor.

[0043] The modification unit is configured to update the interface field to the index of the second interface group and record the updated ARP table item if the interface recorded in the interface field of the ARP table item issued by the processor belongs to the first interface group.

[0044] Optionally, the apparatus further comprises:

[0045] The updating unit is configured to update the egress interface recorded in the MAC address table item to the ingress interface if the egress interface recorded in the MAC address table item is different from the ingress interface and the ingress interface does not belong to the first interface group.

[0046] In combination with the third aspect of the embodiments of the present specification, the present application provides a switching device comprising a switching chip;

[0047] The switching chip is configured to determine the ingress interface of the received ARP packet, acquire the MAC address information carried in the ARP packet, find the corresponding MAC address table item in the MAC address table and find the corresponding ARP table item in the ARP table, update the egress interface recorded in the found MAC address table item to the ingress interface if the egress interface recorded in the MAC address table item is different from the ingress interface and the ingress interface belongs to the first interface group, and modify the interface recorded in the second interface group to the ingress interface according to the index of the second interface group recorded in the interface field of the found ARP table item.

[0048] The first interface group records at least two interfaces of the switching device connected to the virtual gateway formed based on the VRRP, and the interface recorded in the second interface group is used for forwarding data packets.

[0049] Optionally, the switching device further comprises a processor.

[0050] The switch chip is further configured to send the received ARP packet to the processor.

[0051] The processor is configured to perform ARP learning on the ARP packet and generate an ARP entry.

[0052] The switch chip is further configured to, if the interface recorded in the interface field of the ARP entry issued by the processor belongs to the first interface group, update the interface field to the index of the second interface group and record the updated ARP entry.

[0053] Further, the switch chip is further configured to, if the interface recorded in the interface field of the issued ARP entry does not belong to the first interface group, record the issued ARP entry.

[0054] Optionally, the switch chip is further configured to send the received ARP packet to the processor.

[0055] The processor is further configured to perform ARP learning on the ARP packet and generate an ARP entry.

[0056] The switch chip is further configured to receive the ARP entry issued by the processor, and if the interface recorded in the interface field of the issued ARP entry belongs to the first interface group, update the interface field to the index of the second interface group and record the updated ARP entry.

[0057] Optionally, the switch chip is further configured to, if the egress interface recorded in the MAC address entry is different from the ingress interface and the ingress interface does not belong to the first interface group, update the egress interface recorded in the MAC address entry to the ingress interface.

[0058] The technical solutions provided by the embodiments of the present specification can include the following beneficial effects:

[0059] In the embodiments of the present specification, when the master / standby switching of the VRRP master / standby gateway device occurs, the MAC address entry stored in the switch chip is refreshed according to the ingress interface of the ARP packet received by the switching device, and when the ingress interface belongs to the preset first interface group, the interface in the second interface group used to guide the subsequent data packet forwarding is modified, thereby avoiding the data flow caused by the large number of refreshes of the ARP entries stored in the switch chip due to the ARP learning during the master / standby switching of the gateway device, and improving the reliability of the switching device.

[0060] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present specification. BRIEF DESCRIPTION OF DRAWINGS

[0061] The accompanying drawings incorporated in the specification and constituting a part of the specification illustrate embodiments consistent with the present specification and serve to explain the principles of the present specification together with the specification.

[0062] Figure 1 is a flow chart of a master-slave switching method involved in the present application;

[0063] Figure 2 is a network structure diagram to which a master-slave switching method involved in the present application is applied;

[0064] Figure 3 is a network structure diagram of a master-slave switching method involved in an embodiment of the present application, wherein the gateway device 1 sends an ARP packet;

[0065] Figure 4 is a network structure diagram of a master-slave switching method involved in an embodiment of the present application, wherein the gateway device master-slave switches, and the gateway device 2 sends an ARP packet;

[0066] Figure 5 is a network structure diagram of a master-slave switching method involved in an embodiment of the present application, wherein the host sends a data packet;

[0067] Figure 6 is a structural schematic diagram of a master-slave switching device involved in the present application;

[0068] Figure 7 is a structural schematic diagram of a switching device involved in the present application. DETAILED DESCRIPTION

[0069] The exemplary embodiments will be described in detail herein below with reference to the drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all the embodiments consistent with the present description.

[0070] The present application provides a master-slave switching method, which is applied to a switching chip, such as Figure 1 as shown, comprising:

[0071] S100, determining an incoming interface of a received ARP packet, and obtaining MAC address information carried in the ARP packet.

[0072] as shown in Figure 2In the shown networking, at least two gateway devices of entity form a virtual gateway based on VRRP, the virtual gateway is assigned a MAC (Media Access Control) address, the assigned MAC address is different from the at least two gateway devices of entity, and can be referred to as a virtual MAC address, and the at least two gateway devices can be distinguished as a primary gateway device and a backup gateway device. The virtual gateway is externally regarded as a gateway device, and the forwarding is processed through the virtual MAC address. Each gateway device is connected with the switching device through an interface. The virtual gateway is also assigned an IP (Internet Protocol) address. In addition to the above-mentioned MAC address, the MAC address information can also include a VLAN (Virtual Local Area Network) identifier, and different MAC address tables and ARP tables can be stored in each VLAN corresponding to the VLAN identifier.

[0073] After the networking is established, an ARP table entry can be generated on the switching device, which can include an IP address and the MAC address, or a VLAN identifier, a MAC address and an IP address, which can be set according to actual needs.

[0074] When the primary gateway device in the virtual gateway fails, the gateway device performs primary-backup switching, that is, the current primary gateway device is switched to the backup gateway device, and the current backup gateway device is switched to the primary gateway device. At this time, the new primary gateway device sends an ARP packet (generally a gratuitous ARP packet) to the switching device. In hardware forwarding, the switching device includes a switching chip and a processor, the switching chip receives the ARP packet and parses it to obtain the MAC address information carried therein, and records the incoming interface of the ARP packet.

[0075] In addition, when the switching chip parses the received packet, it is determined that the packet type is 0x0806, which can confirm that the packet is an ARP packet. Based on the original process of ARP interaction, when the switching chip determines that the packet is an ARP packet, the ARP packet needs to be uploaded to the processor for processing to update the software table maintained by the processor. This does not affect the processing of the switching chip based on the ARP packet, and the uploading of the processor and the processing of the switching chip can be performed in parallel.

[0076] S101, according to the MAC address information, find the corresponding MAC address table entry in the MAC address table, and find the corresponding ARP table entry in the ARP table.

[0077] When hardware forwarding is performed, the processor sends the learned ARP table item and MAC address table item and other items used to guide forwarding to the switch chip for storage, so that the switch chip performs table lookup forwarding based on these items.

[0078] In order to enable the switching device to link to the master / standby switching of the gateway device, the switch chip queries the MAC address table and ARP table stored in the switch chip according to the MAC address information parsed from the ARP packet.

[0079] S102, if the out interface recorded in the MAC address table item is different from the in interface and the in interface belongs to the first interface group, the out interface recorded in the found MAC address table item is updated to the in interface, and the interface recorded in the second interface group is modified to the in interface according to the second interface group index recorded in the interface field of the found ARP table item.

[0080] The processor sets two interface groups in the switch chip, which are respectively called the first interface group and the second interface group, wherein the first interface group records at least two interfaces of the switching device connected by the virtual gateway formed based on VRRP, and the interface recorded in the second interface group is used to forward data packets. One interface group can be found by corresponding index.

[0081] When the switch chip looks up the MAC address table through the virtual MAC address of the virtual gateway, the MAC address table item pointing to the virtual gateway can be obtained, and the out interface in the found MAC address table item can be obtained. The out interface is the out interface when the data packet is currently sent to the virtual gateway, that is, the interface connected by the current master gateway device.

[0082] Since the master / standby switching of the gateway device in the virtual gateway occurs, the in interface of the ARP packet received by the switching device is different from the out interface recorded in the MAC address table item. At this time, the switch chip looks up whether the in interface is recorded in the first interface group based on the stored first interface group index. If the in interface is recorded in the first interface group, it means that the in interface is the interface when the master / standby switching of the gateway device in the virtual gateway is performed. Through the driver, the switch chip can refresh the out interface in the MAC address table item and modify it to the in interface of the ARP packet entering the switching device this time.

[0083] In the ARP table, the MAC address corresponding to the ARP table item found by the MAC address information is also the MAC address of the virtual gateway, but the interface pointing to the virtual gateway in the ARP table item does not change.

[0084] In the current implementation, after the exchange chip sends the ARP packet to the processor, the processor needs to learn the ARP and then issue the generated ARP entry, and the exchange chip refreshes the ARP entry stored in itself based on the issued ARP entry, so as to realize the change of the interface in the ARP table pointing to the virtual gateway and complete the master-slave switching of the gateway device in the virtual gateway. The learning process of the ARP includes the processes of sending the ARP packet, learning the ARP by the processor, and issuing and refreshing the ARP entry in the exchange chip, which requires the processing of the processor and the interaction between the processor and the exchange chip. Since the processing capability of the exchange chip is low, it becomes the bottleneck of the ARP entry refreshing. When the gateway device is switched, a large number of ARP entries need to be refreshed, thereby reducing the reliability of the exchange device in data packet interaction.

[0085] In the present application, after it is determined that the ingress interface of the ARP packet belongs to the first interface group and the refreshing of the MAC address entry is completed, the exchange chip finds the ARP entry according to the MAC address information. The second interface group index is obtained in the interface field in the ARP entry, and the ingress interface is updated to the second interface group.

[0086] When the master-slave switching is performed, the exchange chip in the exchange device does not need to send the ARP packet to the processor and then issue the ARP entry by the processor to refresh the interface, but when it is determined that the ingress interface belongs to the interface connected between the master-slave gateway device recorded in the first interface group and the exchange device, the exchange chip refreshes the interface recorded in the second interface group and actually used for data packet forwarding, completes the refreshing of the ARP entry in the master-slave switching process, avoids the problem that the low processing capability of the exchange chip becomes the bottleneck of the ARP entry refreshing, and improves the reliability of the exchange device in data interaction.

[0087] Optionally, the method further comprises:

[0088] S103, receiving a data packet.

[0089] S104, sending the data packet to the gateway device in the virtual gateway through the interface recorded in the second interface group.

[0090] After the exchange chip receives the data packet, the destination MAC address and the second interface group index in the interface field are determined by querying the ARP entry in the data packet. Based on the interface recorded in the second interface group, the data packet is forwarded to the gateway device in the virtual gateway.

[0091] That is, when the switching chip in the switching device forwards the data packet, the interface field in the ARP entry records not a certain specific physical interface, but is associated to the second interface group through the index, and the second interface group records the interface used for actually forwarding the data packet as described above. Through the interface recorded in the second interface group, the data packet can be sent to the current active gateway device in the virtual gateway.

[0092] Optionally, the method further comprises:

[0093] S105, the received ARP packet is uploaded to the processor to enable the processor to perform ARP learning according to the ARP packet and generate an ARP entry.

[0094] According to the current ARP packet processing flow, when the switching chip determines that the received packet is an ARP packet according to the packet type of the received packet, the ARP packet can be redirected to the processor for processing through the pre-configured ACL (Access Control List).

[0095] The processor performs software ARP learning according to the ARP packet, generates an ARP entry corresponding to the ARP packet, and issues the ARP entry to the switching chip. At this time, the interface in the ARP entry is a physical interface, and the ARP entry still needs to be refreshed in the form of uploading the ARP packet to the processor for processing and then issuing the ARP entry after processing when the active-standby switching is performed.

[0096] After the step S101, according to the MAC address information, the corresponding MAC address entry is found in the MAC address table, and the corresponding ARP entry is found in the ARP table, the method further comprises:

[0097] S106, if the interface recorded in the interface field of the ARP entry issued by the processor belongs to the first interface group, the interface field is updated to the second interface group index, and the updated ARP entry is recorded.

[0098] After the switching chip receives the ARP entry issued by the processor, it needs to determine whether the interface in the ARP entry is the interface of the switching device connected to the gateway device in the virtual gateway (i.e. contained in the first interface group) corresponding to the virtual gateway. If so, the switching chip can determine that the sender of the ARP entry may have a problem of active-standby switching in the future, therefore, the interface field in the issued ARP entry needs to be updated to the second interface group index and recorded, so as to avoid the problem of packet loss of the switching device caused by a large amount of time required for refreshing the ARP entry in the future.

[0099] Further, after the step S101 of searching the corresponding MAC address entry in the MAC address table according to the MAC address information and searching the corresponding ARP entry in the ARP table, the method further comprises:

[0100] S107, if the interface recorded in the interface field of the issued ARP entry does not belong to the first interface group, recording the issued ARP entry.

[0101] If the interface recorded in the interface field of the issued ARP entry does not belong to the first interface group, it can be determined that the gateway device does not exist in the master and standby, and the switching chip can record the issued ARP entry according to the current process.

[0102] Optionally, the method further comprises:

[0103] S106, sending the received ARP packet to the processor to enable the processor to perform ARP learning according to the ARP packet and generate an ARP entry.

[0104] According to the current ARP packet processing process, when the switching chip determines that the received packet is an ARP packet according to the packet type of the received packet, the ARP packet can be redirected to the processor for processing through the pre-configured ACL (Access Control List).

[0105] The processor performs software ARP learning according to the ARP packet, generates a corresponding ARP entry, and issues the ARP entry to the switching chip. At this time, the interface in the ARP entry is a physical interface, and the ARP entry still needs to be refreshed by sending the ARP packet to the processor for processing and issuing the ARP entry after the processor processing when the master and standby switching is performed.

[0106] In the step S102, after updating the out-interface recorded in the searched MAC address entry to an in-interface and modifying the interface recorded in the second interface group in the interface field of the searched ARP entry to an in-interface according to the second interface group index recorded in the interface field of the searched ARP entry, the method further comprises:

[0107] S108, receiving the ARP entry issued by the processor;

[0108] S109, if the interface recorded in the interface field of the issued ARP entry belongs to the first interface group, updating the interface field to the second interface group index, and recording the updated ARP entry.

[0109] If the switching chip has updated the ARP entry based on the previous ARP packet, the ARP entry below the processor can be refreshed once, and after updating the interface field of the ARP entry to the second interface group index, the updated ARP entry is recorded. In the refreshing process, the aging time of the ARP entry can be extended.

[0110] Optionally, after the MAC address table is searched according to the MAC address information in step S101, and the corresponding ARP table item is searched in the ARP table, the method further comprises:

[0111] S110, if the out interface recorded in the MAC address table item is different from the in interface and the in interface does not belong to the first interface group, updating the out interface recorded in the MAC address table item to the in interface.

[0112] When the out interface is different from the in interface of the ARP packet and the in interface does not belong to the first interface group, it is indicated that the ARP packet is not related to the master and standby of the gateway device in the virtual gateway, and the out interface recorded in the MAC address table item is directly updated to the in interface of the ARP packet, which is similar to refreshing the out interface of the current MAC address table item.

[0113] In addition, it should be noted that the switching device can also be a virtual switching device formed by multiple physical switching devices based on M-LAG (Multi-chassis Link Aggregation), wherein the interfaces connected to the virtual gateway can be interfaces on different physical switching devices or interfaces on the same physical switching device, and no limitation is made.

[0114] A master and standby switching method according to the present application will be described in combination with a specific embodiment. As shown in Figure 3 In the network, two gateway devices (i.e. gateway device 1 and gateway device 2) and a switching device are included, the two gateway devices form a virtual gateway based on VRRP, wherein the gateway device 1 is a master gateway device and the gateway device 2 is a standby gateway device, the switching device is provided with interface 1 and interface 2, the interface 1 is connected to the gateway device 1 and the interface 2 is connected to the gateway device 2, and on the other side, the switching device can also be connected to a host. The first interface group and the second interface group are pre-configured in the switching device, the first interface group includes the interface 1 and the interface 2, and when the gateway device 1 is the master gateway device, the second interface group includes the interface 1.

[0115] A master and standby switching method, comprising:

[0116] S1, the gateway device 1 as the master gateway device sends an ARP packet to the switching device.

[0117] The ARP packet carries a VLAN identifier and a MAC address.

[0118] S2, the switching chip in the switching device receives the ARP packet and redirects the ARP packet to the processor based on the ACL.

[0119] After the ARP packet enters the switching chip, the switching chip acquires the packet type in the ARP packet, determines that the ARP packet is a 0x0806 ARP packet, and redirects the ARP packet to the processor based on the ACL.

[0120] When the switching chip receives the ARP packet, the switching chip can determine the interface through which the ARP packet enters the switching device, which is interface 1.

[0121] S3, the switching chip searches the ARP table based on the MAC address and the VLAN identifier carried by the ARP packet, and does not find a corresponding ARP table entry, and terminates processing of the ARP packet.

[0122] Since the ARP packet will be sent to the processor for software ARP learning, and the corresponding ARP table entry has not been stored in the switching chip, it indicates that the ARP has not been learned, and therefore, the processor is waited for learning and then issuing the ARP table entry.

[0123] S4, the processor performs ARP learning based on the ARP packet, generates an ARP table entry, and issues the learned ARP table entry to the switching chip for storage.

[0124] S5, the switching chip receives the issued ARP table entry, judges whether the content recorded in the interface field of the ARP table entry is included in the first interface group, if included in the first interface group, jumps to S6, and if not included in the first interface group, records the issued ARP table entry.

[0125] S6, the switching chip modifies the content recorded in the interface field of the issued ARP table entry to the second interface group index, and modifies the interface recorded in the second interface group to interface 1.

[0126] In the switching chip, there is an ARP table entry 1 as shown in Figure 3 , which is associated to the second interface group through the index in the interface field.

[0127] S7, the gateway device 2 detects that the gateway device 1 fails, and switches to the active gateway device of the virtual gateway.

[0128] S8, the gateway device 2 sends a gratuitous ARP packet to the switching device.

[0129] The ARP packet carries a VLAN identifier and a MAC address, and the switching chip in the switching device records interface 2 as the ingress interface through which the ARP packet enters the switching device.

[0130] S9, the switching chip in the switching device analyzes the ARP packet to acquire the VLAN identifier and the MAC address carried in the ARP packet, and searches the MAC table and the ARP table in the switching chip through the VLAN identifier and the MAC address.

[0131] After obtaining the VLAN identifier, MAC address, and IP address from the ARP packet, the switching chip queries different tables respectively, and determines MAC address table entry 1 and ARP table entry 1 based on the VLAN identifier and MAC address.

[0132] S10: The switching chip determines whether the recorded input interface belongs to the first interface group. If it belongs to the first interface group, it jumps to S11. If it does not belong to the first interface group, it can wait for the processor to send an ARP entry for refreshing.

[0133] S11. The switching chip determines whether the output interface in MAC address table entry 1 is the same as the recorded input interface. If they are different, it jumps to S12. If they are the same, it can refresh the output interface in MAC address table entry 1 based on the input interface (since it will not cause changes to the MAC address table entry, this process can be skipped directly, i.e., no processing is performed).

[0134] S12. The switching chip modifies the outgoing interface in MAC address table entry 1 to the recorded incoming interface, and switches the recorded interface 1 in the second interface group to interface 2 based on the index recorded in the interface field of ARP table entry 1.

[0135] This completes the process of switching between primary and backup virtual gateway devices when the primary gateway device fails.

[0136] like Figure 4 As shown, changing interface 1 in MAC address table entry 1 to interface 2 completes the update of information in the MAC address table during primary / standby switchover.

[0137] S13. The switching device receives the data packet, looks up the ARP table based on the IP address in the data packet, and forwards it using the determined MAC address and interface 2 recorded in the second interface group.

[0138] like Figure 5 As shown, the interface field of ARP entry 1 contains the index of the second interface group. The interface 2 recorded in the second interface group is queried, and the data packet is forwarded to the gateway device 2 in the virtual gateway through interface 2.

[0139] Correspondingly, this application provides a primary / standby switching device applied to a switching chip, such as... Figure 6 As shown, it includes:

[0140] The parsing unit is used to determine the ingress interface of the received ARP packet and obtain the MAC address carried in the ARP packet;

[0141] The lookup unit is used to search for the corresponding MAC address entry in the MAC address table and the corresponding ARP entry in the ARP table based on the MAC address information.

[0142] The switching unit is configured to update the out interface recorded in the found MAC address table item to the in interface if the out interface recorded in the MAC address table item is different from the in interface and the in interface belongs to the first interface group, and modify the interface recorded in the second interface group to the in interface according to the second interface group index recorded in the interface field of the found ARP table item.

[0143] The first interface group records at least two interfaces of a switching device connected by a virtual gateway formed based on VRRP, and the interfaces recorded in the second interface group are used for forwarding data packets.

[0144] Optionally, the apparatus further comprises:

[0145] The receiving unit is configured to receive data packets.

[0146] The sending unit is configured to send the data packets to a gateway device in the virtual gateway through the interfaces recorded in the second interface group.

[0147] Optionally, the apparatus further comprises:

[0148] The sending unit is configured to send the data packets to a gateway device in the virtual gateway through the interfaces recorded in the second interface group.

[0149] The modification unit is configured to update the interface field to the second interface group index and record the updated ARP table item if the interface recorded in the interface field of the ARP table item issued by the processor belongs to the first interface group.

[0150] Optionally, the apparatus further comprises:

[0151] The recording unit is configured to record the issued ARP table item if the interface recorded in the interface field of the issued ARP table item does not belong to the first interface group.

[0152] Optionally, the apparatus further comprises:

[0153] The sending unit is configured to send the data packets to a gateway device in the virtual gateway through the interfaces recorded in the second interface group.

[0154] The receiving unit is configured to receive the ARP table item issued by the processor.

[0155] The modification unit is configured to update the interface field to the second interface group index and record the updated ARP table item if the interface recorded in the interface field of the ARP table item issued by the processor belongs to the first interface group.

[0156] Optionally, the apparatus further comprises:

[0157] The updating unit is configured to update the out interface recorded in the MAC address table item to the in interface if the out interface recorded in the MAC address table item is different from the in interface and the in interface does not belong to the first interface group.

[0158] Correspondingly, the application provides a switching device, such as Figure 7 as shown in the figure, comprising a switching chip;

[0159] The switching chip is configured to determine the in interface of the received ARP packet, and acquire the MAC address information carried in the ARP packet; find the corresponding MAC address table item in the MAC address table and the corresponding ARP table item in the ARP table according to the MAC address information; if the out interface recorded in the MAC address table item is different from the in interface and the in interface belongs to the first interface group, update the out interface recorded in the found MAC address table item to the in interface, and modify the interface recorded in the second interface group to the in interface according to the second interface group index recorded in the interface field of the found ARP table item;

[0160] The first interface group records at least two interfaces of the switching device connected by the virtual gateway formed based on the VRRP, and the interface recorded in the second interface group is used for forwarding data packets.

[0161] Optionally, the switching device further comprises a processor;

[0162] The switching chip is further configured to send the received ARP packet to the processor;

[0163] The processor is configured to perform ARP learning on the ARP packet and generate an ARP table item;

[0164] The switching chip is further configured to update the interface field to the second interface group index and record the updated ARP table item if the interface recorded in the interface field of the ARP table item issued by the processor belongs to the first interface group.

[0165] Further, the switching chip is further configured to record the issued ARP table item if the interface recorded in the interface field of the issued ARP table item does not belong to the first interface group.

[0166] Optionally, the switching chip is further configured to send the received ARP packet to the processor;

[0167] The processor is further configured to perform ARP learning on the ARP packet and generate an ARP table item;

[0168] The switching chip is further configured to receive the ARP table item issued by the processor; if the interface recorded in the interface field of the issued ARP table item belongs to the first interface group, update the interface field to the second interface group index and record the updated ARP table item.

[0169] Optionally, the switching chip is further configured to update the egress interface recorded in the MAC address table item to the ingress interface if the egress interface recorded in the MAC address table item is different from the ingress interface and the ingress interface does not belong to the first interface group.

[0170] In the embodiments of the present specification, when the master-slave switching of the VRRP master-slave gateway device occurs, the MAC address table item stored in the switching device is refreshed according to the ingress interface of the ARP packet received by the switching device, and when the ingress interface belongs to the preset first interface group, the interface in the second interface group for guiding the subsequent data packet forwarding is modified, thereby avoiding the data flow caused by the large number of refreshing of the ARP table item stored in the switching chip in a short time due to the ARP learning during the master-slave switching of the gateway device, and improving the reliability of the switching device.

[0171] The present specification is not limited to the precise construction which has been described above and illustrated in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof.

[0172] The above only represents the preferred embodiments of the present specification, and is not intended to limit the present specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of protection of the present specification.

Claims

1. A method for master-backup switchover, characterized in that, The application is applied to a switching chip, comprising: determining an incoming interface of a received ARP packet and obtaining media access control (MAC) address information carried in the ARP packet; finding a corresponding MAC address entry in a MAC address table according to the MAC address information and finding a corresponding ARP entry in an ARP table; if an outgoing interface recorded in the MAC address entry is different from the incoming interface and the incoming interface belongs to a first interface group, updating the outgoing interface recorded in the found MAC address entry to the incoming interface and modifying an interface recorded in a second interface group to the incoming interface according to a second interface group index recorded in an interface field of the found ARP entry; wherein the first interface group records at least two interfaces of a switching device connected by a virtual gateway formed based on a virtual router redundancy protocol (VRRP), and the interface recorded in the second interface group is used for forwarding a data packet.

2. The method of claim 1, wherein, further comprising: receiving a data packet; sending the data packet to a gateway device in the virtual gateway through the interface recorded in the second interface group.

3. The method of claim 1, wherein, further comprising: sending the received ARP packet to a processor to enable the processor to perform ARP learning according to the ARP packet and generate an ARP entry; after finding the corresponding MAC address entry in the MAC address table according to the MAC address information and finding the corresponding ARP entry in the ARP table, further comprising: if an interface recorded in an interface field of the ARP entry issued by the processor belongs to the first interface group, updating the interface field to a second interface group index and recording the updated ARP entry.

4. The method of claim 3, wherein, after finding the corresponding MAC address entry in the MAC address table according to the MAC address information and finding the corresponding ARP entry in the ARP table, further comprising: if an interface recorded in an interface field of the issued ARP entry does not belong to the first interface group, recording the issued ARP entry.

5. The method of claim 1, wherein, further comprising: sending the received ARP packet to a processor to enable the processor to perform ARP learning according to the ARP packet and generate an ARP entry; after updating the outgoing interface recorded in the found MAC address entry to the incoming interface and modifying the interface recorded in the second interface group to the incoming interface according to the second interface group index recorded in the interface field of the found ARP entry, further comprising: receiving the ARP entry issued by the processor; if an interface recorded in an interface field of the issued ARP entry belongs to the first interface group, updating the interface field to a second interface group index and recording the updated ARP entry.

6. The method of claim 1, wherein, after finding the corresponding MAC address entry in the MAC address table according to the MAC address information and finding the corresponding ARP entry in the ARP table, further comprising: if an outgoing interface recorded in the MAC address entry is different from the incoming interface and the incoming interface does not belong to the first interface group, updating the outgoing interface recorded in the MAC address entry to the incoming interface.

7. A master-backup switchover device, characterized by comprising: the application is applied to a switching chip, comprising: The analysis unit is configured to determine an incoming interface of the received ARP packet and acquire MAC address information carried in the ARP packet; The searching unit is configured to search for a corresponding MAC address entry in a MAC address table according to the MAC address information and search for a corresponding ARP entry in an ARP table; The switching unit is configured to update an outgoing interface recorded in the searched MAC address entry to the incoming interface, and modify an interface recorded in a second interface group to the incoming interface according to a second interface group index recorded in an interface field of the searched ARP entry, if the outgoing interface recorded in the MAC address entry is different from the incoming interface and the incoming interface belongs to a first interface group. The first interface group records at least two interfaces of a switching device connected to a virtual gateway formed based on VRRP, and the interface recorded in the second interface group is used for forwarding a data packet.

8. The apparatus of claim 7, wherein, Further comprising: The receiving unit is configured to receive a data packet; The sending unit is configured to send the data packet to a gateway device in the virtual gateway through the interface recorded in the second interface group.

9. The apparatus of claim 7, wherein, Further comprising: The sending unit is configured to send the data packet to a gateway device in the virtual gateway through the interface recorded in the second interface group. Further comprising:

10. A switching device, characterized by The sending unit is configured to send the data packet to a gateway device in the virtual gateway through the interface recorded in the second interface group. The switching chip is configured to determine an incoming interface of the received ARP packet and acquire MAC address information carried in the ARP packet; search for a corresponding MAC address entry in a MAC address table according to the MAC address information and search for a corresponding ARP entry in an ARP table; If the outgoing interface recorded in the MAC address entry is different from the incoming interface and the incoming interface belongs to a first interface group, the switching chip is configured to update an outgoing interface recorded in the searched MAC address entry to the incoming interface, and modify an interface recorded in a second interface group to the incoming interface according to a second interface group index recorded in an interface field of the searched ARP entry. The first interface group records at least two interfaces of a switching device connected to a virtual gateway formed based on VRRP, and the interface recorded in the second interface group is used for forwarding a data packet.

11. The switching device of claim 10, wherein, Further comprising a processor; The processor is configured to send the received ARP packet to the processor to enable the processor to perform ARP learning according to the ARP packet and generate an ARP entry; The switching chip is further configured to update an interface field of the ARP entry issued by the processor to a second interface group index and record the updated ARP entry, if the interface recorded in the interface field belongs to a first interface group.

Citation Information

Patent Citations

  • Message forwarding method and device

    CN104601460A

  • Message forwarding method and device

    CN112311680A