CN110912839B - Main and standby switch detection method, system, terminal and storage medium - Google Patents

Main and standby switch detection method, system, terminal and storage medium Download PDF

Info

Publication number
CN110912839B
CN110912839B CN201911349354.6A CN201911349354A CN110912839B CN 110912839 B CN110912839 B CN 110912839B CN 201911349354 A CN201911349354 A CN 201911349354A CN 110912839 B CN110912839 B CN 110912839B
Authority
CN
China
Prior art keywords
switch
terminal
standby
main
line
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.)
Active
Application number
CN201911349354.6A
Other languages
Chinese (zh)
Other versions
CN110912839A (en
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.)
Beijing Armyfly Technology Co Ltd
Original Assignee
Beijing Armyfly Technology 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 Beijing Armyfly Technology Co Ltd filed Critical Beijing Armyfly Technology Co Ltd
Priority to CN201911349354.6A priority Critical patent/CN110912839B/en
Publication of CN110912839A publication Critical patent/CN110912839A/en
Application granted granted Critical
Publication of CN110912839B publication Critical patent/CN110912839B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/30Peripheral units, e.g. input or output ports
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/50Overload detection or protection within a single switching element
    • H04L49/501Overload detection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/55Prevention, detection or correction of errors

Abstract

The embodiment of the invention discloses a method, a system, a terminal and a storage medium for detecting a main/standby switch. The method is applied to terminals which are respectively physically connected with at least two switches, and comprises the following steps: the terminal monitors the port flow of the switching port which is physically connected with the terminal in each switch respectively; the terminal acquires a target switch with port flow exceeding a preset flow threshold value, determines the target switch as a main switch, and determines other switches as standby switches; the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line. The method can determine the main line and the standby line of the terminal and a plurality of switch lines when the terminal does not support the PING protocol of the Internet packet explorer.

Description

