Business response method and device, equipment, storage medium and program product
By broadcasting ARP requests and listening messages in the data link layer, the interface status is determined to respond to business needs, which solves the problem of inability to achieve business disaster recovery protection in the existing technology, and achieves automatic disaster recovery protection and stability improvement.
Patent Information
- Application Number
- CN202410977100.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-09-27
AI Technical Summary
Existing technology cannot achieve business disaster recovery protection without meeting VRRP address requirements. As a result, data forwarding services cannot be provided for user equipment in a timely manner when network equipment fails, and there are risks of IP address conflicts and route flapping.
By broadcasting ARP requests to network devices based on preset time intervals in the data link layer, monitoring ARP messages, determining the interface status based on the message content, and determining the service response strategy based on the status, the service response is implemented to avoid unnecessary data forwarding. Conflicts with IP address.
It realizes automatic disaster recovery protection for services that do not meet VRRP address requirements, reduces the risk of business interruption, improves the stability of data forwarding services, and avoids IP address conflicts and route shocks.
Smart Images

Figure CN118713987A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of transmission technology, and in particular to a service response method, device, equipment, storage medium and program product. Background Art
[0002] The current Virtual Router Redundancy Protocol (VRRP) solution can solve the problem of business disaster recovery protection, but it has the problem of high IP address requirements. Since the VRRP protocol needs to generate an additional virtual IP address in the same network segment between the primary and backup devices as the business gateway, a single business needs at least a 29-bit subnet mask network address segment to meet the demand. Since the current IP address resources are very scarce, general small static Internet dedicated lines cannot meet this demand. For the current Internet dedicated line business that uses a 30-bit subnet mask address segment, the VRRP protocol cannot be used.
[0003] Currently, it is not possible to implement service disaster recovery protection without meeting the VRRP address requirements. Without meeting the VRRP address requirements, there are not enough IP addresses to configure additional network devices as service backup. Therefore, when a network device providing data forwarding services fails, other network devices cannot accurately determine whether to provide data forwarding services to user devices, resulting in the inability to continue to provide data forwarding services to user devices in a timely manner. In addition, there is a risk of route flapping due to IP address conflicts between network devices. Summary of the invention
[0004] The main purpose of the present invention is to provide a service response method, device, equipment, storage medium and program product, aiming to solve the technical problem that the prior art cannot realize service disaster recovery protection without meeting VRRP address requirements.
[0005] To achieve the above object, the present invention provides a service response method, which is applied to a network device and comprises the following steps:
[0006] Broadcasting an ARP request to a network device in a communication connection in a data link layer based on a preset time interval, wherein a source IP address and a target IP address of the ARP request are both preset virtual addresses;
[0007] Monitor an ARP message, where the ARP message includes a first message sent by a network device connected to the communication layer in the data link layer and / or a second message sent by a user device connected to the interface, where the source IP address and the target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device;
[0008] Determine the interface status of the connection between the network device and the user equipment based on the monitoring result of the ARP message;
[0009] A service response strategy is determined according to the interface status, and a service response is performed based on the service response strategy.
[0010] Optionally, the interface state includes a first state and a second state;
[0011] When the interface state is the first state, the service response strategy is to agree to respond to the first message and refuse to respond to the second message, so as to refuse to provide the data forwarding service for the user equipment;
[0012] When the interface state is the second state, the service response policy is to agree to respond to the first message and to agree to respond to the second message, so as to agree to provide the data forwarding service for the user equipment.
[0013] Optionally, the monitoring result of the ARP message includes at least one of the following:
[0014] A source MAC address of a first message sent by a network device in a communication connection in a data link layer;
[0015] a time interval for sending a first message by a network device in a communication connection in a data link layer;
[0016] The destination IP address, source IP address, and source MAC address of the second message sent by the user equipment connected to the interface.
[0017] Optionally, the determining, based on the monitoring result of the ARP message, the interface state of the connection between the network device and the user equipment includes:
[0018] Determine whether a time interval for sending a first message by a network device in a communication connection in the data link layer exceeds a preset time interval;
[0019] If the sending time interval exceeds the preset time interval, updating the state of the interface connected to the user equipment to a second state;
[0020] If the sending time interval does not exceed the preset time interval, the interface state of the connection between the network device and the user equipment is determined based on the source MAC address of the first message sent by the network device in the communication connection in the data link layer.
[0021] Optionally, the determining the interface state of the connection between the network device and the user equipment based on the source MAC address of the first message sent by the network device in the communication connection in the data link layer includes:
[0022] Comparing the source MAC address of the first message sent by the network device in the communication connection in the data link layer with the own MAC address;
[0023] If the source MAC address is smaller than the own MAC address, updating the state of the interface connected to the user equipment to the first state;
[0024] If the source MAC address is greater than the own MAC address, the state of the interface connected to the user equipment is updated to a second state.
[0025] Optionally, after monitoring the ARP message, the method further includes:
[0026] When an ARP message is received, obtaining address mapping information of the ARP message based on the source IP address and the source MAC address of the ARP message;
[0027] The ARP table entry is updated based on the address mapping information.
[0028] In addition, to achieve the above object, the present invention further provides a service response device, the service response device comprising:
[0029] A broadcast sending module, used for broadcasting an ARP request to a network device connected in communication in a data link layer based on a preset time interval, wherein the source IP address and the target IP address of the ARP request are both preset virtual addresses;
[0030] A message monitoring module, used to monitor ARP messages, wherein the ARP messages include a first message sent by a network device connected to the communication in the data link layer and / or a second message sent by a user device connected to the interface, wherein the source IP address and the target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device;
[0031] An interface status maintenance module, used to determine the interface status of the connection between the network device and the user equipment based on the monitoring result of the ARP message;
[0032] The service response module is used to determine the service response strategy according to the interface status and perform service response based on the service response strategy.
[0033] In addition, to achieve the above objectives, the present application also proposes a business response device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the business response method described above.
[0034] In addition, to achieve the above objectives, the present application also proposes a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the business response method described above are implemented.
[0035] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the business response method described above are implemented.
[0036] The present invention broadcasts and sends ARP requests to network devices in communication connection in the data link layer based on a preset time interval, wherein the source IP address and the target IP address of the ARP request are both preset virtual addresses, monitors ARP messages, wherein the ARP messages include a first message sent by the network device in communication connection in the data link layer and / or a second message sent by a user device connected to the interface, wherein the source IP address and the target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device, determines the interface status of the connection between the network device and the user device based on the monitoring result of the ARP message, and determines the service response strategy according to the interface status, And perform business response based on the business response strategy; since the present invention monitors the first message sent by the network device and the second message sent by the user device, and determines the interface status based on the monitoring result of the ARP message, and thus determines whether it is necessary to provide data forwarding service for the user device based on the interface status, it effectively avoids activating the interface between the user device when there is no need to provide data forwarding service, causing the problem of IP address conflict, and realizes that when it is necessary to provide data forwarding service, the interface is activated in time to provide data service to the user, thereby realizing automatic disaster recovery protection of data forwarding service, effectively reducing the risk of business interruption, and improving the stability of data forwarding service. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0039] Figure 1 It is a structural diagram of a service response device in a hardware operating environment involved in an embodiment of the present invention;
[0040] Figure 2 This is a flow chart of a first embodiment of a service response method of the present invention;
[0041] Figure 3 This is a schematic diagram of a static Internet dedicated line access model;
[0042] Figure 4 A network topology diagram in the first embodiment of the service response method of the present invention;
[0043] Figure 5 This is a flow chart of a second embodiment of a service response method of the present invention;
[0044] Figure 6 This is a service schematic diagram of the initial access of a user equipment to a network device in the second embodiment of the service response method of the present invention;
[0045] Figure 7 This is a schematic diagram of a service traffic forwarding model for a user device initially accessing a network device in a second embodiment of a service response method of the present invention;
[0046] Figure 8 This is a schematic diagram of network device services when a link from user equipment C to network equipment A fails in the second embodiment of the service response method of the present invention;
[0047] Fig. 9 This is a schematic diagram of a service flow model when network device A fails in the second embodiment of the service response method of the present invention;
[0048] Fig.10 This is a schematic diagram of network device services when a link from user equipment C to network equipment B fails in the second embodiment of the service response method of the present invention;
[0049] Fig.11 This is a schematic diagram of a service flow model when network device B fails in the second embodiment of the service response method of the present invention;
[0050] Fig.12 This is a structural block diagram of the first embodiment of the service response device of the present invention.
[0051] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0052] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0053] Reference Figure 1 , Figure 1 The diagram is a schematic diagram of the business response device structure of the hardware operating environment involved in the embodiment of the present invention.
[0054] like Figure 1As shown, the business response device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0055] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the business response device, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.
[0056] like Figure 1 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a service response program.
[0057] exist Figure 1 In the business response device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the business response device of the present invention can be set in the business response device, and the business response device calls the business response program stored in the memory 1005 through the processor 1001, and executes the business response method provided by the embodiment of the present invention.
[0058] The embodiment of the present invention provides a service response method, referring to Figure 2 , Figure 2 It is a flowchart of the first embodiment of the service response method of the present invention.
[0059] In this embodiment, the service response method is applied to a network device, and the service response method includes the following steps:
[0060] Step S10: Broadcasting an ARP request to network devices in communication connection in the data link layer based on a preset time interval.
[0061] It should be understood that the traditional static Internet dedicated line access model is Figure 3 As shown in the figure, users access the operator network through Layer 2 devices (OLT, switch, etc.), the switch / OLT is dual-connected to different routers, and the VRRP protocol is enabled between the service VLAN sub-interfaces of the two routers to protect the service. When the link between the switch and the active router is interrupted, the service gateway automatically switches to the backup router.
[0062] The current VRRP solution can solve the problem of business disaster recovery protection, but there is a problem of high IP address requirements. Since the VRRP protocol needs to generate an additional virtual IP address in the same network segment between the primary and backup devices as a business gateway, a single business requires at least a network address segment with a 29-bit subnet mask to meet the demand. Since the current IP address resources are very scarce, generally small static Internet dedicated lines cannot meet this demand. For the current Internet dedicated line services that use a 30-bit subnet mask address segment, since the VRRP protocol cannot be used, there is no better business protection solution. The existing network generally keeps the backup side link closed, and manually switches to the backup side to achieve protection when the primary side is interrupted.
[0063] It can be understood that this embodiment is used to solve the problem of protecting services that do not meet the VRRP address requirements and achieve an effect similar to VRRP. When the link between the network device A currently providing the data forwarding service and the switch is interrupted, it automatically switches to another network device B without manual intervention, thereby achieving automatic disaster recovery protection for the data forwarding service, effectively reducing the risk of service interruption and improving the stability of the data forwarding service.
[0064] It should be noted that the execution subject of this embodiment may be a network device with data processing, network communication and program running functions, such as a router, or an electronic device capable of implementing the above functions. This embodiment and the following embodiments are described below using a network device as an example.
[0065] It should be noted that the ARP request may be an Address Resolution Protocol (ARP) message, which can be used to resolve the address of the network layer (usually the IP layer) into the physical address of the data link layer (such as the Ethernet MAC layer) in a local area network (such as Ethernet). The above-mentioned ARP request may be a request message broadcasted by the service response device to the data link layer, and the source IP address and the target IP address of the ARP request are both preset virtual addresses.
[0066] Step S20: monitor ARP messages.
[0067] It should be noted that the ARP message may be an Address Resolution Protocol (ARP) message, which may be used to resolve the address of the network layer (usually the IP layer) into the physical address of the data link layer (such as the Ethernet MAC layer) in a local area network (such as Ethernet).
[0068] It can be understood that the ARP message includes a first message sent by a network device connected in communication in the data link layer and / or a second message sent by a user device connected to the interface, the source IP address and target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device.
[0069] It should be noted that, in this embodiment, Figure 4 The network topology shown is used as an example for explanation, where device A and device B are both network devices, device A and device B are three-layer network devices that are interconnected in the two-layer network (that is, device A and device B are connected in the data link layer for communication), device C is a user device, device C is only configured with the 10.1.1.2 / 30 service address, and the service gateway 10.1.1.1 / 30 address is configured on the A and B downlink interfaces respectively. Since the VRRP startup conditions are not met, the traditional configuration mode is that the B-side interface is always kept closed to prevent IP address conflicts from causing routing oscillations. When a failure occurs in the link between C and A, the B-side interface is manually opened. At this time, the B-side gateway IP is broadcast to C through ARP to realize service switching.
[0070] It is understandable that if Figure 4 As shown, both device A and device B periodically send ARP requests and / or ARP messages at the data link layer based on a preset time interval (the preset time interval is a preset time interval for broadcasting ARP requests and / or ARP messages of network devices, for example, the preset time interval can be 5 seconds, or other time intervals). Among them, the network device can send ARP requests and / or ARP messages based on a preset virtual address (for example, the preset virtual address a can be 1.1.1.1, or other virtual IP addresses).
[0071] Furthermore, in order to ensure the stability of business communications, after the above step S20, the following steps may be included:
[0072] When an ARP message is received, obtaining address mapping information of the ARP message based on the source IP address and the source MAC address of the ARP message;
[0073] The ARP table entry is updated based on the address mapping information.
[0074] It should be noted that the address mapping information may be mapping relationship information between the IP address and the MAC address of the ARP message.
[0075] It should be understood that after the network device responds to the ARP message of the user device and / or other network devices, it modifies or updates an existing mapping relationship between the IP address and the MAC address in the ARP cache table based on the address mapping information of the ARP message. The ARP cache table stores the IP addresses of other devices in the local network and their corresponding MAC addresses to facilitate quick search and direct communication at the data link layer.
[0076] It should be noted that the process of updating ARP entries helps ensure that network devices can communicate using the latest MAC address information, thereby avoiding packet loss or incorrect transmission due to outdated or incorrect mappings. In addition, the update mechanism also helps prevent network security threats such as ARP spoofing, because timely updates can overwrite malicious ARP mappings.
[0077] For example, the IP address of the user device is 10.1.1.2, MAC=3-3-3, the user device broadcasts an ARP request with gateway ip=10.1.1.1, and the network device with gateway ip=10.1.1.1 receives the ARP request, and updates the MAC=3-3-3 of 10.1.1.2 in its own ARP table.
[0078] Step S30: Determine the interface status of the connection between the network device and the user equipment based on the monitoring result of the ARP message.
[0079] It should be noted that network devices (such as Figure 4 The interface of device A and device B shown in the figure maintains an additional state S (the initial value of state S is 0, and the value of state S includes 0 and 1) and a timer T (the default is 5s, which can be customized). The network device uses any virtual IP address a (for example, a=1.1.1.1, which can be customized) to actively initiate an ARP request in which the source and destination IP addresses are both a and the MAC address is the interface's own MAC. At this time, the interface only responds to the ARP request in which the source and destination addresses are both a, and does not respond to the ARP request of any other IP, nor does it send the ARP request message of any other IP.
[0080] It can be understood that the network device updates the state S of the interface maintenance according to the monitoring result of the first message, and determines the state of the interface connected between the network device and the user equipment according to the updated state S.
[0081] It should be noted that when the state S maintained by the network device interface is 0, only ARP packets whose source IP address and target IP address (i.e., source and destination IP) are both preset virtual addresses (e.g., virtual address a) are sent and responded to, and the remaining ARP packets are neither sent nor responded to. At the same time, the state S value is updated according to the MAC status of the received message. In this state, the device normally updates its ARP table entries for ARP packets with IP≠a and IP≠this interface address.
[0082] When the state S=1 maintained by the network device interface, the interface sends and responds to ARP packets normally (including the first packet whose IP address is the preset virtual address and the second packet whose IP address is the non-preset virtual address), and at the same time maintains the broadcast sending of ARP packets whose source and destination IP are both a, which is used to maintain the heartbeat detection of the active and standby interface states.
[0083] Step S40: determining a service response strategy according to the interface status, and performing service response based on the service response strategy.
[0084] It can be understood that when the network device is in the interface maintenance state S=0, the interface state is the ARP suppression state, and the network device refuses to respond to the ARP message whose IP address is not the preset virtual address. When the network device is in the interface maintenance state S=1, the interface state is the ARP active state, and the network device agrees to respond to the ARP message whose IP address is not the preset virtual address.
[0085] In a specific implementation, the service response policy of a network device when the interface state is the ARP suppression state is to only agree to respond to ARP packets whose source IP address is a preset virtual address, and refuse to respond to ARP packets whose source IP address is not the preset virtual address. At this time, the network device refuses to provide data forwarding services to the user device, that is, it is determined that there is a fault in the link between the network device and the user device.
[0086] The service response policy of the network device when the interface status is ARP active status is to agree to respond to ARP packets whose source IP address is a preset virtual address, and agree to respond to ARP packets whose source IP address is not a preset virtual address. At this time, the network device agrees to provide data forwarding services for the user device, that is, at this time, it is determined that the link between the network device and the user device is normal.
[0087] For example, device A and device B are network devices connected for data link layer communication. Both device A and device B are connected to the user device interface. If device A is the main communication device and device B is the secondary communication device, the initial interface state of device A is the ARP active state, and the initial interface state of device B is the ARP suppressed state. When the downlink of device A is interrupted, both device A and device B cannot receive the ARP message with the IP address as the preset virtual IP address. Device B updates the interface state and adjusts the interface state to the ARP active state. Device B determines the service response strategy based on the ARP active state and starts to provide data forwarding services for the user device, thereby realizing automatic disaster recovery protection of the data forwarding service, effectively reducing the risk of service interruption and improving the stability of the data forwarding service.
[0088] This embodiment broadcasts an ARP request to a network device in communication connection in the data link layer based on a preset time interval, wherein the source IP address and the target IP address of the ARP request are both preset virtual addresses, and monitors an ARP message, wherein the ARP message includes a first message sent by a network device in communication connection in the data link layer and / or a second message sent by a user device connected to the interface, wherein the source IP address and the target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device, and the interface status of the connection between the network device and the user device is determined based on the monitoring result of the ARP message, and a service response strategy is determined according to the interface status. And perform business response based on the business response strategy; since this embodiment monitors the first message sent by the network device and the second message sent by the user device, and determines the interface status based on the monitoring result of the ARP message, and thus determines whether it is necessary to provide data forwarding service for the user device based on the interface status, it effectively avoids activating the interface between the user device when there is no need to provide data forwarding service, causing the problem of IP address conflict, and realizes that when it is necessary to provide data forwarding service, the interface is activated in time to provide data service to the user, thereby realizing automatic disaster recovery protection of data forwarding service, effectively reducing the risk of business interruption, and improving the stability of data forwarding service.
[0089] refer to Figure 5 , Figure 5 It is a flowchart of the second embodiment of the service response method of the present invention.
[0090] Based on the above first embodiment, in this embodiment, the interface state includes a first state and a second state.
[0091] It should be noted that the first state may be an ARP suppression state, in which the network device refuses to respond to ARP packets whose IP addresses are not preset virtual addresses. The second state may be an ARP active state, in which the network device agrees to respond to ARP packets whose IP addresses are not preset virtual addresses.
[0092] It is understandable that the interface of the network device maintains an additional state S (the initial value of state S is 0, and the value of state S includes 0 and 1). The network device updates the value of state S according to the monitoring result of the first ARP message, and determines the interface state based on the updated value of state S, thereby realizing the conversion of the service response attitude of the interface of the network device. When no service is needed, the network device does not respond to the request of the user device; when the service is needed, the network device agrees to respond to the request of the user device.
[0093] It should be noted that when the network device is in the interface maintenance state S=0, the interface state is the ARP suppression state, and the network device refuses to respond to ARP packets whose IP addresses are not preset virtual addresses. When the network device is in the interface maintenance state S=1, the interface state is the ARP active state, and the network device agrees to respond to ARP packets whose IP addresses are not preset virtual addresses.
[0094] It can be understood that, when the interface state is the first state, the service response strategy is to agree to respond to the first message and refuse to respond to the second message, so as to refuse to provide the data forwarding service for the user equipment;
[0095] When the interface state is the second state, the service response policy is to agree to respond to the first message and to agree to respond to the second message, so as to agree to provide the data forwarding service for the user equipment.
[0096] In a specific implementation, the service response policy of the network device when the interface state is the first state is to only agree to respond to ARP packets whose source IP address is a preset virtual address, and refuse to respond to ARP packets whose source IP address is not a preset virtual address. At this time, the network device refuses to provide data forwarding services to the user device, that is, it is determined that there is a fault in the link between the network device and the user device.
[0097] The service response strategy of the network device when the interface status is the second status is to agree to respond to ARP packets whose source IP address is a preset virtual address, and agree to respond to ARP packets whose source IP address is not a preset virtual address. At this time, the network device agrees to provide data forwarding services to the user device, that is, at this time, it is determined that the link between the network device and the user device is normal.
[0098] The monitoring result of the ARP message includes at least one of the following:
[0099] A source MAC address of a first message sent by a network device in a communication connection in a data link layer;
[0100] a time interval for sending a first message by a network device in a communication connection in a data link layer;
[0101] The destination IP address, source IP address, and source MAC address of the second message sent by the user equipment connected to the interface.
[0102] It should be noted that the source MAC address may be the MAC address of the network device that sends the first message. The above sending time interval may be the sending time interval of the first messages continuously sent by the network device.
[0103] It can be understood that the network device can monitor the time interval for sending the first message sent by the network device with communication connection in the data link layer, thereby realizing heartbeat monitoring of the interface status of other network devices. If the network device with communication connection in the data link layer fails to send the first message for more than a certain period of time, it is determined that the network device may have a link failure or cannot provide services normally. At this time, the network device is replaced to provide data forwarding services to the user device, thereby realizing accurate switching of the interface status, timely determining whether it is necessary to provide data forwarding services to the user device, and realizing rapid switching of the interface status.
[0104] Furthermore, in order to ensure the stability of the data service and implement the heartbeat monitoring of the network device, in this embodiment, the step S30 further includes:
[0105] Step S31: Determine whether the time interval for sending the first message by the network device in the communication connection in the data link layer exceeds the preset time interval.
[0106] It should be noted that the preset time interval may be a time period preset by the network device for sending ARP packets and / or sending ARP requests.
[0107] It can be understood that the network device can determine through the monitoring result of the first message whether the sending time interval of the first message sent by the network device with communication connection in the data link layer exceeds the preset time interval, thereby realizing heartbeat monitoring between network devices, thereby realizing any virtual IP (i.e., the preset virtual address) to maintain the heartbeat detection mechanism between the primary and backup gateways. Since the virtual IP address is independent of the business and can be set arbitrarily, it is only necessary to keep the primary and backup consistent without occupying business address resources.
[0108] Step S32: If the sending time interval exceeds the preset time interval, the state of the interface connected to the user equipment is updated to a second state.
[0109] It should be noted that if the sending time interval exceeds the preset time interval, it is determined that there is a link interruption abnormality in the network device with a communication connection in the data link layer, and the interface status connected to the user device is updated to the second status, that is, it agrees to respond to the second message sent by the user device and provide data forwarding services for the user device.
[0110] Step S33: If the sending time interval does not exceed the preset time interval, determining the interface status of the connection between the network device and the user equipment based on the source MAC address of the first message sent by the network device in the communication connection in the data link layer.
[0111] It should be noted that if the sending time interval does not exceed the preset time interval, the source MAC address of the first message sent by the network device of the communication connection in the data link layer is obtained, and the interface status is determined according to the source MAC address to determine whether the interface status needs to be updated in response to the second message sent by the user device, thereby providing data forwarding services to the user.
[0112] It can be understood that in this embodiment, the network devices communicating between the data link layers are configured with the same IP address (both are preset virtual addresses). By using the heartbeat detection mechanism between gateways to determine the ARP response principle of network devices (including primary and backup gateways) to the service address, the routing oscillation problem caused by IP address conflicts is avoided. The service side can achieve automatic switching between network devices providing data forwarding services without any configuration changes, thereby realizing service disaster recovery protection.
[0113] In some embodiments, the case where device C initially accesses the broadcast network of device A and device B is used as an example for description. Figure 6 , Figure 6 The service diagram of the initial access of a user device to a network device is shown below. Device C is a user device, and devices A and B are network devices interconnected on a Layer 2 network. The service process of the initial access of a user device to a network device is as follows:
[0114] The initial state of the interface of device A / B to device C is S=0 (that is, the initial interface state is the first state). After the interface is UP, device A broadcasts an ARP request with ip=1.1.1.1, mac=1-1-1, and device B also broadcasts an ARP request with ip=1.1.1.1, mac=2-2-2. After receiving the message, device A and device B compare the sizes of the two macs. The MAC of device A is smaller, so device A modifies S=1 and device B keeps S=0.
[0115] Device C broadcasts an ARP request with gateway ip=10.1.1.1. After receiving the ARP request, device A / B first checks its own status S value (i.e., detects the interface status). If device B's S=0, then device B updates its ARP entry with MAC=3-3-3 for 10.1.1.2 and does not respond to the ARP request. If device A's S=1, then device A updates its ARP entry with MAC=3-3-3 for 10.1.1.2 and responds to the ARP request normally.
[0116] Device A responds to the ARP request for the gateway address 10.1.1.1 of device C. Device C updates its ARP entry 10.1.1.1 corresponding to MAC=1-1-1. The service traffic of device C is forwarded normally through device A.
[0117] At this time, device A and device B publish 10.1.1.2 / 30 to the upstream device through routing protocols such as BGP. At this time, the service traffic forwarding model of the user device's initial access to the network device is as follows: Figure 7 As shown in the figure: the upstream traffic of device C is forwarded by device A; the traffic downstream to device C is load-balanced because devices A / B simultaneously publish the service route of this segment, and the traffic is evenly forwarded from devices A and B to device C. Among them, device B updates the MAC address table of device C, so the traffic can be sent to device C normally.
[0118] In some embodiments, the failure of device A is used as an example for explanation. Figure 8 , Figure 8 The figure is a network device service diagram when a link from device C to device A fails, where device C is a user device, and device A and device B are network devices interconnected on a Layer 2 network.
[0119] Assumptions Figure 8 The downlink of device A is interrupted. At this time, neither device A nor B can receive the ARP message with ip=1.1.1.1 (assuming the preset virtual address is ip=1.1.1.1). After 5s, the timer T is triggered to time out (that is, the time interval for the network device to send the first message exceeds the preset time interval). Devices A / B both modify the state S=1 (that is, device A and device B update the interface state to the second state). At this time, devices A / B both send and respond to ARP requests normally.
[0120] Device C re-initiates an ARP request to gateway 10.1.1.1. Device A cannot receive the request due to a link failure, but device B can receive the request normally and update the ARP entry 10.1.1.2 corresponding to MAC=3-3-3 (i.e., caches the mapping information between the IP address and MAC address of the user device).
[0121] Device B responds to the ARP request for 10.1.1.1 of device C. After receiving the response from device B, device C updates the MAC address corresponding to 10.1.1.1 to 2-2-2. At this time, ARP learning is completed between devices B and C, and the service traffic of device C can be forwarded normally through device B.
[0122] At this time, because the downlink port of device A is interrupted, the uplink BGP and other routing protocols of device A can be linked to realize the automatic cancellation of the route. The service traffic model when device A fails is as follows: Fig. 9 As shown in the figure, at this time, both upstream and downstream traffic are forwarded through a single path of device B. When the link between device C and device A is restored, device A / B re-elects device A as the active device, and device B returns to the ARP non-response state. The service is switched to the mode of forwarding upstream traffic through device A and forwarding downstream traffic through device A / B.
[0123] In some embodiments, the failure of device B is used as an example for explanation. Fig.10 , Fig.10 The following is a diagram of network equipment services when the link from device C to device B fails. Device C is a user device, and devices A and B are network devices that communicate with each other on the Layer 2 network. The service process is as follows:
[0124] Assumptions Fig.10 The downlink of device B is interrupted. At this time, neither device A nor B can receive the ARP message with ip=1.1.1.1. After 5s, timer T times out. Devices A and B both modify S=1. At this time, devices A and B both send and respond to ARP requests normally.
[0125] Device C already has an ARP cache with MAC=1-1-1 corresponding to 10.1.1.1. After it expires, it resends the ARP request. At this time, device A sends and responds to device C's ARP request normally, but device B cannot receive it due to a link failure.
[0126] The ARP status between devices A and C is updated periodically, and the service traffic of device C is forwarded normally through device A.
[0127] At this time, because the downlink port of device B is interrupted, the uplink BGP and other routing protocols of device B are linked to realize the automatic cancellation of the route. The service traffic model when device B fails is as follows: Fig.11 As shown in the figure, at this time, both upstream and downstream traffic are forwarded through a single path of device A. When the link between device B and device C is restored, device A / B re-elects device A as the active device through the ARP message of 1.1.1.1, and device B restores the ARP non-response state of S=0. The service upstream traffic of device C continues to be forwarded through device A. Because the link between device B and device C is restored, the upstream routing protocol is restored in linkage, and the downstream traffic to device C is restored to the load-sharing forwarding mode through device A / B.
[0128] Further, in order to accurately set the priority of the network device providing the data forwarding service, the above step S33 may include:
[0129] Step S331: Compare the source MAC address of the first message sent by the network device in the communication connection in the data link layer with its own MAC address;
[0130] Step S332: if the source MAC address is smaller than the own MAC address, updating the state of the interface connected to the user equipment to the first state;
[0131] Step S333: If the source MAC address is greater than the own MAC address, the state of the interface connected to the user equipment is updated to the second state.
[0132] It should be noted that the source MAC address is the MAC address of the network device that sends the first message, and the own MAC address is the MAC address of the network device that responds to the first message.
[0133] It can be understood that when a network device receives a first message with a source IP address identical to a preset virtual address, it obtains the source MAC address of the first message, and then compares the source MAC address with its own MAC address. The network device with the smaller MAC has a higher priority.
[0134] For example, if device A receives the first message sent by device B, it obtains the source MAC address of device B and compares the source MAC address of device B with its own MAC address. If the MAC of device A is smaller, device A modifies the state S=1 and device B maintains the state S=0, that is, the service priority of device A is higher. At this time, device A agrees to respond to the ARP message sent by the user device and provide data forwarding services for the user device.
[0135] For example, if the MAC of device A is larger, device A modifies the state to S=0 and device B modifies the state to S=1, that is, the service priority of device B is higher. At this time, device B agrees to respond to the ARP message sent by the user device and provide data forwarding services for the user device. Device A stops responding to the ARP message sent by the user device.
[0136] This embodiment determines whether the sending time interval of the first message sent by the network device with communication connection in the data link layer exceeds the preset time interval; if the sending time interval exceeds the preset time interval, the interface state connected to the user device is updated to the second state; if the sending time interval does not exceed the preset time interval, the interface state of the connection between the network device and the user device is determined based on the source MAC address of the first message sent by the network device with communication connection in the data link layer, thereby determining the ARP response principle of the network device (including the primary and backup gateways) to the service address by using the heartbeat detection mechanism between gateways, avoiding the routing oscillation problem caused by IP address conflicts, and realizing automatic switching between network devices providing data forwarding services without any configuration changes on the service side, thereby realizing service disaster recovery protection.
[0137] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a business response program is stored. When the business response program is executed by a processor, the steps of the business response method described above are implemented.
[0138] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0139] The computer-readable storage medium may be included in the service response device; or may exist independently without being assembled into the service response device.
[0140] In addition, an embodiment of the present invention further provides a computer program product, including a service response program, which implements the steps of the service response method described above when executed by a processor.
[0141] The specific implementation manner of the computer program product of the present invention is basically the same as the various embodiments of the above-mentioned business response method, and will not be repeated here.
[0142] Reference Fig.12 , Fig.12 This is a structural block diagram of the first embodiment of the service response device of the present invention.
[0143] like Fig.12 As shown, the service response device proposed in the embodiment of the present invention includes:
[0144] A broadcast sending module 10 is used to broadcast an ARP request to a network device in communication connection in a data link layer based on a preset time interval, wherein the source IP address and the target IP address of the ARP request are both preset virtual addresses;
[0145] A message monitoring module 20 is used to monitor ARP messages, wherein the ARP messages include a first message sent by a network device connected to the communication layer in the data link layer and / or a second message sent by a user device connected to the interface, wherein the source IP address and the target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device;
[0146] An interface status maintenance module 30, configured to determine the interface status of the connection between the network device and the user equipment based on the monitoring result of the ARP message;
[0147] The service response module 40 is used to determine a service response strategy according to the interface status, and perform service response based on the service response strategy.
[0148] Further, the interface state includes a first state and a second state; when the interface state is the first state, the service response strategy is to agree to respond to the first message and refuse to respond to the second message, so as to refuse to provide the data forwarding service for the user equipment;
[0149] When the interface state is the second state, the service response policy is to agree to respond to the first message and to agree to respond to the second message, so as to agree to provide the data forwarding service for the user equipment.
[0150] Furthermore, the monitoring result of the ARP message includes at least one of the following:
[0151] A source MAC address of a first message sent by a network device in a communication connection in a data link layer;
[0152] a time interval for sending a first message by a network device in a communication connection in a data link layer;
[0153] The destination IP address, source IP address, and source MAC address of the second message sent by the user equipment connected to the interface.
[0154] Furthermore, the interface status maintenance module 30 is also used to determine whether the sending time interval of the first message sent by the network device with communication connection in the data link layer exceeds the preset time interval; if the sending time interval exceeds the preset time interval, the interface status of the connection with the user device is updated to the second status; if the sending time interval does not exceed the preset time interval, the interface status of the connection between the network device and the user device is determined based on the source MAC address of the first message sent by the network device with communication connection in the data link layer.
[0155] Furthermore, the interface status maintenance module 30 is also used to compare the source MAC address of the first message sent by the network device communicating in the data link layer with its own MAC address; if the source MAC address is smaller than its own MAC address, the interface status connected to the user device is updated to the first status; if the source MAC address is greater than its own MAC address, the interface status connected to the user device is updated to the second status.
[0156] Furthermore, the service response device further includes:
[0157] The table entry updating module 50 is used to obtain the address mapping information of the ARP message based on the source IP address and the source MAC address of the ARP message when receiving the ARP message; and update the ARP table entry based on the address mapping information.
[0158] This embodiment broadcasts an ARP request to a network device in communication connection in the data link layer based on a preset time interval, wherein the source IP address and the target IP address of the ARP request are both preset virtual addresses, and monitors an ARP message, wherein the ARP message includes a first message sent by a network device in communication connection in the data link layer and / or a second message sent by a user device connected to the interface, wherein the source IP address and the target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device, and the interface status of the connection between the network device and the user device is determined based on the monitoring result of the ARP message, and a service response strategy is determined according to the interface status. And perform business response based on the business response strategy; since this embodiment monitors the first message sent by the network device and the second message sent by the user device, and determines the interface status based on the monitoring result of the ARP message, and thus determines whether it is necessary to provide data forwarding service for the user device based on the interface status, it effectively avoids activating the interface between the user device when there is no need to provide data forwarding service, causing the problem of IP address conflict, and realizes that when it is necessary to provide data forwarding service, the interface is activated in time to provide data service to the user, thereby realizing automatic disaster recovery protection of data forwarding service, effectively reducing the risk of business interruption, and improving the stability of data forwarding service.
[0159] The business response device provided by the present application adopts the business response method in the above embodiment, which can solve the technical problem of business response. Compared with the prior art, the beneficial effects of the business response device provided by the present application are the same as the beneficial effects of the business response method provided by the above embodiment, and other technical features in the business response device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0160] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0161] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0162] In addition, for technical details not fully described in this embodiment, reference may be made to the service response method provided in any embodiment of the present invention, and will not be repeated here.
[0163] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0164] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0165] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0166] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A service response method, characterized in that: The service response method is applied to a network device, and the service response method includes: Broadcasting an ARP request to a network device in a communication connection in a data link layer based on a preset time interval, wherein a source IP address and a target IP address of the ARP request are both preset virtual addresses; Monitor an ARP message, where the ARP message includes a first message sent by a network device connected to the communication layer in the data link layer and / or a second message sent by a user device connected to the interface, where the source IP address and the target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device; Determine the interface status of the connection between the network device and the user equipment based on the monitoring result of the ARP message; A service response strategy is determined according to the interface status, and a service response is performed based on the service response strategy.
2. The service response method according to claim 1, characterized in that: The interface state includes a first state and a second state; When the interface state is the first state, the service response strategy is to agree to respond to the first message and refuse to respond to the second message, so as to refuse to provide the data forwarding service for the user equipment; When the interface state is the second state, the service response policy is to agree to respond to the first message and to agree to respond to the second message, so as to agree to provide the data forwarding service for the user equipment.
3. The service response method according to claim 1, characterized in that: The monitoring result of the ARP message includes at least one of the following: A source MAC address of a first message sent by a network device in a communication connection in a data link layer; a time interval for sending a first message by a network device in a communication connection in a data link layer; The destination IP address, source IP address, and source MAC address of the second message sent by the user equipment connected to the interface.
4. The service response method according to any one of claims 1 to 3, characterized in that: The determining, based on the monitoring result of the ARP message, the interface state of the connection between the network device and the user equipment includes: Determine whether a time interval for sending a first message by a network device in a communication connection in the data link layer exceeds a preset time interval; If the sending time interval exceeds the preset time interval, updating the state of the interface connected to the user equipment to a second state; If the sending time interval does not exceed the preset time interval, the interface state of the connection between the network device and the user equipment is determined based on the source MAC address of the first message sent by the network device in the communication connection in the data link layer.
5. The service response method according to claim 4, characterized in that: The determining, based on the source MAC address of the first message sent by the network device in the communication connection in the data link layer, the interface state of the connection between the network device and the user equipment includes: Comparing the source MAC address of the first message sent by the network device in the communication connection in the data link layer with the own MAC address; If the source MAC address is smaller than the own MAC address, updating the state of the interface connected to the user equipment to the first state; If the source MAC address is greater than the own MAC address, the state of the interface connected to the user equipment is updated to a second state.
6. The service response method according to claim 1, characterized in that: After monitoring the ARP message, the method further includes: When an ARP message is received, obtaining address mapping information of the ARP message based on the source IP address and the source MAC address of the ARP message; The ARP table entry is updated based on the address mapping information.
7. A service response device, characterized in that: The service response device comprises: A broadcast sending module, used for broadcasting an ARP request to a network device connected in communication in a data link layer based on a preset time interval, wherein the source IP address and the target IP address of the ARP request are both preset virtual addresses; A message monitoring module, used to monitor ARP messages, wherein the ARP messages include a first message sent by a network device connected to the communication in the data link layer and / or a second message sent by a user device connected to the interface, wherein the source IP address and the target IP address of the first message are preset virtual addresses, and the source IP address of the second message is the IP address of the user device; An interface status maintenance module, used to determine the interface status of the connection between the network device and the user equipment based on the monitoring result of the ARP message; The service response module is used to determine the service response strategy according to the interface status and perform service response based on the service response strategy.
8. A service response device, characterized in that: The business response device comprises: a memory, a processor, and a business response program stored in the memory and executable on the processor, wherein the business response program is configured to implement the business response method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a business response program, and when the business response program is executed by a processor, the business response method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The computer program product comprises a service response program, and when the service response program is executed by a processor, the steps of the service response method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Safety protection method and device
CN119299966A
A safety protection method and device
CN119299966B
Network device security service enhancement method, system, device and program product
CN120915599A
A network device security service enhancement method, system, device and program product
CN120915599B
