CN111277436A - Equipment state switching method and device, electronic equipment and storage medium - Google Patents

Equipment state switching method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111277436A
CN111277436A CN202010054090.8A CN202010054090A CN111277436A CN 111277436 A CN111277436 A CN 111277436A CN 202010054090 A CN202010054090 A CN 202010054090A CN 111277436 A CN111277436 A CN 111277436A
Authority
CN
China
Prior art keywords
equipment
target
address
standby system
preset virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010054090.8A
Other languages
Chinese (zh)
Inventor
刘建伟
李奕森
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sangfor Technologies Co Ltd
Original Assignee
Sangfor Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sangfor Technologies Co Ltd filed Critical Sangfor Technologies Co Ltd
Priority to CN202010054090.8A priority Critical patent/CN111277436A/en
Publication of CN111277436A publication Critical patent/CN111277436A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Abstract

The application discloses a method and a device for switching equipment states, an electronic device and a computer readable storage medium, wherein the method comprises the following steps: when the target equipment is the current main equipment in the hot standby system, responding to an ARP request to a preset virtual IP address by using a preset virtual MAC address, and monitoring a target object; the target equipment comprises a preset virtual IP address; when the target equipment is the current main equipment in the hot standby system and receives a switching instruction, removing the preset virtual IP address from the target equipment so as to set the target equipment as the current standby equipment in the hot standby system; when the target device is the current standby device in the hot standby system and receives the switching instruction, a preset virtual IP address is added into the target device, and the MAC address of the target device is set to be the preset virtual MAC address, so that the target device is set to be the current main device in the hot standby system, and the stability of the hot standby system is improved.

Description