Main and standby switch detection method, system, terminal and storage medium
Technical Field
The embodiment of the invention relates to the technical field of dual network card detection, in particular to a method, a system, a terminal and a storage medium for detecting a main/standby switch.
Background
In the prior art, a circuit structure of a dual network card is that a first network card and a second network card are arranged on a terminal, wherein the first network card is connected with a first switch, and the second network card is connected with a second switch.
For the judgment of the main line and the standby line, the terminal is usually required to support an Internet Packet searchers (PING) protocol, and send PING messages of the PING protocol to the first switch and the second switch based on the PING protocol to perform PING detection, judge whether the PING detection can pass, if one switch can pass the PING detection, consider the line between the terminal and the switch as the main line; and if one switch cannot be detected through PING, the line of the terminal and the switch is considered as a standby line.
In the process of implementing the invention, the inventor finds that: in the prior art, a main line or a standby line of a line between a terminal and an exchanger is judged according to whether the exchanger can detect through PING, and when the terminal does not support PING protocol, a tie is ineligible, so that the main line or the standby line of the line between the terminal and the exchanger cannot be judged.
Disclosure of Invention
The embodiment of the invention provides a method, a system, a terminal and a storage medium for detecting a main/standby switch, and provides a new mode for determining the main/standby switch of the terminal.
In a first aspect, an embodiment of the present invention provides a method for detecting a primary/standby switch, where the method includes:
the terminal monitors the port flow of a switching port which is physically connected with the terminal in each switch respectively;
the terminal acquires a target switch with port flow exceeding a preset flow threshold value, determines the target switch as a main switch and determines other switches as standby switches;
and the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
Optionally, after the terminal sets the communication line with the master switch as the master line and sets the communication line with the standby switch as the standby line, the method further includes:
if the terminal detects that the switching port which is physically connected with the terminal in the main switch is closed, determining that any standby switch is a new main switch;
and the terminal switches the communication line between the terminal and the new main switch into a main line.
Optionally, the acquiring, by the terminal, a target switch whose port traffic exceeds a preset traffic threshold includes:
if the terminal detects a flow alarm signal, identifying a target switching port for sending the flow alarm signal;
determining the switch corresponding to the target switch port as a target switch with port flow exceeding a preset flow threshold;
and setting a flow threshold in the switching ports of the switches connected with the terminal in advance, so that the switching ports with the flow exceeding the flow threshold send the flow alarm signals to the terminal.
Optionally, the monitoring, by the terminal, port traffic of a switching port physically connected to the terminal in each switch includes:
and when the terminal determines that the local machine does not support the PING protocol of the Internet packet explorer, the terminal monitors the port flow of the switching port which is physically connected with the terminal in each switch respectively.
Optionally, when determining that the local machine supports the PING protocol, the terminal sends a probe packet of the PING protocol to a switching port physically connected to the terminal in each switch;
the terminal determines a main switch and a standby switch in each switch according to the response of each switch port to the detection message;
and the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
Optionally, the determining, by the terminal, the active switch and the standby switch in each switch according to the response of each switch port to the probe packet includes:
the terminal respectively receives a Simple Network Management Protocol (SNMP) message fed back by each switching port aiming at the detection message, wherein the SNMP message comprises a Media Access Control (MAC) layer address in the terminal learned by the switch;
the terminal extracts the MAC address included in the SNMP message from each received SNMP message;
the terminal acquires a target switch which sends an effective MAC address, determines the target switch as a main switch, and determines other switches as standby switches;
and the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
Optionally, when determining that the local computer supports the PING protocol, the terminal sends a probe packet of the PING protocol to a switching port, in each switch, physically connected to the terminal, where the probe packet includes:
the terminal sends a detection message of a PING protocol to a switching port which is physically connected with the terminal in each switch at a preset time interval;
wherein the time interval is greater than or equal to an empirical value of a network congestion duration.
In a second aspect, an embodiment of the present invention further provides a system for detecting a primary/standby switch, where the system includes:
at least two switches and terminals physically connected with the at least two switches respectively;
the terminal is used for respectively monitoring the port flow of a switching port which is physically connected with the terminal in each switch; acquiring a target switch with port flow exceeding a preset flow threshold value, determining the target switch as a main switch and determining other switches as standby switches; and setting the communication line between the main switch and the standby switch as a main line, and setting the communication line between the main switch and the standby switch as a standby line.
In a third aspect, an embodiment of the present invention further provides a terminal, where the terminal includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement a method for detecting a primary standby switch according to any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a method for detecting a primary/secondary switch according to any embodiment of the present invention.
The embodiment of the invention respectively monitors the port flow of the switching port which is physically connected with the terminal in each switch through the terminal; acquiring a target switch with port flow exceeding a preset flow threshold value, determining the target switch as a main switch and determining other switches as standby switches; the communication line between the terminal and the main switch is set as the main line, and the communication line between the terminal and the standby switch is set as the standby line, so that a new mode for the terminal to determine the main switch and the standby switch is provided, and the effect of determining the main line and the standby line among the terminal and a plurality of switch lines can be realized when the terminal does not support the PING protocol.
Drawings
Fig. 1a is a flowchart of a method for detecting a primary/secondary switch according to an embodiment of the present invention;
fig. 1b is a schematic diagram of an interaction process of a primary/secondary switch detection method according to an embodiment of the present invention;
fig. 2a is a flowchart of a method for detecting a primary/secondary switch according to a second embodiment of the present invention;
fig. 2b is a schematic diagram of an interaction process of a primary/secondary switch detection method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a method for detecting a primary/secondary switch according to an embodiment of the present invention;
fig. 4a is a schematic structural diagram of a primary/standby switch detection system according to a third embodiment of the present invention;
fig. 4b is a schematic structural diagram of a primary/standby switch detection device according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1a is a flowchart of a method for detecting a master/standby switch according to an embodiment of the present invention, where this embodiment is applicable to a situation where a plurality of network cards in a terminal are respectively connected to a plurality of switches and a master line and a standby line are determined in communication lines respectively connected to the plurality of switches, and the method may be executed by a master/standby switch detection apparatus, where the apparatus may be implemented in a software and/or hardware manner, and may generally be integrated in various terminal devices, such as a mobile phone, a tablet computer, or a notebook, as shown in fig. 1a, where the method specifically includes:
step 110, the terminal monitors the port traffic of the switching port physically connected to the terminal in each switch.
In a specific example, the terminal includes a network card a and a network card B, the network card a is physically connected to the switching port P in the switch 1, and the network card B is physically connected to the switching port Q in the switch 2.
The terminal can monitor the port flow of the switching port of each switch connected with the network card. When a network card arranged in a terminal communicates with a connected switch, flow is generated; and in a non-communication state, no traffic is generated.
In an implementation manner of the embodiment of the present invention, optionally, when determining that the local computer does not support the PING protocol, the terminal monitors port traffic of a switching port, which is physically connected to the terminal, in each switch, respectively.
The method for detecting the main and standby switches provided by the embodiment of the invention can be suitable for any terminal, can be used when the terminal supports or does not support the PING protocol, and solves the problem that the main and standby switches cannot be determined when the terminal does not support the PING protocol in the prior art.
And step 120, the terminal acquires a target switch with port flow exceeding a preset flow threshold value, determines the target switch as a main switch, and determines other switches as standby switches.
The terminal may determine the port traffic of the monitoring switch port and a preset traffic threshold, determine the corresponding switch as the primary switch if the port traffic exceeds the preset traffic threshold, and determine the corresponding switch as the standby switch if the port traffic does not exceed the preset traffic threshold. The preset flow threshold may be a very small flow threshold, such as 1 byte per second or 2 bytes per second, etc., which is not limited in this embodiment,
in a specific example, when a switching port connected to a terminal in a switch has a traffic passing through, a port traffic of the switching port may exceed a preset traffic threshold, and a traffic alarm signal corresponding to the switching port may be generated to notify the terminal, so as to instruct the terminal to determine a primary switch according to the traffic alarm signal.
In an implementation manner of the embodiment of the present invention, optionally, if the terminal detects the traffic alarm signal, the terminal identifies a target switch port that sends the traffic alarm signal; and determining the switch corresponding to the target switching port as a target switch with the port flow exceeding a preset flow threshold value.
The traffic threshold may be set in advance in the switch ports where the switches are connected to the terminal, so that the switch ports whose traffic exceeds the traffic threshold send traffic alarm signals to the terminal.
The method comprises the steps that a minimum flow threshold value is set in a switching port where each switch is connected with a terminal, when flow passes through, the flow exceeds a preset flow threshold value, and a flow alarm signal is generated. The terminal can detect the flow alarm signal, identify the switching port generating the flow alarm signal, determine the corresponding switch as a target switch with the port flow exceeding a preset flow threshold value, and determine the target switch as a main switch, and the line between the main switch and the corresponding network card in the terminal can be determined as a main line.
And step 130, setting the communication line between the terminal and the main switch as the main line and setting the communication line between the terminal and the standby switch as the standby line by the terminal.
The terminal can determine a line between the main switch and the corresponding network card as a main line, so that the terminal realizes communication through the network card connected with the main switch, the main line and the main switch. The terminal can determine the line between the standby switch and the corresponding network card as a standby line, so that the terminal starts the standby line when the main line is abnormal.
According to the technical scheme of the embodiment, the terminal monitors the port flow of the switching port which is physically connected with the terminal in each switch respectively; the terminal acquires a target switch with port flow exceeding a preset flow threshold value, determines the target switch as a main switch, and determines other switches as standby switches; the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line, and provides a new mode for the terminal to determine the main switch and the standby switch, so that the effect of determining the main line and the standby line among the terminal and a plurality of switch lines can be realized when the terminal does not support the PING protocol.
On the basis of the above embodiment, optionally, if the terminal detects that the switching port physically connected to the terminal in the active switch is closed, it determines that any standby switch is a new active switch; and the terminal switches the communication line between the terminal and the new main switch into the main line.
When the switching port of the main switch physically connected with the terminal is closed, the main line is disconnected, the terminal needs to find a new communication line for communication, the terminal can determine other standby switches as a new main switch, and determine the communication line between the new main switch and the corresponding network card on the terminal as the main line, so that the terminal continues to communicate through the network card connected with the new main switch, the new main line and the new main switch.
If two switches are connected with the terminal, the terminal can directly determine the standby switch as a new main switch; if the number of switches connected to the terminal is more than two, the terminal may determine any one of the at least two standby switches as the new active switch.
Fig. 1b is a schematic diagram of an interaction process of a primary/secondary switch detection method according to an embodiment of the present invention. For example, the switch port of switch a and the switch port of switch B are both connected to terminal C, the switch port of switch a and the switch port of switch B set a traffic threshold to 1, when the switch port in switch a physically connected to the terminal generates a traffic threshold exceeding alarm, the terminal sets the communication line with switch a as a main line, the switch port in switch B physically connected to the terminal does not generate a traffic threshold exceeding alarm, and the terminal sets the communication line with switch B as a spare line. When the switching port physically connected with the terminal in the switch A is closed, the communication line between the switch A and the terminal is switched to a disconnected state, and then the terminal sets the communication line between the switch A and the terminal B as an information main line so as to enable the terminal to keep communication.
Example two
Fig. 2a is a flowchart of a method for detecting a master/standby switch according to a second embodiment of the present invention, which is a further refinement of the foregoing technical solution, and the technical solution in this embodiment may be combined with each optional solution in one or more embodiments.
As shown in fig. 2a, the method specifically includes:
step 210, when the terminal determines that the local machine supports the PING protocol, the terminal sends a detection message of the PING protocol to a switching port physically connected with the terminal in each switch.
When the terminal supports the PING protocol, the primary and secondary switches may be determined by port flow detection, or may be determined by the method in the second embodiment of the present invention. That is, when the terminal supports the PING protocol, the probe packet of the PING protocol may be sent to each switch.
Step 220, the terminal determines the active switch and the standby switch in each switch according to the response of each switch port to the detection message.
In an embodiment of the present invention, optionally, the terminal receives an SNMP (Simple Network Management Protocol) message, which is fed back by each switch port for the detection message, where the SNMP message includes a Media Access Control Address (MAC) Address in the terminal learned by the switch; the terminal extracts the MAC address included in the SNMP message from each received SNMP message; the terminal acquires a target switch for sending the effective MAC address, determines the target switch as a main switch, and determines the standby switches by other switches; the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
The terminal can determine the active switch and the standby switch according to the response of each switch to the detection message of the PING protocol. The switch can learn the MAC address of the network card physically connected in the terminal according to the detection message of the PING protocol, and feed back the MAC address to the terminal in the SNMP message according to the learned MAC address, and correspondingly, the SNMP message comprises the MAC address of the network card physically connected with the switch, which is learned by the switch through the SNMP protocol; the terminal can extract the MAC address of the network card in the SNMP message according to the SNMP message fed back by each switch. Furthermore, the terminal may determine that the MAC address is an effective address when determining that the MAC address is the actual MAC address of the network card.
Optionally, if the identified MAC address does not conform to the structural form of the actual network card address, the MAC address is determined to be an invalid address, for example, when the MAC address is 00-00-00-00-00-00, the MAC address is considered to be an invalid MAC address.
Correspondingly, the switch that sends the SNMP message corresponding to the valid MAC address may be determined as a target switch, the target switch may be determined as a master switch, a communication line between the master switch and the corresponding network card in the terminal may be determined as a master line, and communication lines between other switches and the corresponding network cards in the terminal may be determined as backup lines.
In an implementation manner of the embodiment of the present invention, optionally, the terminal sends a detection message of the PING protocol to a switching port, which is physically connected to the terminal, in each switch at preset time intervals; wherein the time interval is greater than or equal to an empirical value of the network congestion duration.
The terminal can send the detection message of the PING protocol to each switch at a certain time interval, so that the situation that the detection message of the PING protocol is frequently sent to a main switch when a network card is paused and the main switch cannot feed back the actual MAC address of the network card can be avoided; the terminal will re-determine the new main switch and send the detection message of the PING protocol, and still cannot acquire the actual MAC address, causing frequent changes of the main line between the terminal and each switch.
Specifically, the empirical value of the network congestion duration may be obtained by measuring the network congestion duration for multiple times, and averaging or processing the time values obtained multiple times by taking the maximum value.
Step 230, the terminal sets the communication line with the active switch as the active line and sets the communication line with the standby switch as the standby line.
The terminal can determine a line between the main switch and the corresponding network card as a main line, so that the terminal realizes communication through the network card connected with the main switch, the main line and the main switch. The terminal can determine the line between the standby switch and the corresponding network card as a standby line, so that the terminal starts the standby line when the main line is abnormal. If the switching port physically connected with the terminal in the main switch is closed, the communication line between the terminal and the main switch is switched to a disconnected state, and further the terminal needs to find a new line for communication again, other standby switches may be determined as new main switches, and the line communication line between the new main switch and the terminal is determined as an information main line, so that the terminal maintains communication through the network card connected with the new main switch, the main line and the new main switch.
According to the technical scheme of the embodiment, when the terminal determines that the local machine supports the PING protocol, the terminal sends a detection message of the PING protocol to a switching port which is physically connected with the terminal in each switch; the terminal determines a main switch and a standby switch in each switch according to the response of each switch port to the detection message; the terminal sets the communication line between the terminal and the main switch as the main line and sets the communication line between the terminal and the standby switch as the standby line, and provides a new mode for the terminal to determine the main switch and the standby switch, so that the main line and the standby line in the terminal and a plurality of switch lines can be determined in other modes when the terminal supports the PING protocol, and meanwhile, the effect that the terminal frequently switches the communication lines during the pause of a communication network card cannot be caused.
Fig. 2b is a schematic diagram of an interaction process of a primary/secondary switch detection method according to a second embodiment of the present invention. Illustratively, the switch port of the switch a and the switch port of the switch B are both connected to the terminal C, the switch a feeds back an SNMP message through a detection message for the PING protocol, the SNMP message includes an MAC address of a network card physically connected to the switch port of the switch a in the terminal C learned by the switch, and the terminal C receives the SNMP message and extracts the MAC address in the SNMP message.
And when the MAC address acquired by the terminal C is the actual MAC address of the network card in the terminal C, judging that the line of the switch A and the line of the terminal C are the main line, feeding back an SNMP message by the switch B aiming at a detection message of a PING protocol, wherein the SNMP message comprises the MAC address of the network card which is learned by the switch and is physically connected with the switching port of the switch B in the terminal C, and receiving the SNMP message by the terminal C to extract the MAC address in the SNMP message. And if the MAC address acquired by the terminal C is 00-00-00-00-00-00, judging that the line of the switch B and the terminal C is a standby line. When the terminal C detects that the switching port of the switch a physically connected with the terminal C is closed, the terminal C switches the communication line with the switch a to a line disconnection state, and further, the terminal C sets the communication line with the switch B as an information main line, so that the terminal C keeps communication.
Fig. 3 is a flowchart of a method for detecting a primary/standby switch according to an embodiment of the present invention, and as shown in fig. 3, a use process according to an embodiment of the present invention may be: judging whether the terminal supports a PING protocol or not; if the terminal does not support the PING protocol, monitoring the port flow through each switch, and judging whether the port flow exceeds a preset flow threshold value; if the flow rate exceeds the preset flow rate threshold value, the switch sends a flow rate alarm signal to the terminal, the terminal identifies the switch which sends the flow rate alarm signal and determines the switch as a main switch, and a line between the main switch and the terminal is a main line; if the flow rate does not exceed the preset flow rate threshold value, the switch does not send a flow rate alarm signal to the terminal, the terminal determines the switch which does not send the flow rate alarm signal as a standby switch, and a line between the standby switch and the terminal is a standby line.
If the terminal supports the PING protocol, the terminal can send a detection message of the PING protocol to each switch, and the switches learn the MAC address of the terminal based on the detection message and feed back the learned MAC address to the terminal through the SNMP message; the terminal judges whether the obtained MAC address is zero or not; if the obtained MAC address is zero, determining that the exchanger which learns that the MAC address of the terminal is zero is a standby exchanger, and setting a communication line between the standby exchanger and the terminal as a standby line; and if the obtained MAC address is the actual MAC address, determining that the switch which learns that the MAC address of the terminal is the actual MAC address is the main switch, and setting a communication line between the main switch and the terminal as a main line.
EXAMPLE III
Fig. 4a is a schematic structural diagram of a primary/standby switch detection system according to a third embodiment of the present invention. In conjunction with fig. 4a, the system comprises: at least two switches 310 and a terminal 320 physically connected to the at least two switches, respectively.
The terminal 320 is configured to monitor port traffic of a switching port, which is physically connected to the terminal 320, in each switch 310; acquiring a target switch with port flow exceeding a preset flow threshold value, determining the target switch as a main switch and determining other switches as standby switches; and setting the communication line between the main switch and the standby switch as a main line and setting the communication line between the main switch and the standby switch as a standby line.
Optionally, the terminal 320 is further configured to determine that any standby switch is a new active switch if it is detected that a switch port in the active switch, which is physically connected to the terminal 320, is closed; the terminal 320 switches the communication line with the new active switch to the active line.
Optionally, the terminal 320 is configured to, if the traffic alarm signal is detected, identify a target switch port that sends the traffic alarm signal; determining the switch 310 corresponding to the target switch port as a target switch with port flow exceeding a preset flow threshold; in the switching ports of each switch 310 connected to the terminal 320, a traffic threshold is set in advance, so that the switching port whose traffic exceeds the traffic threshold sends a traffic alarm signal to the terminal 320.
Optionally, the terminal 320 is configured to monitor port traffic of a switching port, which is physically connected to the terminal 320, in each switch 310 when it is determined that the local host does not support the PING protocol.
Optionally, the terminal 320 is configured to send a probe packet of the PING protocol to a switching port, physically connected to the terminal 320, in each switch 310 when it is determined that the local machine supports the PING protocol; the terminal 320 determines the active switch and the standby switch in each switch 310 according to the response of each switch port to the detection message; the terminal 320 sets the communication line with the active switch as the active line and sets the communication line with the standby switch as the standby line.
Optionally, the terminal 320 is configured to receive a simple network management protocol SNMP message fed back by each switching port for the detection message, where the SNMP message includes a MAC address of a MAC layer in the terminal 320 learned by the switch; the terminal 320 extracts the MAC address included in the SNMP message from each received SNMP message; the terminal 320 acquires a target switch for sending the effective MAC address, determines the target switch as a main switch, and determines other switches as standby switches; the terminal 320 sets the communication line with the active switch as the active line and sets the communication line with the standby switch as the standby line.
Optionally, the terminal 320 is configured to send, at preset time intervals, a probe packet of a PING protocol to a switching port, physically connected to the terminal 320, in each switch 310; wherein the time interval is greater than or equal to an empirical value of the network congestion duration.
The primary and secondary switch detection system provided by the embodiment of the invention can execute the primary and secondary switch detection method provided by any embodiment of the invention, and has corresponding beneficial effects of the execution method.
Example four
Fig. 4b is a schematic structural diagram of a primary/secondary switch detection device according to a fourth embodiment of the present invention, where the primary/secondary switch detection device is executed by a terminal physically connected to at least two switches. With reference to fig. 4b, the apparatus comprises: port flow monitoring module 330, active/standby switch determining module 340, and active/standby line setting module 350.
A port traffic monitoring module 330, configured to monitor port traffic of a switching port physically connected to a terminal in each switch, respectively;
the active/standby switch determining module 340 is configured to obtain a target switch with a port flow exceeding a preset flow threshold, determine the target switch as an active switch, and determine other switches as standby switches;
the main-standby line setting module 350 is configured to set a communication line with the main switch as a main line, and set a communication line with the standby switch as a standby line.
Optionally, the apparatus further includes:
a new main switch determining module, configured to determine that any one of the standby switches is a new main switch if it is detected that a switching port physically connected to the terminal in the main switch is closed after setting the communication line with the main switch as a main line and the communication line with the standby switch as a standby line;
and the main line determining module is used for switching the communication line between the main line determining module and the new main switch into the main line.
Optionally, the port traffic monitoring module 330 includes:
the target switching port identification unit is used for identifying a target switching port for sending the flow alarm signal if the flow alarm signal is detected;
the target switch determining unit is used for determining the switch corresponding to the target switching port as a target switch of which the port flow exceeds a preset flow threshold value;
the method comprises the steps that a flow threshold value is set in a switching port, connected with a terminal, of each switch in advance, so that the switching port with the flow exceeding the flow threshold value sends a flow alarm signal to the terminal.
Optionally, the port traffic monitoring module 330 includes:
and the port traffic monitoring unit is used for respectively monitoring the port traffic of the switching ports which are physically connected with the terminal in each switch when the fact that the local machine does not support the PING protocol is determined.
Optionally, the apparatus further includes:
the detection message sending module is used for sending the detection message of the PING protocol to a switching port which is physically connected with the terminal in each switch when the fact that the local machine supports the PING protocol is determined;
the main and standby switch determining module is used for determining the main switch and the standby switch in each switch according to the response of each switch port to the detection message;
and the main and standby line determining module is used for setting the communication line between the main switch and the standby switch as the main line and setting the communication line between the main switch and the standby switch as the standby line.
Optionally, the active/standby switch determining module includes:
the SNMP message receiving unit is used for respectively receiving the SNMP messages fed back by each switching port aiming at the detection messages, and the SNMP messages comprise media access control layer MAC addresses in the terminal learned by the switch;
the MAC address extracting unit is used for extracting the MAC address included in the SNMP message from each received SNMP message;
the main/standby switch determining unit is used for acquiring a target switch which sends the effective MAC address, determining the target switch as a main switch, and determining other switches as standby switches;
and the main and standby line determining unit is used for setting the communication line between the main switch and the standby switch as the main line and setting the communication line between the main switch and the standby switch as the standby line.
Optionally, the detection packet sending module includes:
a detection message sending unit, configured to send a detection message of a PING protocol to a switching port, which is physically connected to a terminal, in each switch at preset time intervals;
wherein the time interval is greater than or equal to an empirical value of the network congestion duration.
The device for detecting the main/standby switch provided by the embodiment of the invention can execute the method for detecting the main/standby switch provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention, and as shown in fig. 5, the terminal includes:
one or more processors 410, one processor 410 being exemplified in FIG. 5;
a memory 420;
the apparatus may further include: an input device 430 and an output device 440.
The processor 410, the memory 420, the input device 430 and the output device 440 of the apparatus may be connected by a bus or other means, for example, in fig. 5.
Memory 420, which is a non-transitory computer-readable storage medium, may be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to a primary/secondary switch detection method in an embodiment of the present invention (for example, port traffic monitoring module 330, primary/secondary switch determining module 340, and primary/secondary line setting module 350 shown in fig. 4 b). The processor 410 executes various functional applications and data processing of the computer device by running the software programs, instructions and modules stored in the memory 420, that is, implementing a method for detecting a primary/secondary switch according to the above embodiment of the method, that is: the method is applied to terminals which are respectively physically connected with at least two switches;
the terminal monitors the port flow of a switching port which is physically connected with the terminal in each switch respectively;
the terminal acquires a target switch with port flow exceeding a preset flow threshold value, determines the target switch as a main switch and determines other switches as standby switches;
and the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
The memory 420 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the computer device, and the like. Further, the memory 420 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 420 may optionally include memory located remotely from processor 410, which may be connected to the terminal device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 430 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the computer apparatus. The output device 440 may include a display device such as a display screen.
An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a method for detecting a primary/secondary switch, according to an embodiment of the present invention: the method is applied to terminals which are respectively physically connected with at least two switches;
the terminal monitors the port flow of a switching port which is physically connected with the terminal in each switch respectively;
the terminal acquires a target switch with port flow exceeding a preset flow threshold value, determines the target switch as a main switch and determines other switches as standby switches;
and the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
Any combination of one or more computer-readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for detecting a main/standby switch is applied to a terminal which is respectively physically connected with at least two switches, and is characterized by comprising the following steps:
the terminal monitors the port flow of a switching port which is physically connected with the terminal in each switch respectively;
the terminal acquires a target switch with port flow exceeding a preset flow threshold value, determines the target switch as a main switch and determines other switches as standby switches;
and the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
2. The method according to claim 1, wherein after the terminal sets the communication line with the active switch as the active line and sets the communication line with the standby switch as the standby line, the method further comprises:
if the terminal detects that the switching port which is physically connected with the terminal in the main switch is closed, determining that any standby switch is a new main switch;
and the terminal switches the communication line between the terminal and the new main switch into a main line.
3. The method according to claim 1 or 2, wherein the terminal acquires the target switch with the port traffic exceeding the preset traffic threshold, including:
if the terminal detects a flow alarm signal, identifying a target switching port for sending the flow alarm signal;
determining the switch corresponding to the target switch port as a target switch with port flow exceeding a preset flow threshold;
and setting a flow threshold in the switching ports of the switches connected with the terminal in advance, so that the switching ports with the flow exceeding the flow threshold send the flow alarm signals to the terminal.
4. The method of claim 1, wherein the terminal monitors port traffic of a switching port physically connected to the terminal in each switch, respectively, and comprises:
and when the terminal determines that the local machine does not support the PING protocol of the Internet packet explorer, the terminal monitors the port flow of the switching port which is physically connected with the terminal in each switch respectively.
5. The method of claim 4, further comprising:
when the terminal determines that the local machine supports the PING protocol, the terminal sends a detection message of the PING protocol to a switching port which is physically connected with the terminal in each switch;
the terminal determines a main switch and a standby switch in each switch according to the response of each switch port to the detection message;
and the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
6. The method of claim 5, wherein the determining, by the terminal, the active switch and the standby switch in each switch according to the response of each switch port to the probe packet comprises:
the terminal respectively receives a Simple Network Management Protocol (SNMP) message fed back by each switching port aiming at the detection message, wherein the SNMP message comprises a Media Access Control (MAC) layer address in the terminal learned by the switch;
the terminal extracts the MAC address included in the SNMP message from each received SNMP message;
the terminal acquires a target switch which sends an effective MAC address, determines the target switch as a main switch, and determines other switches as standby switches;
and the terminal sets the communication line between the terminal and the main switch as a main line and sets the communication line between the terminal and the standby switch as a standby line.
7. The method according to claim 6, wherein the terminal sends the PING message of the PING protocol to the switch port physically connected to the terminal in each switch when determining that the local device supports the PING protocol, and the method comprises:
the terminal sends a detection message of a PING protocol to a switching port which is physically connected with the terminal in each switch at a preset time interval;
wherein the time interval is greater than or equal to an empirical value of a network congestion duration.
8. A primary/standby switch detection system, comprising: the system comprises at least two switches and terminals which are respectively and physically connected with the at least two switches;
the terminal is used for respectively monitoring the port flow of a switching port which is physically connected with the terminal in each switch; acquiring a target switch with port flow exceeding a preset flow threshold value, determining the target switch as a main switch and determining other switches as standby switches; and setting the communication line between the main switch and the standby switch as a main line, and setting the communication line between the main switch and the standby switch as a standby line.
9. A terminal, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a method of primary standby switch detection as claimed in any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out a method of primary/secondary switch detection according to any one of claims 1 to 7.
CN201911349354.6A 2019-12-24 2019-12-24 Main and standby switch detection method, system, terminal and storage medium Active CN110912839B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911349354.6A CN110912839B (en) 2019-12-24 2019-12-24 Main and standby switch detection method, system, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911349354.6A CN110912839B (en) 2019-12-24 2019-12-24 Main and standby switch detection method, system, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN110912839A CN110912839A (en) 2020-03-24
CN110912839B true CN110912839B (en) 2021-11-26

