Summary of the invention
The object of the present invention is to provide the active-standby switch systems and switching method of a kind of Ethernet switch, without complexity
Link Control Protocol ensures the reliability of link, implements simple and easy, can shorten research and development of products cost and time, simultaneously
More hardware supporteds are not needed, to save hardware cost yet.
To achieve the above object, in a first aspect, the present invention provides a kind of active-standby switch system of Ethernet switch,
Include:
First link optical signal detecting unit, detects the optical signal of the first link, and export first detection signal;
Wherein, first link is the primary link under current state;
First Link failure detection unit detects the link state of first link, and exports the second detection
Signal;
Second link optical signal detecting unit, detects the optical signal of the second link, and exports third detection signal;
Second link is the standby link under current state;
Second Link failure detection unit detects the link state of second link, and exports the 4th detection
Signal;
Pretreatment unit receives the first detection signal, the second detection signal, third detection signal and the 4th detection letter
Number;Under current state, when the first detection signal and/or the second detection signal generating state change, the pretreatment
Unit exports interrupt trigger signal;
Processor receives the interrupt trigger signal, and generates link switching control letter according to the interrupt trigger signal
Number;
Local switch, receives the link switching control signal, controls signal for described according to the link switching
The Ethernet access port of ground interchanger is switched to the second port of the second link of connection by the first port for connecting the first link.
Preferably, the processor generates status inquiry signal according to prefixed time interval, and the status inquiry is believed
Number it is sent to the local switch;
The state of the link state of the local switch first link according to the status inquiry signal acquisition is believed
The status information of the link state of breath and second link, and by the status information of the link state of first link and the
The status information of the link state of two links is successively sent to the processor according to the prefixed time interval;
The processor is according to the status information of the link state of first link and the link state of the second link
Status information determines whether to carry out link switching;Wherein, when the status information of the link state of first link changes
When, the processor generates link switching and controls signal.
It is further preferred that when the status information of the link state of second link changes, the processor
Fault-signal is generated, it is abnormal to prompt the standby link to occur.
Preferably, after generating link switching control signal, the processor generates ARP message,
And the ARP message is sent to higher level's interchanger by the second link that the second port of local switch connects;Wherein, institute
State the MAC address information that ARP message includes second port.
Preferably, after generating link switching control signal, the processor deletes described first in mac address table
The mac address information of port, and add the mac address information of the second port.
In second aspect, the present invention provides a kind of main/standby switching methods of Ethernet switch, comprising:
The optical signal of first link is detected, exports first detection signal, also, to the link of first link
State is detected, output the second detection signal;Wherein, first link is the primary link under current state;And
The optical signal of second link is detected, output third detects signal, also, to the link of second link
State is detected, the 4th detection signal of output;Second link is the standby link under current state;
Under current state, when the first detection signal and/or the second detection signal generating state change, in generation
Disconnected trigger signal, so that processor, which generates link switching according to the interrupt trigger signal, controls signal, thus by local exchange
The Ethernet access port of machine is switched to the second port of the second link of connection by the first port for connecting the first link.
Preferably, before port switching, the method also includes:
Status inquiry signal is generated according to prefixed time interval;
According to the status inquiry signal, the link shape of first link is successively obtained according to the prefixed time interval
The status information of the link state of the status information of state and second link;
When the status information of the link state of first link changes, the processor generates link switching control
Signal processed.It is further preferred that the method also includes:
When the status information of the link state of second link changes, fault-signal is generated, to prompt
It states standby link and exception occurs.
Preferably, after generating link switching control signal, the method also includes:
ARP message is generated, and the ARP message is connected by the second port of local switch
Second link is sent to higher level's interchanger;Wherein, the ARP message includes the media access control MAC of the second port
Location information.
Preferably, after generating link switching control signal, the method also includes:
The mac address information of the first port is deleted in mac address table, and with adding the MAC of the second port
Location information.
The active-standby switch system of Ethernet switch provided in an embodiment of the present invention is come without complicated Link Control Protocol
The reliability for ensureing link, implements simple and easy, can shorten research and development of products cost and time, while also not needing more
Hardware supported, to save hardware cost.
Specific embodiment
Below by drawings and examples, technical scheme of the present invention will be described in further detail.
The active-standby switch system of Ethernet switch provided in an embodiment of the present invention, can be applied to dedicated network or small
Type controls in network.It specifically can be as shown in Figure 1.
Equipment 1 to equipment 11 is connected to the second line of a couplet port of active-standby switch system, accesses network by active-standby switch system 1.
Active-standby switch system 1 includes control module 101 and local switch 102.The first line of a couplet port P12, P16 in local switch 102
Master-slave redundancy port each other is respectively used to be connected to interchanger 2 and interchanger 3.Interchanger 2 and interchanger 3 are separately connected routing
Device 1 and router 2.This two routers can be used as gateway, and for the sake of simplicity, two routers are also redundancy backup,
Therefore use identical network MAC and IP.
Active-standby switch system 1 selects the port P12 or the port P16 accessing network by control module 101 therein, as
Equipment 1 accesses the main chain road port of network to equipment 11, so that selection realizes network by the link of interchanger 2 and router 1
Connection realizes network connection by the link of interchanger 3 and router 2.
In the following, being illustrated by taking Fig. 2 as an example to the active-standby switch system of Ethernet switch of the invention.
As shown, the active-standby switch system of the Ethernet switch of the embodiment of the present invention includes: the first link optical signal
Detection unit 11, the second link optical signal detecting unit 12, the first Link failure detection unit 21, the second Link failure detection list
Member 22, pretreatment unit 3, processor 4 and local switch 5.
First link optical signal detecting unit 11, detects the optical signal of the first link, and exports the first detection letter
Number P12_SD;
First Link failure detection unit 21 can specifically realize by PHY chip, to the link state of the first link into
Row detection, and export the second detection signal PHY_INT1;
Second link optical signal detecting unit 12, detects the optical signal of the second link, and exports third detection letter
Number P16_SD;
Second Link failure detection unit 22 can specifically realize by PHY chip, to the link state of the second link into
Row detection, and export the 4th detection signal PHY_INT2;
Pretreatment unit 3 receives the first detection signal P12_SD, the second detection signal PHY_INT1, third detection
The detection of signal P16_SD and the 4th signal PHY_INT2;
Assuming that the first link is primary link under current state, the second link is standby link, then pretreatment unit 3 is to first
The signal condition of detection signal P12_SD and third detection signal PHY_INT1 are detected, as first detection signal P12_SD
And/or when third detection signal PHY_INT1 generating state change, pretreatment unit 3 exports interrupt trigger signal;
Assuming that the second link is primary link under current state, the first link is standby link, then pretreatment unit 3 is to third
The signal condition of the detection of detection signal P16_SD and the 4th signal PHY_INT2 is detected, as the second detection signal P16_SD
And/or when the 4th detection signal PHY_INT2 generating state change, pretreatment unit 3 exports effective interrupt trigger signal;
Wherein, the first link optical signal detecting unit 11, the second link optical signal detecting unit 12 can be examined using signal
SFP optical module is surveyed to realize, the first Link failure detection unit 21, the second Link failure detection unit 22 can use detect with
Too net PHY chip realizes that pretreatment unit 3 can realize using complex programmable logic device (CPLD).
Processor 4 receives interrupt trigger signal INT1, when it is effective for detecting interrupt trigger signal INT1, generates chain
Road switch-over control signal ctl1;
Local switch 5, receives link switch-over control signal ctl1 control signal ctl1 for local friendship according to link switching
The Ethernet access port changed planes is switched to the second port of the second link of connection by the first port P12 for connecting the first link
P16。
To realize active-standby switch, after processor 4 generates link switching control signal ctl1, address resolution association can be generated
(ARP) message is discussed, and the ARP message is sent to by the second link of the second port P16 connection of local switch 5
Grade interchanger;Wherein, ARP message includes the information such as address media access control (MAC) of second port P16.Figure is combined as a result,
Shown in 1, in the network shown in fig. 1, by ARP message, higher level is sent by the information of the MAC Address of second port P16 and is handed over
It changes planes, i.e. interchanger 2 and interchanger 3 in Fig. 1 enable interchanger 2 and 3 Fast Learning of interchanger to the MAC of new port
Address, so as to shorten the MAC address learning time.
In addition, processor 4 can also delete the mac address information of first port P12 in the mac address table of storage, and
The mac address information of second port P16 is added in mac address table.
As described above, there is the active-standby switch system of Ethernet switch of the invention the inspection of link optical signal to ensure machine
System and PHY chip physical link up/down detect security mechanism.
Link optical signal checks security mechanism, and the SFP optical module production of port (port active) is currently accessed by detecting
The level change of raw signal determines that whether there is or not optical signals, such as high level is exported when SFP optical module receives optical signal
Signal is detected, low level detection signal is exported when being not received by optical signal.It therefore, can be with when there is no optical signal
Link down is determined by the low level detection signal that CPLD is received, to report processor 4.Link optical signal inspection is protected
The advantages of barrier mechanism, is that this method efficiency highest can most detect active fiber port fastly and disconnect exception, the disadvantage is that
Distal end optical module operation irregularity can not adopt this method detection link down in the case where remaining at optical path connection.
PHY chip physical link up/down detects security mechanism, then is the transmission code stream that link is detected by PHY chip,
In the case where bit stream interrupts, level conversion occurs for the detection signal of PHY chip, such as becomes low level from high level, from
And avoided from physical layer optical signal it is constant when can not to code stream interrupt report the shortcomings that.
Therefore, check that security mechanism and PHY chip physical link up/down detect security mechanism energy by link optical signal
It is enough that effectively physical link down is fallen and (includes the case where that optical signal is lost and code stream is lost) to detect, by reporting processing
Device 4 and realize the switching for controlling active and standby port, to realize the switching for carrying out network communication on from active link to backup link.
Both the above security mechanism is all to receive abnormal Shi Caihui by active-standby switch system when link is abnormal
Execute the passive security mechanism of switching.In addition to this, the active-standby switch system of Ethernet switch provided in an embodiment of the present invention
A kind of poll detection security mechanism of active inquiry link state is additionally provided, is provided for the detection validity of active and standby switching system
Double shield.
As shown in Fig. 2, in the active-standby switch system of the Ethernet switch of the present embodiment, processor 4 according to it is preset when
Between detection generate status inquiry signal, and status inquiry signal is sent to local switch 5.
Specifically, processor 4 generates status inquiry signal according to prefixed time interval, and status inquiry signal is sent to
Physical layer equipment under the local switch carries out the inquiry of link.As shown, specifically inquiry signal path is processing
After device 4 sends inquiry signal to the control port of local switch 5 by control port, local switch 5 is connect by SMI_PHY
Mouth inquires the corresponding state register of physical layer equipment (PHY chip 21 and PHY chip 22 in figure), and by identical
Path the information inquired is fed back.
Processor 4 successively obtains the first link that the first Link failure detection unit 21 detects according to prefixed time interval
Link state status information and the state of the link state of the second link that detects of the second Link failure detection unit 22
Information;
It is in the case that the second link of active link is standby link in the first link:
When poll detects that the link state of the first link changes, illustrates that active link is abnormal, locate at this time
It manages device 4 and generates link switching and control signal ctl1, the access interface of control switching local switch 5 is by the of the first link of connection
Single port P12 is switched to the second port P16 of the second link of connection.
In addition, can also monitor the state of reserve link by poll detection.When poll detects the link shape of the second link
When state changes, illustrate that failure has occurred in standby link, processor 4 can generate fault-signal at this time, to prompt related work
There is exception in personnel's standby link, so that staff carries out timely inspection and maintenance to standby link, so that being led
Standby link will not influence normal communications when switching.
Polling cycle can be set according to the performance of processor 4, preferably can be using the poll week of 5ms to 10ms
Phase.
Under normal conditions, link optical signal checks that security mechanism and PHY chip physical link up/down detect security mechanism
Triggering all can earlier than poll detect security mechanism.I.e. when being abnormal, machine first can be ensured by link optical signal inspection
System and PHY chip physical link up/down detection security mechanism detect.But poll is added and detects security mechanism, Ke Yiwei
Active-standby switch system of the invention provides double shield.
The active-standby switch system of Ethernet switch provided in an embodiment of the present invention is come without complicated Link Control Protocol
The reliability for ensureing link, implements simple and easy, does not also need more hardware supporteds, is greatly saved cost.
Correspondingly, executing the embodiment of the invention also provides a kind of main/standby switching method of Ethernet switch above-mentioned
In the active-standby switch system of embodiment.
As shown in figure 3, this method comprises the following steps:
Step 310, active-standby switch system initialization;
Specifically, the configuration of primary interface is carried out by configuration order row in processor first after system electrification starting.
As shown in connection with fig. 2, if 2 ports P12, P16 have optical fiber insertion, i.e., in the case that 2 ports are all link up state, meeting
It determines which port is main port according to configuration, while being fallen spare Ethernet interface Link down according to configuration information,
It is about to the configuration data that interface issues by configuration order to be all stored in query configuration module.In this example, P12 is set first
First link of port access is active link, i.e., the port P12 is main port.
Then, the mounting initialization of interrupt processing function, interruption and PHY mainly for generation of optical signal detecting are carried out
The interruption of Link UP/DOWN.Start automatic regular polling main/slave link state later, polling time interval is set.
Step 320, the optical signal of the first link is detected, exports first detection signal, also, to first chain
The link state on road is detected, output the second detection signal;The optical signal of second link is detected, output third detection
Signal, also, the link state of second link is detected, the 4th detection signal of output;
Specifically, being by detecting and being currently accessed the SFP optical module that port is connect the letter generated to the detection of optical signal
Number level change determine that whether there is or not optical signals, such as the detection letter of high level is exported when SFP optical module receives optical signal
Number, low level detection signal is exported when being not received by optical signal.So if optic path exception, SFP optical mode occurs
The signal output of block will switch to low level by high level.
The transmission code stream for detecting link when to the detection of link state by PHY chip, the case where bit stream interrupts
Under, level conversion occurs for the detection signal of PHY chip, such as becomes low level from high level.
Step 330, status inquiry signal is generated according to prefixed time interval, according to the status inquiry signal, according to institute
State prefixed time interval successively obtain first link link state status information and second link link shape
The status information of state.
Specifically, illustrating that active link is abnormal when poll detects that the link state of the first link changes.
Above-mentioned steps 320 can be synchronous execution with step 330.
Step 340, when first detection signal and/or the second detection signal generating state change, or when detecting the
When the status information of the link state of one link changes, generates link switching and control signal, thus by local switch
Ethernet access port is switched to the second port of the second link of connection by the first port for connecting the first link.
Specifically, first detection signal or second detection signal either one or two all change when, such as by height
When level becomes low level, illustrate that exception occur in the optical signal of work at present link or bit stream;When poll detects
When the link state of one link changes, also illustrate that active link is abnormal;Any of the above-described processor when happening is all
Link switching control signal, the access of control switching main/slave link can be generated.
Step 350, ARP message is generated, and ARP message is connected by the second port of local switch
The second link connect is sent to higher level's interchanger.
Specifically, the ARP message includes the MAC address information of the second port.So that
Higher level's interchanger can Fast Learning to new port MAC Address, so as to shorten the MAC address learning time.
In addition it is also necessary to delete the mac address information of the first port in mac address table, and add described second
The mac address information of port.
In order to guarantee not influence communication quality, active/standby link switchover process needs to complete in defined time range.
Below with a specific example, switching time is illustrated.
Assuming that the MAC Address quantity for the equipment being connected in system with local switch is no more than 20, it is upward according to every 1ms
Grade interchanger passes a MAC Address and calculates, and 20ms is needed to notify higher level to exchange the mac address table of masterslave switchover activation port altogether
Machine.Ports physical switching time is no more than 10ms.
When mac address table dynamic configuration, the mac address table of aging port can be deleted by an instruction.Dynamic configuration is excellent
Point is that MAC Address learns to obtain automatically by interchanger, the disadvantage is that only receiving report if certain host or motherboard are special device
Text, then interchanger can not obtain its MAC Address, also can not just communicate with the device.
Static configuration then needs deleting MAC address list item one by one.Static configuration passes through life after referring to initialization switch
It enables, motherboard each in system and host MAC address is added in MAC Address list item manually, thus can solve Special Main
Communication issue between machine board and interchanger is not supported in system the disadvantage is that the MAC Address of motherboard and host must be fixed
Each host board dynamic is added or change MAC Address, and port switching aging address list item needs to delete one by one, needs time ratio
It is longer.The port interchanger P12 and P16 must record the mac address table of gateway and be necessary for static configuration, general gateway address table
It is one or two.Therefore one 2 address list items needs deletions is shared and are added.
The general 12ms time is needed according to 2 address list items are deleted and added when static configuration, along with what is analyzed above
Other times consumption, total switching time are 42ms.The above is only the analyzing examples of a concrete instance, it is not used to limit this hair
The switching time of the main/standby switching method of bright Ethernet switch in practical applications.
The main/standby switching method of Ethernet switch provided in an embodiment of the present invention comes without complicated Link Control Protocol
The reliability for ensureing link, implements simple and easy, can shorten research and development of products cost and time, while also not needing more
Hardware supported, to save hardware cost.
Professional should further appreciate that, described in conjunction with the examples disclosed in the embodiments of the present disclosure
Unit and algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, hard in order to clearly demonstrate
The interchangeability of part and software generally describes each exemplary composition and step according to function in the above description.
These functions are implemented in hardware or software actually, the specific application and design constraint depending on technical solution.
Professional technician can use different methods to achieve the described function each specific application, but this realization
It should not be considered as beyond the scope of the present invention.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can be executed with hardware, processor
The combination of software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only memory
(ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technical field
In any other form of storage medium well known to interior.
Above-described specific embodiment has carried out further the purpose of the present invention, technical scheme and beneficial effects
It is described in detail, it should be understood that being not intended to limit the present invention the foregoing is merely a specific embodiment of the invention
Protection scope, all within the spirits and principles of the present invention, any modification, equivalent substitution, improvement and etc. done should all include
Within protection scope of the present invention.