Determination methods and a kind of router that the Virtual Router Redundacy Protocol active router lost efficacy
Technical field
The present invention relates to the data communication field, be specifically related to determination methods and a kind of router that Virtual Router Redundacy Protocol VRRP (VirtualRouter Redundancy Protoco1) active router lost efficacy.
Background technology
In network based on ICP/IP protocol, in order to guarantee the communication between the equipment that direct physical not connects, must specified circuit by.Specified circuit at present commonly used by method have two kinds: a kind of is by Routing Protocol (such as interior routing protocol RIP and OSPF) dynamic learning; Another kind is a static configuration.It is unpractical all moving dynamic routing protocol in each terminal, and the client operating system platform is not supported dynamic routing protocol mostly, even support also to be subjected to the restriction of many problems such as administration overhead, the degree of convergence, fail safe.Therefore generally adopting terminal IP device static routing configuration, generally is to specify one or more default gateway (Default Gateway) to terminal equipment.The method of static routing has been simplified the complexity of network management and alleviated the communication overhead of terminal equipment, but it still has a shortcoming: if damage as the router of default gateway, all use this gateway must interrupt for next communication of jumping main frame.Even if disposed a plurality of default gateways,, can not switch to new gateway as not restarting terminal equipment.Adopt Virtual Router Redundacy Protocol (Virtual Router Redundancy Protocol is called for short VRRP) can well avoid static defective of specifying gateway.
In the VRRP agreement, two groups of important notions are arranged: VRRP router and virtual router, master control router and backup router.The VRRP router is meant the router of operation VRRP, is physical entity, and virtual router is meant what the VRRP agreement was created, is logical concept.The collaborative work of one group of VRRP router constitutes a virtual router jointly.This virtual router externally shows as a router logic with unique fixed ip address and MAC Address.Be in the role that router in the same VRRP group has two kinds of mutual exclusions: master control router and backup router, there is and has only a router that is in the master control role in the VRRP group, can there be one or more to be in backup role's router.The VRRP agreement uses selection strategy to select one as master control from groups of routers, is responsible for handling ARP (Addree Require Protocol, Address requests agreement) and transmits the IP packet, and other router in the group is ready as the role of backup.When the master control router breaks down for a certain reason, backup router can several seconds the time delay and upgrade to active router.Because this switching need not change IP address and MAC Address, so be transparent to the terminal user system.
Below the basic conception of VRRP agreement and working machine are manufactured and are briefly introduced:
Basic conception:
The VRRP group
The VRRP group is meant and has disposed identical VRID (Virtual Router ID), and has a same virtual address, be operated in the set of router in the broadcast domain, general VRRP group is made up of two or more router, and the VRPP that has only an equipment in VRRP group is in, and main to use state, other equipment all be to be in stand-by state.
The VRRP state:
DISABLE (closing) state: a certain VRRP group does not dispose main virtual ip address, and initial configuration is in this state;
INITIAL (initially) state: a certain VRRP configuration set main virtual ip address, but its interface quits work (Down) or do not have interface IP address.
MASTER (master) state: the master uses the VRRP router, and the router that is in this state has VRRP virtual ip address and virtual MAC, and the response purpose is the request of virtual IP address and MAC, and timed sending VRRP protocol massages is given other VRRP equipment.
BACKUP (backup) state: backup VRRP router, the router under this state receives the VRRP message, if do not receive the notification packet of main equipment within a certain period of time, this state can become the MASTER state.
VRRP PRIORITY (priority), each VRRP router have the priority (1-255) of oneself, and carry out active and standby election contest by this priority, and what priority was high is host apparatus.Agreement regulation VRRP group default priority is 100.
ADVERTISE_TIME (notification time), the VRRP notification time, being in main VRRP group with state need send a notification packet a notification time in the cycle, and VRRP agreement regulation acquiescence notification time is 1 second.
MASTER_DOWN_TIME (master server out-of-service time), the VRRP that is in stand-by state organizes, if do not receive the message that priority ratio oneself is high in MASTER_DOWN_TIME, need switch to the main state of using to main frame.The computing formula of MASTER_DOWN_TIME is as follows:
SKEW_TIME=(255-PRIORITY)/255;
MASTER_DOWN_TIME=3*ADVERTISE_TIME+SKEW_TIME;
Wherein SKEW_TIME is the slope time of agreement regulation.
VRRP Track strategy, VRRP follows the tracks of Link State (interface UP/DOWN, route, BFD etc.), takes certain action policy according to Link State.
Propagate in a broadcast domain by protocol massages between the VRRP group, and carry out active and standby election contest, reach the purpose of standby redundancy by the height of priority.The double layer network that needs a connection below two VRRP routers, be in main with the interface of the VRRP router state under by configuration VRRP, to other VRRP routers transmission protocol massages.The VRRP router is received the VRRP protocol massages of other router, by priority ratio, changes own residing state and campaigns for out active/standby gateway, and in-group priority is the highest serves as the main gateway of using, other as standby gateway.
The main multicast notification packet that relies on the primary route device between the host-standby communication of VRRP, standby router monitors the state of primary route device by notification packet, and keeps stand-by state.Each VRRP group of VRRP agreement regulation host apparatus need be sent out a notification packet in each announcement cycle, and stand-by equipment does not receive notification packet in continuous three announcement cycles, will become main equipment to oneself, and produces active and standby election contest.The router of winning in the election contest of equipment group sends VRRP group notification packet.Because general each announcement cycle is 1 second, continuous like this three announcement cycles are three seconds time.
Though the VRRP agreement can several seconds the time delay by backup router and upgrade to active router, under high bandwidth and multiple services application scenarios, may cause losing of service traffics, thereby influence user's business experience.Specifically, because backup router will just be initiated active and standby election contest announcement at 3 all after dates of announcement, default each announcement cycle is 1 second, and 3 announcement cycles are 3 seconds so.If transmission rate is 100Mbps (megabit per second), will there be the data of 300Mbits to lose so because of routing failure.
Summary of the invention
The technical problem to be solved in the present invention provides determination methods and a kind of router that a kind of Virtual Router Redundacy Protocol active router lost efficacy, and can shorten the judgement time that active router was lost efficacy, and then shortens switching time, reduces losing of service traffics.
For solving the problems of the technologies described above, the invention provides the determination methods that active router lost efficacy among a kind of Virtual Router Redundacy Protocol VRRP, comprising:
Be each configuration of routers switching judging parameter, described switching judging parameter comprises statistical parameter N and message threshold value M, and N and M are natural number, N 〉=M, M≤3;
Each backup router calculates separately statistic period T according to statistical parameter according to following formula:
T=N* notification time cycle+slope time;
Each backup router is added up the number of times of not receiving the VRRP notification packet in measurement period separately, when the number of times accumulative total of not receiving the VRRP notification packet in the measurement period reaches message threshold value M, initiate active and standby election contest.
Further, active router receives the message of the active and standby election contest of backup router transmission, adjusts the priority of oneself, participates in active and standby election contest.
Further, the described slope time equal=(255-PRIORITY)/255; Wherein, PRIORITY is the priority of backup router.
For solving the problems of the technologies described above, the present invention also provides a kind of router, comprises receiving element, computing unit, statistics judging unit and election contest unit:
Described receiving element is used to receive the switching judging parameter of VRRP notification packet and configuration, and described switching judging parameter comprises statistical parameter N and message threshold value M, and N and M are natural number, N 〉=M, M≤3;
Described computing unit is used for according to statistical parameter according to following formula counting statistics period T: T=N* notification time cycle+slope time;
Described statistics judging unit is used to add up the number of times M ' that does not receive the VRRP notification packet in each measurement period, when judging that M ' equals message threshold value M, sends signal to the election contest unit;
Described election contest unit is used for initiating active and standby election contest behind the signal that receives the transmission of statistics judging unit.
Further, the described slope time equal=(255-PRIORITY)/255; Wherein, PRIORITY is the priority of backup router.
Further, described statistics judging unit when judging that M ' is not equal to message threshold value M, is proceeded statistics, after a measurement period arrives, adds up again.
Further, the active and standby election contest of described initiation is to point to the message that active router sends active and standby election contest.
The present invention uses dynamic duration threshold value to come the determination methods that lost efficacy at active router among the VRRP in Ethernet and IP communication network.Can effectively shorten the time that backup router judges whether active router lost efficacy.
Adopt the method for the invention, can under the unsettled situation of active router, prepare active and standby election contest and active and standby switching in advance, prevent unnecessary active and standby election contest simultaneously.And can dispose the competitive strategy of VRRP according to network performance, the configuration backup server is initiated the opportunity of main and standby competition neatly.
Description of drawings
Accompanying drawing described herein is used to provide further understanding of the present invention, constitutes the application's a part, and illustrative examples of the present invention and explanation thereof are used to explain the present invention, do not constitute improper qualification of the present invention.In the accompanying drawings:
Fig. 1 initiates the flow chart of active and standby election contest for backup router;
Fig. 2 receives the flow chart that participates in active and standby election contest after the message of active and standby election contest for active router;
Fig. 3 is for realizing the router schematic diagram of the inventive method.
Embodiment
Inventive concept of the present invention is: be each configuration of routers switching judging parameter, comprise statistical parameter N and message threshold value M, N and M are natural number, N 〉=M, M≤3; Each backup router calculates separately statistic period T according to statistical parameter according to following formula: T=N* notification time cycle+slope time; Each backup router is added up the number of times of not receiving the VRRP notification packet in measurement period separately, when the number of times accumulative total of not receiving the VRRP notification packet in the measurement period reaches message threshold value M, initiate active and standby election contest.
The parameter N of announcement measurement period and start the threshold value M of active and standby election contest can be determined by the configuration to active and standby router, also can transmit by the expansion to the field of VRRP message.
Receive the message of active and standby election contest when active router after, participate in active and standby election contest.The router of winning in election contest sends VRRP group notification packet, becomes active router.
The flow process of initiating active and standby election contest with a backup router is that example describes, and the flow process of other backup routers is identical, as shown in Figure 1, may further comprise the steps:
Step 110 is according to the statistical parameter counting statistics cycle;
Statistic period T: T=N* notification time cycle+slope time;
Wherein, the notification time cycle is generally the fixed value of agreement regulation; Slope time SKEW_TIME=(255-PRIORITY)/255; Wherein PRIORITY is the priority of this backup router;
Step 120, counter O reset;
Step 130 picks up counting;
Two timers can be set, and a timer is used for the timing notification time cycle, and another is used for the timing measurement period;
Can be carried the time started in message by webmaster, each backup router carries out timing according to the time started of writing down in the message, perhaps just picks up counting after entering this flow process after the election contest end.
Step 140, through a notification time cycle, backup router judges whether receive notification packet in this cycle, if receive, then returns this step, waits for next notification time cycle arrival, otherwise carries out next step;
Step 150, count value M ' adds 1;
Step 160 judges whether to arrive measurement period, if carry out next step, otherwise return step 140;
Step 170 judges whether count value M ' equals M, if carry out next step, otherwise return step 120;
Step 180 is initiated the active and standby election contest of VRRP.
Active router receive after the message of active and standby election contest flow process as shown in Figure 2, comprising:
Step 210, active router receive the message of the active and standby election contest of VRRP;
Step 220 is pressed existing protocol and is adjusted the priority of oneself;
Step 230 participates in active and standby election contest.
By above-mentioned example, can be according to by in measurement period, not receiving the number of times M ' of VRRP notification packet, and when judging that M ' equals threshold value M, start VRRP election contest mechanism.When backup router M not announcement failure occurred N announcement phase the inside, then start the competition announcement.Can in announcing back 1 announcement cycle of failure for the last time, active router just start competition like this.Having avoided will experiencing in the RFC2338 of VRRP and two versions of RFC3678 3 announcement cycles just starts the disadvantage that the election contest announcement brings: excessive cycle, the service outage duration that brings is long.When active router normally sends the VRRP notification packet, and for some reason, when backup router is not received the VRRP notification packet, can be by adjusting the value of switching judging parameter M and N, adjust backup router and initiate the opportunity of main and standby competition, thereby avoid unnecessary active and standby election contest.And by the number of times of configuration measurement period and the threshold value of the active and standby election contest of startup, can be configured according to network environment.
A kind of router of realizing said method as shown in Figure 3, comprises receiving element, computing unit, statistics judging unit and election contest unit, wherein:
Receiving element is used to receive the switching judging parameter of VRRP notification packet and configuration, and described switching judging parameter comprises statistical parameter N and message threshold value M, and N and M are natural number, N 〉=M, M≤3;
Computing unit is used for according to statistical parameter according to following formula counting statistics period T: T=N* notification time cycle+slope time;
The statistics judging unit is used to add up the number of times M ' that does not receive the VRRP notification packet in each measurement period, when judging that M ' equals message threshold value M, sends signal to the election contest unit;
The statistics judging unit is proceeded statistics when judging that M ' is not equal to message threshold value M, after a measurement period arrives, add up again.
The election contest unit is used for initiating active and standby election contest behind the signal that receives the transmission of statistics judging unit.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.