Family

ID=69827381

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911349354.6A Active CN110912839B (en) 2019-12-24 2019-12-24 Main and standby switch detection method, system, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN110912839B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007006194A1 (en) * 2005-07-14 2007-01-18 Huawei Technologies Co., Ltd. A method and a device of detecting the quality of service in a communication network
CN101150430A (en) * 2007-09-17 2008-03-26 中兴通讯股份有限公司 A method for realizing network interface board switching based heartbeat mechanism
CN101155109A (en) * 2006-09-30 2008-04-02 华为技术有限公司 Ethernet switching system and equipment
CN102480485A (en) * 2010-11-30 2012-05-30 杭州华三通信技术有限公司 System, method and switching device for realizing cross-device isolation of ports in same VLAN (virtual local area network)
CN103368712A (en) * 2013-07-18 2013-10-23 华为技术有限公司 Switchover method and device for main equipment and standby equipment
CN105188098A (en) * 2015-09-30 2015-12-23 努比亚技术有限公司 Mobile terminal network switching apparatus and network switching method
CN106330700A (en) * 2015-06-15 2017-01-11 中兴通讯股份有限公司 Method and device for data communication network main and standby access network element protection
CN106656311A (en) * 2016-12-15 2017-05-10 国网山东省电力公司长岛县供电公司 Data link backup apparatus and method
CN107968718A (en) * 2016-10-20 2018-04-27 浙江大华技术股份有限公司 A kind of method, apparatus and equipment for confirming standby usage state
CN109408297A (en) * 2018-10-30 2019-03-01 北京东土军悦科技有限公司 A kind of method, apparatus of main and standby competition, equipment and storage medium
CN109861867A (en) * 2019-02-28 2019-06-07 新华三技术有限公司 A kind of MEC method for processing business and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080184341A1 (en) * 2007-01-29 2008-07-31 David Jaroslav Sebesta Master-Slave Protocol for Security Devices
CN109714230B (en) * 2018-12-29 2021-02-02 北京世纪互联宽带数据中心有限公司 Flow monitoring method and device and computing equipment
CN109831341B (en) * 2019-03-19 2021-10-15 中国电子科技集团公司第三十六研究所 Method and device for rapidly switching redundant double network cards

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007006194A1 (en) * 2005-07-14 2007-01-18 Huawei Technologies Co., Ltd. A method and a device of detecting the quality of service in a communication network
CN101155109A (en) * 2006-09-30 2008-04-02 华为技术有限公司 Ethernet switching system and equipment
CN101150430A (en) * 2007-09-17 2008-03-26 中兴通讯股份有限公司 A method for realizing network interface board switching based heartbeat mechanism
CN102480485A (en) * 2010-11-30 2012-05-30 杭州华三通信技术有限公司 System, method and switching device for realizing cross-device isolation of ports in same VLAN (virtual local area network)
CN103368712A (en) * 2013-07-18 2013-10-23 华为技术有限公司 Switchover method and device for main equipment and standby equipment
CN106330700A (en) * 2015-06-15 2017-01-11 中兴通讯股份有限公司 Method and device for data communication network main and standby access network element protection
CN105188098A (en) * 2015-09-30 2015-12-23 努比亚技术有限公司 Mobile terminal network switching apparatus and network switching method
CN107968718A (en) * 2016-10-20 2018-04-27 浙江大华技术股份有限公司 A kind of method, apparatus and equipment for confirming standby usage state
CN106656311A (en) * 2016-12-15 2017-05-10 国网山东省电力公司长岛县供电公司 Data link backup apparatus and method
CN109408297A (en) * 2018-10-30 2019-03-01 北京东土军悦科技有限公司 A kind of method, apparatus of main and standby competition, equipment and storage medium
CN109861867A (en) * 2019-02-28 2019-06-07 新华三技术有限公司 A kind of MEC method for processing business and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
《Introducing routing standby in network nodes to improve energy savings techniques》;Antonio Cianfrani; Vincenzo Eramo;《2012 Third International Conference on Future Systems: Where Energy, Computing and Communication Meet (e-Energy)》;20120621;全文 *
《PTN网络组网方案的研究与应用》;李新村;《中国优秀硕士学位论文全文数据库 信息科技辑》;20190115;全文 *
《浅谈通过MRTG实时监控交换机端口流量》;肖民,孙玉峰;《广播电视信息》;20050731(第7期);全文 *