Equipment state switching method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of network technologies, and in particular, to a method and an apparatus for switching device states, an electronic device, and a computer-readable storage medium.
Background
In the related art, the implementation manner of the dual-computer hot standby system is as follows: IP (Internet Protocol) addresses are respectively set for the main equipment and the standby equipment, when the main equipment and the standby equipment are switched, because the MAC addresses (Media Access Control addresses ) of the equipment change, the corresponding IP addresses also change, and the upstream and downstream equipment of the dual-machine hot standby system needs to update the MAC tables and the ARP cache tables, the upstream and downstream fluctuation is caused, and the stability of the dual-machine hot standby system is not facilitated.
Therefore, how to improve the stability of the hot standby system during the active/standby switching is a technical problem to be solved by those skilled in the art.
Disclosure of Invention
The present application aims to provide a device state switching method, an apparatus, an electronic device, and a computer-readable storage medium, which improve the stability of a hot standby system during active/standby switching.
In order to achieve the above object, the present application provides an apparatus state switching method, which is applied to a target apparatus in a hot standby system, where the hot standby system includes a plurality of target apparatuses, and the method includes:
when the target equipment is the current main equipment in the hot standby system, responding to an ARP request to a preset virtual IP address by using a preset virtual MAC address, and monitoring a target object; wherein the target device comprises the preset virtual IP address;
when the target equipment is the current main equipment in the hot standby system and a switching instruction is received, removing the preset virtual IP address from the target equipment so as to set the target equipment as the current standby equipment in the hot standby system;
and when the target equipment is the current standby equipment in the hot standby system and receives a switching instruction, adding the preset virtual IP address into the target equipment, and setting the MAC address of the target equipment as the preset virtual MAC address so as to set the target equipment as the current main equipment in the hot standby system.
Wherein, still include:
and if the target equipment is set as the current main equipment in the hot standby system for the first time, sending the binding relationship between the preset virtual MAC address and the preset virtual IP address to upstream and downstream equipment of the hot standby system so that the upstream and downstream equipment can update an MAC table based on the binding relationship.
Wherein, after removing the preset virtual IP address from the target device, the method further includes:
and restoring the MAC address of the target equipment from the preset virtual MAC address to the real MAC address of the target equipment.
After the setting of the MAC address of the target device to the preset virtual MAC address, the method further includes:
executing a collision detection operation by sending a preset request to other equipment in the hot standby system so as to determine the state of the other equipment; and the preset request is an ARP request for the preset virtual IP address.
Wherein, still include:
when the target equipment is the current standby equipment in the hot standby system, receiving a notification message sent by the current main equipment in the hot standby system; wherein the notification message includes an abnormal state level and a real IP address of the current master device;
responding to the notification message based on the abnormal state level and the real IP address of the target device, and the abnormal state level and the real IP address in the notification message.
Wherein said responding to the notification message based on the abnormal state level and the real IP address of the target device, the abnormal state level and the real IP address in the notification message comprises:
comparing the abnormal state grade of the target equipment with the abnormal state grade in the notification message;
when the abnormal state grade of the target equipment is larger than the abnormal state grade in the notification message, replying the notification message so as to maintain the current active/standby state of the dual-computer hot-standby system;
and when the abnormal state grade of the target equipment is smaller than the abnormal state grade in the notification message, or the abnormal state grade of the target equipment is equal to the abnormal state grade in the notification message and the real IP address of the target equipment is smaller than the real IP address in the notification message, sending a switching instruction to the current main equipment in the hot standby system so that the current main equipment is switched to the standby equipment.
Wherein before comparing the abnormal state level of the target device with the abnormal state level in the notification message, the method further includes:
and when the abnormal state grade in the notification message is the minimum abnormal state grade, directly replying the notification message so as to maintain the current main/standby state of the dual-computer hot-standby system.
In order to achieve the above object, the present application provides an apparatus status switching apparatus, applied to a target device in a hot standby system, where the hot standby system includes a plurality of target devices, the apparatus includes:
the monitoring module is used for responding to an ARP request to a preset virtual IP address by using a preset virtual MAC address and monitoring a target object when the target device is the current main device in the hot standby system; wherein the target device comprises the preset virtual IP address;
a removing module, configured to remove the preset virtual IP address from the target device when the target device is a current master device in the hot standby system and a switching instruction is received, so as to set the target device as a current standby device in the hot standby system;
and the setting module is used for adding the preset virtual IP address into the target equipment and setting the MAC address of the target equipment as the preset virtual MAC address when the target equipment is the current standby equipment in the hot standby system and receives a switching instruction so as to set the target equipment as the current main equipment in the hot standby system.
To achieve the above object, the present application provides an electronic device including:
a memory for storing a computer program;
a processor for implementing the steps of the above-mentioned device state switching method when executing the computer program.
To achieve the above object, the present application provides a computer-readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the above-mentioned device state switching method.
According to the above scheme, the method for switching the device state provided by the application comprises the following steps: when the target equipment is the current main equipment in the hot standby system, responding to an ARP request to a preset virtual IP address by using a preset virtual MAC address, and monitoring a target object; wherein the target device comprises the preset virtual IP address; when the target equipment is the current main equipment in the hot standby system and a switching instruction is received, removing the preset virtual IP address from the target equipment so as to set the target equipment as the current standby equipment in the hot standby system; and when the target equipment is the current standby equipment in the hot standby system and receives a switching instruction, adding the preset virtual IP address into the target equipment, and setting the MAC address of the target equipment as the preset virtual MAC address so as to set the target equipment as the current main equipment in the hot standby system.
According to the equipment state switching method, when the equipment in the hot standby system is in a working state, the same virtual IP address and virtual MAC address are used. The task of the main equipment is to add a preset virtual IP address in the network port and set the MAC address as the preset virtual MAC address, and the task of the standby equipment is to remove the preset virtual IP address from the network port. Because all the devices in the hot standby system use the same virtual IP address and virtual MAC address to provide service, the corresponding relation between the preset virtual IP address and the preset virtual MAC address cannot be changed, and the upstream and downstream devices of the dual-computer hot standby system do not need to update the MAC table and the ARP cache table during the active-standby switching, thereby avoiding the upstream and downstream fluctuation and improving the stability of the hot standby system. The application also discloses a device state switching device, an electronic device and a computer readable storage medium, which can also realize the technical effects.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
FIG. 1 is a block diagram of a hot standby system provided herein;
FIG. 2 is a flow chart illustrating a method of device state switching in accordance with an exemplary embodiment;
FIG. 3 is a detailed flowchart of step S103 in FIG. 2;
FIG. 4 is a detailed flowchart of step S102 in FIG. 2;
FIG. 5 is a flow chart illustrating another method of device state switching in accordance with an exemplary embodiment;
FIG. 6 is a block diagram illustrating an apparatus state switching device in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating an electronic device in accordance with an exemplary embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to understand the device state switching method provided by the present application, a hot standby system applied thereto is introduced first, specifically:
referring to fig. 1, fig. 1 is a block diagram of a hot standby system provided in the present application, and as shown in fig. 1, the hot standby system 100 includes a plurality of target devices 11, implementing a redundant design, where the number of target devices is also not limited herein. The target device may be a firewall device, and is not particularly limited herein.
The upstream and downstream devices of the hot standby system may be the switch 200 or the router 300, and are not limited in particular. For example, the information of the extranet is sent to the intranet through a firewall, the firewall is the hot standby system, the upstream device of the firewall is a switch, the switch is connected with the extranet through a router, the downstream device of the firewall is another switch, and the switch is connected with the intranet device.
Taking the switch as an example, if the target device a in the hot standby system is the current master device, the hot standby system is connected to the other device B through the switch 1, that is, the target device a is connected to the f 0/1 interface of the switch 200, the f 0/2 interface of the switch 200 is connected to the device B, and the process of the target device a sending information to the device B is as follows:
step 1: the destination device a will send a data frame with the source MAC address of its own and the destination MAC address of device B to the switch 200.
Step 2: after receiving the data frame, the switch 200 first records the correspondence between the source MAC address in the data frame and the f 0/1 interface in the MAC address table.
And step 3: the switch 200 checks whether the MAC address table contains information of the destination MAC address, and if so, unicasts the data frame from the interface corresponding to the destination MAC address, and if not, broadcasts the data frame from an interface other than the interface f 0/1.
And 4, step 4: all devices in the lan receive the data frame, but only device B responds to the broadcast and replies with a data frame including device B's MAC address.
And 5: when the switch 200 receives the data frame responded by the device B through the f 0/2 interface, the corresponding relationship between the MAC address of the device B and the f 0/2 interface is recorded. When the target device a communicates with device B, the switch 200 may implement unicast based on the record in the MAC address table.
The manner in which the target device a determines the MAC address of the device B is:
step 1: the target device A checks an ARP (Address resolution Protocol) cache table of the local device, checks whether a corresponding relation between the IP address and the MAC address of the device B exists or not, and determines the MAC address of the device B in the ARP cache table if the corresponding relation exists. If not, the target device a sends an ARP request, and if not, the host a sends an ARP request (i.e., broadcast frame FF-FF), the target IP address of the ARP request is the IP address of device B, the target MAC address is the MAC address, and the source IP address and the MAC address are the IP address and the MAC address of the target device a.
Step 2: the switch 200 broadcasts the data frame from an interface other than the f 0/1 interface after the broadcast frame.
And step 3: all devices within the local area network receive the data frame, but only device B responds to the broadcast. The device B records the corresponding relation between the IP address and the MAC address of the target device A into an ARP cache table, and simultaneously sends an ARP response, wherein the ARP response comprises the MAC address of the device B.
And 4, step 4: and after the target device A receives the ARP response, recording the corresponding relation between the IP address and the MAC address of the device B in an ARP cache table.
The applicant of the present application finds, through research, that in the related art, devices in the hot standby system provide services using different IP addresses, and when the active/standby system is switched, upstream and downstream devices of the hot standby system need to update the MAC table and the ARP cache table, which causes upstream and downstream turbulence and affects the stability of the hot standby system. Therefore, in the application, when all devices in the hot standby system are in a working state, the same virtual IP address and virtual MAC address are used, the corresponding relationship between the preset virtual IP address and the preset virtual MAC address does not change, and the upstream and downstream devices of the dual-computer hot standby system do not need to update the MAC table and the ARP cache table during the active-standby switching, thereby avoiding upstream and downstream fluctuation and improving the stability of the hot standby system.
The embodiment of the application discloses an equipment state switching method, which improves the stability of a hot standby system during the main standby switching.
Referring to fig. 2, a flowchart of a device state switching method according to an exemplary embodiment is shown, and as shown in fig. 2, includes:
s101: when the target equipment is the current main equipment in the hot standby system, responding to an ARP request to a preset virtual IP address by using a preset virtual MAC address, and monitoring a target object; wherein the target device comprises the preset virtual IP address;
the execution main body of the embodiment is any target device in the hot standby system, and the task of the hot standby system is to monitor a target object and realize the firewall function. In a specific implementation, when the target device is a master device of the hot standby system, a virtual MAC address, that is, the preset virtual MAC address in this step, is generated, and a virtual IP address, that is, the preset virtual IP address in this step, is generated at the same time. Here, the number of the preset virtual IP addresses is not limited, and a person skilled in the art may configure one or more virtual IP addresses according to actual situations, that is, the preset virtual MAC address and the preset virtual IP address are in a one-to-many or many-to-many relationship, and when an ARP request for any preset virtual IP address is received, the preset virtual MAC address is replied.
Preferably, this embodiment further includes: and if the target equipment is set as the current main equipment in the hot standby system for the first time, sending the binding relationship between the preset virtual MAC address and the preset virtual IP address to upstream and downstream equipment of the hot standby system so that the upstream and downstream equipment can update an MAC table based on the binding relationship. In specific implementation, the MAC table records a correspondence between an MAC address and an interface, and when a target device is set as a master device for the first time, a binding relationship between a preset virtual MAC address and a preset virtual IP address is sent to upstream and downstream devices through the target interface, and the upstream and downstream devices store the correspondence between the target interface and the preset virtual MAC address in the MAC table.
S102: when the target equipment is the current main equipment in the hot standby system and a switching instruction is received, removing the preset virtual IP address from the target equipment so as to set the target equipment as the current standby equipment in the hot standby system;
in this step, when the target device is a master device of the hot standby system and receives a switching instruction, the target device needs to be switched from the master device to the standby device, remove the preset virtual IP address from the network port, and stop responding to the ARP request for the preset virtual IP address.
S103: and when the target equipment is the current standby equipment in the hot standby system and receives a switching instruction, adding the preset virtual IP address into the target equipment, and setting the MAC address of the target equipment as the preset virtual MAC address so as to set the target equipment as the current main equipment in the hot standby system.
In this step, when the target device is a standby device of the hot standby system and receives a switching instruction, the target device needs to be switched from the standby device to the host device, add a preset virtual IP address to the network port, and set the MAC address as the preset virtual MAC address, so as to respond to an ARP request for the preset virtual IP address and to monitor the target object as the host device again. It can be seen that the main devices of the hot standby system at any time use the preset virtual IP address and the preset virtual MAC address to provide services, and the upstream and downstream devices of the hot standby system do not need to update the MAC table and the ARP cache table during the active-standby switching.
According to the device state switching method provided by the embodiment of the application, when the device in the hot standby system is in a working state, the same virtual IP address and virtual MAC address are used. The task of the main equipment is to add a preset virtual IP address in the network port and set the MAC address as the preset virtual MAC address, and the task of the standby equipment is to remove the preset virtual IP address from the network port. Because all the devices in the hot standby system use the same virtual IP address and virtual MAC address to provide service, the corresponding relation between the preset virtual IP address and the preset virtual MAC address cannot be changed, and the upstream and downstream devices of the dual-computer hot standby system do not need to update the MAC table and the ARP cache table during the active-standby switching, thereby avoiding the upstream and downstream fluctuation and improving the stability of the hot standby system.
Specifically, as shown in fig. 3, step S103 in the foregoing embodiment may include:
s31: adding the preset virtual IP address in the target equipment;
s32: and setting the MAC address of the target device as the preset virtual MAC address so as to set the target device as the current main device in the hot standby system.
S33: executing a collision detection operation by sending a preset request to other equipment in the hot standby system so as to determine the state of the other equipment; and the preset request is an ARP request for the preset virtual IP address.
The execution subject of this embodiment is a master device in the hot standby system, and when a target device becomes the master device in the hot standby system, collision detection needs to be performed, that is, an ARP request for a preset virtual IP address is continuously sent, and if an ARP response is not received, it indicates that other devices in the hot standby system are in a dormant state, only one current master device in a working state exists in the hot standby system, and the preset virtual IP address does not collide. If the ARP response is received, the conflict of the preset virtual IP addresses is shown, and the main/standby state of the hot standby system needs to be reset. Meanwhile, when the target device becomes a master device in the hot standby system, a preset virtual IP address needs to be added to the network port, and the MAC address of the network port is modified to the preset virtual MAC address, so as to respond to an ARP request for the preset virtual IP address.
Specifically, as shown in fig. 4, step S102 in the foregoing embodiment may include:
s21: removing the preset virtual IP address from the target equipment so as to set the target equipment as current standby equipment in the hot standby system;
s22: and restoring the MAC address of the target equipment from the preset virtual MAC address to the real MAC address of the target equipment.
The execution subject of this embodiment is the standby device in the hot standby system, and when the target device becomes the standby device in the hot standby system, the response to the ARP request for the preset virtual IP address is stopped. And meanwhile, removing the preset virtual IP address from the network port, and recovering the MAC address as a real MAC address.
On the basis of the above embodiment, the master device in the hot standby system is further configured to send a notification message to the standby device, and the standby device responds to the notification message. In particular, the method comprises the following steps of,
referring to fig. 5, a flowchart of another device state switching method according to an exemplary embodiment is shown, and as shown in fig. 5, includes:
s201: when the target equipment is the current standby equipment in the hot standby system, receiving a notification message sent by the current main equipment in the hot standby system; wherein the notification message includes an abnormal state level and a real IP address of the current master device;
the execution subject of this embodiment is a standby device in a hot standby system, and receives a notification message sent by a main device, where the notification message includes an abnormal state level and a real IP address of the main device. The abnormal state grade is used for describing the risk grade of the equipment abnormality, and the larger the risk grade is, the higher the abnormal state grade is.
S202: responding to the notification message based on the abnormal state level and the real IP address of the target device, and the abnormal state level and the real IP address in the notification message.
In this step, the standby device determines the active/standby state of each device in the hot standby system based on the abnormal state level and the real IP address of the active/standby device, so as to ensure that the active/standby state of the active/standby device is maintained stable. Specifically, the method comprises the following steps: comparing the abnormal state grade of the target equipment with the abnormal state grade in the notification message; when the abnormal state grade of the target equipment is larger than the abnormal state grade in the notification message, replying the notification message so as to maintain the current active/standby state of the dual-computer hot-standby system; and when the abnormal state grade of the target equipment is smaller than the abnormal state grade in the notification message, or the abnormal state grade of the target equipment is equal to the abnormal state grade in the notification message and the real IP address of the target equipment is smaller than the real IP address in the notification message, sending a switching instruction to the current main equipment in the hot standby system so that the current main equipment is switched to the standby equipment. In a specific implementation, if the abnormal state level of the current master device is higher than the abnormal state level of the current slave device, it indicates that the abnormal risk level existing in the current master device is higher, and the current slave device with the lower abnormal state level needs to be used to provide service, that is, master-slave switching is performed. If the abnormal state grade of the current main equipment is lower than that of the current standby equipment, the abnormal risk grade existing in the current main equipment is lower, and the current main/standby state is maintained. And if the abnormal state grade of the current main equipment is equal to the abnormal state grade of the current standby equipment, comparing the real IP addresses of the current main equipment and the current standby equipment, and using the target equipment with a smaller real IP address as the main equipment.
As a preferred implementation, before comparing the abnormal state level of the target device with the abnormal state level in the notification message, the method further includes: and when the abnormal state grade in the notification message is the minimum abnormal state grade, directly replying the notification message so as to maintain the current main/standby state of the dual-computer hot-standby system. In a specific implementation, if the current abnormal state level of the primary device is the minimum abnormal state level, the standby device does not need to compare the direct reply notification message to maintain the current primary/standby state in order to simplify the process.
In this embodiment, the primary device continuously sends a notification message to the standby device, and the standby device re-determines the primary device and the standby device in the hot standby system based on the notification message, so as to implement automatic switching between the primary device and the standby device. Therefore, the embodiment can realize the automatic switching of the main/standby state based on the abnormal state grade of the target device, and maintain the stability of the main/standby state.
In the following, a device state switching apparatus provided in an embodiment of the present application is introduced, and a device state switching apparatus described below and a device state switching method described above may be referred to each other.
Referring to fig. 6, a block diagram of an apparatus state switching device according to an exemplary embodiment is shown, as shown in fig. 6, including:
a monitoring module 601, configured to, when the target device is a current master device in the hot standby system, respond to an ARP request for a preset virtual IP address by using a preset virtual MAC address, and monitor a target object; wherein the target device comprises the preset virtual IP address;
a removing module 602, configured to remove the preset virtual IP address from the target device when the target device is a current master device in the hot standby system and a switching instruction is received, so as to set the target device as a current standby device in the hot standby system;
a setting module 603, configured to, when the target device is a current standby device in the hot standby system and receives a switching instruction, add the preset virtual IP address to the target device, and set the MAC address of the target device as the preset virtual MAC address, so as to set the target device as a current host device in the hot standby system.
The device state switching device provided by the embodiment of the application uses the same virtual IP address and virtual MAC address when the devices in the hot standby system are in the working state. The task of the main equipment is to add a preset virtual IP address in the network port and set the MAC address as the preset virtual MAC address, and the task of the standby equipment is to remove the preset virtual IP address from the network port. Because all the devices in the hot standby system use the same virtual IP address and virtual MAC address to provide service, the corresponding relation between the preset virtual IP address and the preset virtual MAC address cannot be changed, and the upstream and downstream devices of the dual-computer hot standby system do not need to update the MAC table and the ARP cache table during the active-standby switching, thereby avoiding the upstream and downstream fluctuation and improving the stability of the hot standby system.
On the basis of the above embodiment, as a preferred implementation, the method further includes:
and the sending module is used for sending the binding relationship between the preset virtual MAC address and the preset virtual IP address to upstream and downstream equipment of the hot standby system if the target equipment is set as the current main equipment in the hot standby system for the first time, so that the upstream and downstream equipment can update the MAC table based on the binding relationship.
On the basis of the above embodiment, as a preferred implementation, the method further includes:
and the recovery module is used for recovering the MAC address of the target equipment from the preset virtual MAC address to the real MAC address of the target equipment.
On the basis of the above embodiment, as a preferred implementation, the method further includes:
the execution module is used for executing conflict detection operation by sending a preset request to other equipment in the hot standby system so as to determine the states of the other equipment; and the preset request is an ARP request for the preset virtual IP address.
On the basis of the above embodiment, as a preferred implementation, the method further includes:
a receiving module, configured to receive a notification message sent by a current master device in the hot standby system when the target device is a current standby device in the hot standby system; wherein the notification message includes an abnormal state level and a real IP address of the current master device;
and the response module is used for responding the notification message based on the abnormal state grade and the real IP address of the target equipment and the abnormal state grade and the real IP address in the notification message.
On the basis of the above embodiment, as a preferred implementation, the response module includes:
the comparison unit is used for comparing the abnormal state grade of the target equipment with the abnormal state grade in the notification message;
a first reply unit, configured to reply to the notification message when the abnormal state level of the target device is greater than the abnormal state level in the notification message, so as to maintain a current active/standby state of the dual-computer hot-standby system;
and a sending unit, configured to send a switching instruction to a current main device in the hot standby system when the abnormal state level of the target device is smaller than the abnormal state level in the notification message, or the abnormal state level of the target device is equal to the abnormal state level in the notification message and the real IP address of the target device is smaller than the real IP address in the notification message, so that the current main device is switched to a standby device.
On the basis of the foregoing embodiment, as a preferred implementation, the response module further includes:
and a second replying unit, configured to, when the abnormal state level in the notification message is the minimum abnormal state level, directly reply to the notification message, so as to maintain the current active/standby state of the dual-computer hot-standby system.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The present application further provides an electronic device, and referring to fig. 7, a structure diagram of an electronic device 700 provided in an embodiment of the present application may include a processor 11 and a memory 12, as shown in fig. 7. The electronic device 700 may also include one or more of a multimedia component 13, an input/output (I/O) interface 14, and a communication component 15.
The processor 11 is configured to control the overall operation of the electronic device 700, so as to complete all or part of the steps in the device state switching method. The memory 12 is used to store various types of data to support operation at the electronic device 700, such as instructions for any application or method operating on the electronic device 700 and application-related data, such as contact data, transmitted and received messages, pictures, audio, video, and so forth. The Memory 12 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The multimedia component 13 may include a screen and an audio component. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 12 or transmitted via the communication component 15. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 14 provides an interface between the processor 11 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication module 15 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so that the corresponding communication component 15 may include: Wi-Fi module, bluetooth module, NFC module.
In an exemplary embodiment, the electronic Device 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the Device state switching method.
In another exemplary embodiment, a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the above-described device state switching method is also provided. For example, the computer readable storage medium may be the memory 12 described above comprising program instructions executable by the processor 11 of the electronic device 700 to perform the device state switching method described above.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. An apparatus state switching method applied to a target apparatus in a hot standby system, the hot standby system including a plurality of the target apparatuses, the method comprising:
when the target equipment is the current main equipment in the hot standby system, responding to an ARP request to a preset virtual IP address by using a preset virtual MAC address, and monitoring a target object; wherein the target device comprises the preset virtual IP address;
when the target equipment is the current main equipment in the hot standby system and a switching instruction is received, removing the preset virtual IP address from the target equipment so as to set the target equipment as the current standby equipment in the hot standby system;
and when the target equipment is the current standby equipment in the hot standby system and receives a switching instruction, adding the preset virtual IP address into the target equipment, and setting the MAC address of the target equipment as the preset virtual MAC address so as to set the target equipment as the current main equipment in the hot standby system.
2. The device state switching method according to claim 1, further comprising:
and if the target equipment is set as the current main equipment in the hot standby system for the first time, sending the binding relationship between the preset virtual MAC address and the preset virtual IP address to upstream and downstream equipment of the hot standby system so that the upstream and downstream equipment can update an MAC table based on the binding relationship.
3. The device status switching method according to claim 1, further comprising, after removing the preset virtual IP address from the target device:
and restoring the MAC address of the target equipment from the preset virtual MAC address to the real MAC address of the target equipment.
4. The device status switching method according to claim 1, wherein after setting the MAC address of the target device to the preset virtual MAC address, the method further comprises:
executing a collision detection operation by sending a preset request to other equipment in the hot standby system so as to determine the state of the other equipment; and the preset request is an ARP request for the preset virtual IP address.
5. The device state switching method according to any one of claims 1 to 4, further comprising:
when the target equipment is the current standby equipment in the hot standby system, receiving a notification message sent by the current main equipment in the hot standby system; wherein the notification message includes an abnormal state level and a real IP address of the current master device;
responding to the notification message based on the abnormal state level and the real IP address of the target device, and the abnormal state level and the real IP address in the notification message.
6. The device status switching method according to claim 5, wherein the responding to the notification message based on the abnormal status level and the real IP address of the target device, the abnormal status level and the real IP address in the notification message comprises:
comparing the abnormal state grade of the target equipment with the abnormal state grade in the notification message;
when the abnormal state grade of the target equipment is larger than the abnormal state grade in the notification message, replying the notification message so as to maintain the current active/standby state of the dual-computer hot-standby system;
and when the abnormal state grade of the target equipment is smaller than the abnormal state grade in the notification message, or the abnormal state grade of the target equipment is equal to the abnormal state grade in the notification message and the real IP address of the target equipment is smaller than the real IP address in the notification message, sending a switching instruction to the current main equipment in the hot standby system so that the current main equipment is switched to the standby equipment.
7. The device status switching method according to claim 6, wherein before comparing the abnormal status level of the target device with the abnormal status level in the notification message, the method further comprises:
and when the abnormal state grade in the notification message is the minimum abnormal state grade, directly replying the notification message so as to maintain the current main/standby state of the dual-computer hot-standby system.
8. An apparatus state switching apparatus, applied to a target device in a hot standby system, where the hot standby system includes a plurality of target devices, the apparatus includes:
the monitoring module is used for responding to an ARP request to a preset virtual IP address by using a preset virtual MAC address and monitoring a target object when the target device is the current main device in the hot standby system; wherein the target device comprises the preset virtual IP address;
a removing module, configured to remove the preset virtual IP address from the target device when the target device is a current master device in the hot standby system and a switching instruction is received, so as to set the target device as a current standby device in the hot standby system;
and the setting module is used for adding the preset virtual IP address into the target equipment and setting the MAC address of the target equipment as the preset virtual MAC address when the target equipment is the current standby equipment in the hot standby system and receives a switching instruction so as to set the target equipment as the current main equipment in the hot standby system.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the device state switching method according to any one of claims 1 to 7 when executing said computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method for switching states of a device according to any one of claims 1 to 7.
CN202010054090.8A 2020-01-17 2020-01-17 Equipment state switching method and device, electronic equipment and storage medium Pending CN111277436A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010054090.8A CN111277436A (en) 2020-01-17 2020-01-17 Equipment state switching method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010054090.8A CN111277436A (en) 2020-01-17 2020-01-17 Equipment state switching method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111277436A true CN111277436A (en) 2020-06-12