Also Published As

Publication number Publication date
CN110912839A (en) 2020-03-24

Similar Documents

Publication Publication Date Title
US11115426B1 (en) Distributed packet capture for network anomaly detection
WO2016107270A1 (en) Device managing method, device and device managing controller
CN113395687B (en) Reconnection method, reconnection device, electronic equipment and storage medium
CN111694674B (en) Message distribution processing method, device, equipment and storage medium
CN109040295B (en) Method and device for determining abnormal disconnection, terminal and storage medium
EP3010289A1 (en) Method and apparatus for controlling signal transmission and electronic device
CN106714287B (en) Method and device for saving electric quantity of terminal based on network access control
CN112217658A (en) Stacking and splitting processing method and device
US20170280410A1 (en) Method, device and system for implementing information self-registration, and computer storage medium
CN107204924B (en) Link discovery method and device
CN112398689A (en) Network recovery method and device, storage medium and electronic equipment
CN109729059B (en) Data processing method and device and computer
CN103916226A (en) Redundant backup method based on embedded equipment
CN113315665A (en) Message sending method, device, equipment and medium of dual-network-card terminal equipment
WO2020088351A1 (en) Method for sending device information, computer device and distributed computer device system
CN112929324B (en) Encryption and non-encryption switching method, device, equipment and storage medium
CN110912839B (en) Main and standby switch detection method, system, terminal and storage medium
KR20150104435A (en) Method of performing transition of operation mode for a routing processor
CN106817316B (en) Method, device and system for detecting path MTU
US9825901B2 (en) Method, device, and system for acquiring internet protocol address
US10079893B2 (en) M2M application request sending method, CSE and system
CN108289165B (en) Method and device for realizing camera control based on mobile phone and terminal equipment
CN112612670B (en) Session information statistical method, device, exchange equipment and storage medium
CN112653609B (en) VPN identification application method, device, terminal and storage medium
WO2017215672A1 (en) Power supply method and power supply device in poe system

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
GR01 Patent grant
GR01 Patent grant