Family

ID=71002663

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010054090.8A Pending CN111277436A (en) 2020-01-17 2020-01-17 Equipment state switching method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111277436A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112994948A (en) * 2021-03-31 2021-06-18 杭州迪普科技股份有限公司 Silent dual-computer switching method, silent dual-computer switching device, silent dual-computer switching equipment and computer readable storage medium
CN114760266A (en) * 2022-03-01 2022-07-15 烽台科技(北京)有限公司 Virtual address generation method and device, computer equipment and computer program product
CN115051973A (en) * 2022-04-25 2022-09-13 浙江大华技术股份有限公司 Method and device for establishing internal communication of equipment
CN115296983A (en) * 2022-08-03 2022-11-04 青岛海信微联信号有限公司 Equipment management method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635648A (en) * 2009-08-05 2010-01-27 中兴通讯股份有限公司 Method for managing and rapidly switching virtual redundant route protocol group
CN101702681A (en) * 2009-11-26 2010-05-05 福建星网锐捷网络有限公司 Switching method and device of main/standby router in virtual route redundancy protocol
CN101951345A (en) * 2010-10-15 2011-01-19 杭州华三通信技术有限公司 Message transmitting method and equipment
US20140169154A1 (en) * 2012-02-05 2014-06-19 Huawei Technologies Co., Ltd. Method, routing device, and system for network device redundancy backup

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635648A (en) * 2009-08-05 2010-01-27 中兴通讯股份有限公司 Method for managing and rapidly switching virtual redundant route protocol group
CN101702681A (en) * 2009-11-26 2010-05-05 福建星网锐捷网络有限公司 Switching method and device of main/standby router in virtual route redundancy protocol
CN101951345A (en) * 2010-10-15 2011-01-19 杭州华三通信技术有限公司 Message transmitting method and equipment
US20140169154A1 (en) * 2012-02-05 2014-06-19 Huawei Technologies Co., Ltd. Method, routing device, and system for network device redundancy backup

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112994948A (en) * 2021-03-31 2021-06-18 杭州迪普科技股份有限公司 Silent dual-computer switching method, silent dual-computer switching device, silent dual-computer switching equipment and computer readable storage medium
CN114760266A (en) * 2022-03-01 2022-07-15 烽台科技(北京)有限公司 Virtual address generation method and device, computer equipment and computer program product
CN115051973A (en) * 2022-04-25 2022-09-13 浙江大华技术股份有限公司 Method and device for establishing internal communication of equipment
CN115051973B (en) * 2022-04-25 2023-10-20 浙江大华技术股份有限公司 Method and device for establishing equipment internal communication
CN115296983A (en) * 2022-08-03 2022-11-04 青岛海信微联信号有限公司 Equipment management method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111277436A (en) Equipment state switching method and device, electronic equipment and storage medium
US8174962B2 (en) Global broadcast communication system
US20150117179A1 (en) Apparatus, information processing method and information processing system
CN109088818B (en) Equipment linkage switching method and device
US7813341B2 (en) Overhead reduction for multi-link networking environments
CN105162678A (en) Adaptive voice chat mode method and device
CN113395192B (en) Interconnection method, system and equipment
CN109889411B (en) Data transmission method and device
CN114866365B (en) Arbitration machine election method, device, intelligent equipment and computer readable storage medium
CN111030877A (en) Main/standby equipment switching method and device
CN111262665A (en) Data communication method, device, controller and system
CN105744555A (en) Terminal maintenance method, maintenance device and network management server
CN111245677A (en) Communication abnormity reporting method and device, electronic equipment and storage medium
JP5039975B2 (en) Gateway device
JP2013172393A (en) Edge device redundant system, switching controller and edge device redundancy method
CN108234358B (en) Multicast message transmission method, device and machine readable storage medium
CN109039747B (en) Dual-computer hot standby control method and device for DPDK service
CN108418863B (en) Management method of controller cluster, SDN controller and storage medium
KR20150104435A (en) Method of performing transition of operation mode for a routing processor
CN115225464B (en) Network switching method, device, equipment and storage medium
CN109428814B (en) Multicast traffic transmission method, related equipment and computer readable storage medium
US20180183709A1 (en) Communication node, communication system, communication method, and program
JP2009075710A (en) Redundant system
CN109361781B (en) Message forwarding method, device, server, system and storage medium
CN112764350A (en) Control method and device of intelligent household equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200612