CN100502384C - A method for primary and standby machine to take turns on TCP connection - Google Patents

A method for primary and standby machine to take turns on TCP connection Download PDF

Info

Publication number
CN100502384C
CN100502384C CNB031343457A CN03134345A CN100502384C CN 100502384 C CN100502384 C CN 100502384C CN B031343457 A CNB031343457 A CN B031343457A CN 03134345 A CN03134345 A CN 03134345A CN 100502384 C CN100502384 C CN 100502384C
Authority
CN
China
Prior art keywords
tcp
remote termination
standby
guest machine
bag
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.)
Expired - Fee Related
Application number
CNB031343457A
Other languages
Chinese (zh)
Other versions
CN1567919A (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.)
Xian Datang Telecom Co Ltd
Original Assignee
Xian Datang Telecom 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 Xian Datang Telecom Co Ltd filed Critical Xian Datang Telecom Co Ltd
Priority to CNB031343457A priority Critical patent/CN100502384C/en
Publication of CN1567919A publication Critical patent/CN1567919A/en
Application granted granted Critical
Publication of CN100502384C publication Critical patent/CN100502384C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

The invention discloses a method of master and backup machines applies TCP to switch TCP connection as communicating with remote-end machine, thus effectively avoiding the interruption of the TCP connection with remote-end machine as the master and backup machines switch between them, not influencing the continuity of the communication with the remote-end machine and making the remote-end machine not sense the switching course. It makes a certain small-rage reformation on traditional TCP protocol stack to adapt to the requirement of realizing the invention. It can be widely applied to the master-backup machine network communication by TCP.

Description

A kind ofly active and standbyly carry out TCP with two-shipper and connect the method switch
Technical field
The present invention design belongs to communication technical field, relates to a kind ofly active and standbyly using transmission control protocol (TCP, Transmission Control Protocol) to carry out TCP when communicating by letter with remote termination with two-shipper to be connected the method for switching.
Background technology
In the communication of computer network, local computer and far-end computer often adopt Transmission Control Protocol to carry out the message transmission.Local computer waits other consideration for stability, often adopts active and standbyly to ensure with two-shipper.The benefit of active and standby working method with two-shipper is: main computer is because certain reason need quit work, and perhaps main computer is because under the situation that fault crashes, and guest machine can be taken over main computer and continue to communicate by letter with the far-end computer maintenance.
Transmission Control Protocol is a kind of reliable transport protocol that connection is arranged, when using the TCP message transfer between two computers, must set up a TCP earlier and connect, the connection procedure that establishment of connection need be shaken hands for 3 times, have only to connect and set up, could come message transfer by it.If connect and to have interrupted, then can not continue message transfer again, could continue to communicate by letter after must rebuliding connection.So in when falling the machine, in a single day main computer reduces to standby quitting work, for example computer is restarted, computer corruption, and these will certainly cause the interruption that is connected with original TCP of remote termination, thereby causes original communication interruption.Guest machine at first will be set up new TCP connection with remote termination after being upgraded to main using, and could follow remote termination to communicate.In this process of falling the machine, interruption has taken place in original communication, the communication continuity of influence; And remote termination can find interruption that original TCP connects and new connection is set up, and can think that to a certain extent the opposite end carried out active and standbyly switching with two-shipper.
Summary of the invention
To be that design is a kind of active and standbyly carry out TCP with two-shipper and connect the method switch main purpose of the present invention, thereby effectively realize active and standbyly not causing that the connection that is connected with remote termination TCP interrupts when switching with two-shipper, do not influence and the remote termination communication continuity, and do not allow remote termination discover the process of falling the machine.
The present invention comprises traditional tcp protocol stack has been carried out certain transformation among a small circle, to adapt to the needs of realizing the object of the invention.
The purpose of foregoing invention: a kind of TCP of use communicates active and standbyly carries out TCP with two-shipper and connects the method for switching, and is characterized in that TCP connects the transparency of switching the other end.
Technical solution comprises following content:
A. main computer A, guest machine B utilize TCP and remote termination C to communicate as two-shipper.When being used for communicating by letter with remote termination C, uses by primary, spare machine identical IP address d.d.d.d, identical physical address (physical address also can be different, network interface card should be set this moment be operated in promiscuous mode under and forbid guest machine transmission packet).Need all during startup to forbid that destination address is that the TCP bag of remote termination C flows out this machine, forbid that simultaneously source address is that remote termination C and destination address are the tcp protocol stacks that the TCP bag of d.d.d.d enters this machine.
B. in main computer A when work,, at first allowing destination address is that the TCP bag of remote termination flows out this machine, and allowing source address simultaneously is that remote termination and destination address are the tcp protocol stacks that the TCP bag of d.d.d.d enters this machine.Foundation is connected one with the TCP of remote termination C then, realizes and the proper communication of remote termination C that the TCP of main computer A connects one and is operated under the normal mode.
C. after guest machine B starts, when needs are set up standby TCP connection, set up standby TCP and connect two.Connect one with reference to main computer A with the TCP that remote termination C sets up, this standby TCP connect two with main computer A and remote termination C between TCP connection one have identical TCP local port and remote port.This standby connection two is operated under a kind of special pattern.
D. the standby TCP of guest machine B connect two sets up successfully after, the permission source address is that remote termination C and destination address are that the TCP of d.d.d.d wraps the tcp protocol stack that enters guest machine B.Guest machine B manages to receive the various TCP bags that remote termination C sends to main computer A.The tcp protocol stack of guest machine B utilizes TCP to connect an ACK who sends to main computer A with the remote termination C that receives and wraps and upgrade standby TCP and connect relevant parameters such as two send sequence number, Receive sequence number, is connected one parameter synchronization thereby the standby TCP that makes guest machine B set up connects two with the TCP of main computer foundation.Connect two through behind 5 effective parameter updates at standby TCP, it is operated under the accurate normal mode.
E. in when falling the machine,, main computer A forbids that destination address is that the TCP bag of remote termination C flows out this machine, and main computer A reduces to standby, and it is connected one with TCP between the remote termination and is operated under the special pattern.Guest machine B permission destination address is that the TCP bag of remote termination flows out this machine, and standby TCP connects two and changes actual connection into, and allows to utilize TCP connection two and remote termination C to continue to communicate by letter.Guest machine B is upgraded to main usefulness, and after utilizing standby TCP to connect two transmissions, 5 bag data, standby TCP connects two and is operated under the normal mode.Active and standby TCP successful connection with two-shipper and remote termination is switched.
F. fall machine if desired again, main computer, guest machine repeat above-mentioned D, E process.
G. front and back of falling the machine, the original TCP of remote termination C connects the sensation that not have interruption, remains connection, can communicate by letter all the time.Remote termination C is imperceptible active and standby with switching that two-shipper TCP connects.
If H. remote termination is initiatively abandoned original TCP connection, rebulid new TCP and connect to address d.d.d.d.Then main computer is still used as main.Connect two if guest machine has been set up standby TCP, then be operated under the special pattern.Main computer, guest machine repeat above-mentioned D, E process subsequently.Do not connect two if guest machine B sets up standby TCP, main computer, guest machine repeat above-mentioned C, D, E process.
Active and standby when starting for the first time with two-shipper, all do not have to set up and be connected with remote termination.Main computer is finished the TCP establishment of connection according to general normal mode and remote termination, communicates then, and main computer is subsequently all converted by guest machine.
Some other characteristics of the present invention are:
The described destination address of forbidding is that the realization that the TCP bag of remote termination C flows out this machine can mask the TCP bag that destination address is a remote termination by using firewall software; Can in tcp protocol stack, increase switching variable S1, close this switch by upper level applications.The interface function that makes the TCP layer send data to the IP layer of closing of this switch lost efficacy, and the TCP layer can not send data to the IP layer; As long as can realize this function, also can adopt other any means that are equal to.
The described source address of forbidding is that remote termination C and destination address are that the realization that the TCP bag of d.d.d.d enters the tcp protocol stack of this machine can be that remote termination C and destination address are the TCP bags of d.d.d.d by using firewall software mask source address; Also can in tcp protocol stack, increase switching variable S2, close this switch by upper level applications.Closing of this switch makes the TCP layer lose efficacy from the interface function that the IP layer receives data, and the TCP layer can not receive data from the IP layer; As long as can realize this function, also can adopt other any means that are equal to.
The TCP bag that described permission destination address is remote termination C flows out this machine and realizes being the shielding of the TCP bag of remote termination to destination address by using the firewall software cancellation; Also can open switching variable S1 in tcp protocol stack, it is effective to make that the TCP layer sends data to the interface function of IP layer, and the TCP layer can send data to the IP layer; As long as can realize this function, also can adopt other any means that are equal to.
Described permission source address is that remote termination C and destination address are that the realization that the TCP bag of d.d.d.d enters the tcp protocol stack of this machine can be that remote termination C and destination address are the shieldings of the TCP bag of d.d.d.d to source address by using the firewall software cancellation; Also can open switching variable S2 in tcp protocol stack, make the TCP layer effective from the interface function that the IP layer receives data, the TCP layer can receive data from the IP layer; As long as can realize this function, also can adopt other any means that are equal to.
Described guest machine B manages to receive realization that remote termination C sends to the various TCP bags of main computer A and the network interface card that main computer A, guest machine B be used for using when communicating by letter with remote termination C can be set possess identical physical address, and guest machine B just can receive that the various TCP that remote termination C sends to main computer A wrap like this.As long as can realize this function, also can adopt other any means that are equal to.
When guest machine B transfer to main with after, guarantee that the Ethernet that sends to remote termination C includes the identical local physical address with former main computer A, the network interface card that main computer A, guest machine B be used for using when communicating by letter with remote termination C can be set possess identical physical address.As long as can realize this function, also can adopt other any means that are equal to.
The handling process according to traditional Transmission Control Protocol defined that described normal mode refers to tcp protocol stack is handled the reception process of transmitting in a certain TCP connection, and safeguards.
Special pattern is to be connected one normal mode with the TCP of remote termination C comparatively speaking with main computer A.Standby TCP connects the working method that TCP that working method under two special patterns is different from main computer A connects one normal mode.The selection of special pattern is controlled by connecting related switching variable S3 with TCP, and upper level applications can be controlled this switch.When switch S 3 was opened, TCP connected according to special pattern work.Connect the process of setting up, tcp protocol stack relies on the program structure negotiated packet of upper level applications or other simulation remote termination C to finish to connect 3 times of setting up to shake hands.The TCP that tcp protocol stack is delivered to the TCP layer for the IP layer wraps, if wrap at the TCP of standby connection, it is to be operated under the special pattern that the guest machine tcp protocol stack is judged this connection, and then processing mode can be different from the TCP connection of normal mode.Guest machine B when two initialization, opens related with it S3 by upper level applications, makes it be operated in special pattern.
Accurate normal mode is very near normal mode, and the selection of pattern switching relies on the switch S 4 related with the TCP connection to control.Upper level applications and tcp protocol stack can be controlled this switch.When switch S 4 was opened, the TCP connection was operated in accurate normal mode.
These three kinds of mode of operations all are single existence.
The TCP that sets up with remote termination C with reference to main computer A among the described content C connects according to following processing:
If the client that main computer connects as TCP, the server end that remote termination connects as TCP, the then client that would also connect of guest machine as TCP.If the server end that main computer connects as TCP, the client that remote termination connects as TCP, the then server end that would also connect of guest machine as TCP.Parameters such as the local port of using when parameters such as the local port of using when guest machine is set up the TCP connection, remote port, far-end address are set up the TCP connection with main computer, remote port, far-end address are identical.
After guest machine B starts among the described content C, when needs are set up standby TCP and connected, set up standby TCP and connect two according to following processing:
If the client that guest machine B connects as TCP, as shown in Figure 1.The upper level applications of guest machine is sent the TCP connection request to tcp protocol stack, and tcp protocol stack will send synchronously (SYN, Synchronizesequence numbers) bag and give remote termination C.Tcp protocol stack is judged this connection according to the S3 of standby connection two associations and is operated under the special pattern, and this SYN bag reality does not flow out guest machine B.Tcp protocol stack is after the transmission of finishing the SYN bag is handled, affirmation (ACK of program structure of upper level applications or other simulation remote termination C for this bag, Acknowledgment field significant) wraps, and give TCP layer by the interface function of link layer or IP layer.At tcp protocol stack, the response packet of Here it is remote termination C.Transmission ACK wrapped to remote termination C after tcp protocol stack was handled this SYN/ACK.This ACK bag reality does not flow out guest machine B.Shake hands for 3 times that set up that TCP connects this moment and finish, guest machine B and remote termination C standby is connected foundation.
If guest machine B is as server end, as shown in Figure 2.The upper level applications of guest machine is informed the standby connection two that needs foundation to tcp protocol stack.After tcp protocol stack begins to monitor connection request, tcp protocol stack is judged this connection according to the S3 of standby connection two associations and is operated under the special pattern, SYN of program structure of upper level applications or other simulation remote termination wraps, and gives TCP layer by the interface function of link layer or IP layer.At the TCP layer, the TCP connection request bag of Here it is remote termination C.The TCP layer sends the SYN/ACK response packet to remote termination C after handling this SYN.This SYN/ACK bag reality does not flow out guest machine.And then, ACK of program structure of upper level applications or other simulation remote termination wraps, and gives TCP layer by the interface function of link layer or IP layer.At the TCP layer, the response packet of Here it is remote termination C.After the TCP layer is handled this ACK, shake hands for 3 times that set up that TCP connects this moment and to finish, guest machine and remote termination be standby to be connected foundation.
Structure SYN/ACK is according to following processing in the described content: SYN sign, ACK sign in the tcp data packet header all are changed to 1; Destination interface item in the TCP packet header is changed to the port that guest machine TCP monitors connection request; Source port entries is changed to the port that remote termination TCP initiates connection in the tcp data packet header; Sequence number item in the tcp data packet header is got any signless integer of 32bits; The sequence number value that affirmation sequence number item in the tcp data packet header is got in the TCP connection request SYN bag that the program of guest machine upper level applications or simulation remote termination sends adds 1; Window item in the tcp data packet header is got any signless integer; Add maximum data segment length's item (MSS, Maximum Segment Size) in the tcp data packet header, value gets 1460; Data-bias item in the tcp data packet header gets 6; Verification in the tcp data packet header and item get according to normal calculating TCP packet header verification and method this tcp data bag of calculating verification and; Other parameter puts 0.
Structure SYN wraps according to following processing in the described content: the SYN sign in the tcp data packet header is changed to 1; Destination interface item in the tcp data packet header is changed to the port that guest machine TCP initiates connection; Source port entries is changed to the port that remote termination TCP monitors connection request in the tcp data packet header; Sequence number item in the tcp data packet header is got any signless integer of 32bits; Affirmation sequence number item in the tcp data packet header puts 0; Window item in the tcp data packet header is got any signless integer; Add maximum data segment length's item (MSS, Maximum Segment Size) in the tcp data packet header, value gets 1460; Data-bias item in the tcp data packet header gets 6; Verification in the tcp data packet header and item get according to normal calculating TCP packet header verification and method this tcp data bag of calculating verification and; Other parameter puts 0.
Structure ACK in the described content wraps according to following processing: the ACK sign in the tcp data packet header is changed to 1; Destination interface item in the tcp data packet header is changed to the port that guest machine TCP monitors connection request; Source port entries is changed to the port that remote termination TCP initiates connection request in the tcp data packet header; Sequence number item in the tcp data packet header is got the value of the affirmation sequence number item in the SYN/ACK bag that the guest machine tcp protocol stack sends; The value that affirmation sequence number item in the tcp data packet header is got the sequence number item in the SYN/ACK bag that the guest machine tcp protocol stack sends adds 1; Window item in the tcp data packet header is got any signless integer; Data-bias item in the TCP packet header gets 5; Verification in the tcp data packet header and item get according to normal calculating TCP packet header verification and method this tcp data bag of calculating verification and; Other parameter puts 0.
Special pattern is according to following processing (as Fig. 3) in the described content:
Tcp protocol stack connects related switch S 3 according to TCP, judges the mode of operation of this connection.Connect the tcp protocol stack special processing for the TCP that is operated under the special pattern.And other TCP that is operated under the normal mode connects on the guest machine, and tcp protocol stack is according to normal process.
Tcp protocol stack knows that connecting two is operated under the special pattern, therefore to connecting two special processings by the related switch S 3 of connection two.
The TCP layer is received connects two relevant TCP bags with standby TCP and is actually remote termination C and sends to main computer A's by TCP connection one.
When the TCP layer is received first bag and is connected two relevant ACK bags, immediately with relevant parameters such as the sending sequence number of the useful information renewal connection two in the ACK bag, Receive sequence numbers.
For receive subsequently with connect two relevant ACK bags, if the sequence number in the ACK bag greater than the sequence number in the ACK bag of receiving previously, the sequence number during perhaps the sequence number in the ACK bag wraps less than the ACK that receives previously and difference greater than 1000000000.Then use useful information in the ACK bag to upgrade immediately to send sequence number, relevant parameter such as Receive sequence number.Otherwise, need not upgrade.
The ACK bag is not for further processing after the undated parameter, directly abandons.Other do not do any processing with connecting two relevant TCP, directly abandon.
Standby connection two is opened the switch S 4 of self after upgrading through 5 subparameters under the special pattern work, close the switch S 3 of self simultaneously.Tcp protocol stack learns that according to S4 connecting two is operated under the accurate special pattern.
The accurate normal mode of described content is according to following processing (as Fig. 4):
Tcp protocol stack connects related switch S 4 according to TCP, judges the mode of operation of this connection.Connect the tcp protocol stack special processing for the TCP that is operated under the accurate special pattern.And other TCP that is operated under the normal mode connects on the guest machine, and tcp protocol stack is according to normal process.
The TCP layer upgrades sending sequence number of connection two at first by force for wrapping with connecting two relevant ACK of receiving, and then further handles according to normal mode.Like this, if having actual data-message in the ACK bag, the standby TCP of guest machine B connects two just can be received and handle, thereby the upper level applications of guest machine B just can receive remote termination C by a message that sends to main computer A by standby connection two.
The connection two relevant TCP response packets that the tcp protocol stack of guest machine B produces are under an embargo and flow out guest machine B.
Main computer is reduced to standbyly among the described content E, and the TCP that upper layer application is no longer set up by original and remote termination is connected to remote termination transmission message.
Guest machine is upgraded to main usefulness among the described content E, and standby TCP connects two and transfers actual use connection to.Upper level applications receives remote termination C message by connecting two, and by connecting two to remote termination C transmission message.Thereby take over and reduce to standby former main computer and start working.
After utilizing connection two to send 5 bag data, connect two and be operated under the normal mode among the described content E.Tcp protocol stack send with connect two relevant 5 TCP that comprise data-message and wrap after, close the switch S 4 of connection two self.Since then, TCP connection two is operated under the normal mode.
The front and back of falling the machine among the described content G, active and standby connect to switch to upper level applications with TCP provide uninterrupted communication with communicating by letter of remote termination.Main computer, guest machine and the remote termination employed different TCP that communicates by letter connects one, two have identical parameter, guest machine be upgraded to main when sending message with the back TCP packet header with parameter be seamless take over that former main computer sends last wrap parameter in the ACK packet header, all are normal remote termination is seen.Remote termination has not recognized the TCP connection and has switched phenomenon.
Describedly active and standbyly being not limited only to two computers with two-shipper, also can be two systems of active and standby usefulness.And can expand to multimachine system.
Above-mentioned remote termination is a logical concept, and itself also may be a multimachine system that adopts this patent to constitute.
Method of the present invention can apply to adopt active and standby with in the two-shipper network communication applications that TCP communicates widely.
The key idea of technology of the present invention is to plan to build to stand at the guest machine patrix to be connected with the TCP of remote termination, and guarantees that the parameter and the synchronous of main computer that connect coincide.After guest machine was upgraded to main using, the TCP that the connection that original simulation is set up just can be taken over former main computer connected like this.
The conclusion that draws by practice is: method of the present invention can guarantee to adopt TCP to communicate the active and standby TCP that uses with communication in the two-shipper reversed process to connect and do not interrupt, guarantee the continuity of communication; Can guarantee active and standby disguise when switching, make remote termination not perceive and the process of falling the machine with two-shipper.
Description of drawings
Fig. 1 is that guest machine is set up the TCP layer flow chart (guest machine is the TCP client) that standby TCP connects.
Fig. 2 is that guest machine is set up the TCP layer flow chart (guest machine is the TCP server end) that standby TCP connects.
Fig. 3 is the standby TCP layer process chart under the special pattern that be connected.
Fig. 4 is the standby TCP layer process chart under the accurate normal mode that be connected.
Fig. 5 is the network diagram of a kind of application example of the present invention.
Embodiment
The present invention is described in further detail below in conjunction with embodiment.
Referring to Fig. 5, shown in the figure is the network diagram of a kind of application example of the present invention.This is a kind of simple network construction: server is the TCP server end, has a network interface card (being labeled as Eth0), configuration of IP address 202.100.100.10.
Client computer A, client computer B are the active and standby two-shipper of using of TCP client, have two network interface cards respectively.Dispose identical IP address 202.100.100.3, with the IP address of server at a network segment; Client computer A, the client computer B identical physical address of Eth0 configuration separately.
Client computer A, the Eth0 of client computer B be connected with the Eth0 of server by Ethernet switch more earlier by hub, the utilization of hub is in order to make client computer A, the TCP that the Eth0 of client computer B can the share service device sends over wraps.
Client computer A has other communication mode contact between the client computer B.
Active and standby as follows with two-shipper when falling machine TCP connection reversed process:
(1) main computer starts
Client computer A, the startup of client computer B always has successively, and we of starting earlier think main using.We suppose that client computer A is earlier main using.Client computer A permission source address is that the TCP bag of server enters, and allowing destination address is the TCP bag outflow of server.
(2) main computer connects
Client computer A carries out a normal TCP with server and is connected one.
(3) main computer communication
Client computer A carries out normal data passes with server by being connected.
(4) guest machine starts
Client computer B starts, and state is standby, forbids that by fire compartment wall is set source address is that the TCP bag of server enters, and forbids that destination address is that the TCP bag of server flows out.
(5) guest machine connects
When needing, the standby TCP of client computer B initialization connects two, and opens related with it switch S 3, makes standby connection be operated under the special pattern.Initiate then and being connected of server, set up good connection.
(6) guest machine parameter adjustment
Client computer B allows the TCP bag of server to enter by fire compartment wall is set, and off switch S3 after standby TCP connection parameter adjustment is finished opens switch S 4, and standby TCP connects two and begins operating under the accurate normal mode.
(7) normally fall machine
If client computer B has been in the state of the machine that can fall, promptly the standby TCP on the client computer B connects two and has been operated under the accurate normal mode, can fall machine.Client computer A upper level applications no longer continues to communicate by letter by TCP connection one and server.Client computer A is provided with fire compartment wall, forbids that source address is that the TCP bag of server enters, and forbids that destination address is that the TCP bag of server flows out.Notify client computer B to require it to be upgraded to main using then.Client computer B is provided with fire compartment wall, and allowing destination address is the TCP outflow of server.Client computer B upper level applications is used and is connected two continuation with server communication, and TCP connects constantly.At this moment, client computer A has reduced to standby, opens to connect one related switch S 3, and it is operated under the special pattern.Client computer B has been upgraded to main using.Fall machine once more as need, completing steps (6), (7).
(8) the back machine of deadlock
Client computer A hinders deadlock for some reason.After client computer B detects, if self be in the state of the machine that can fall, fire compartment wall is set then, allowing destination address is the TCP outflow of server, continues with server communication thereby take over client computer A, and TCP connects constantly.At this moment, client computer A has reduced to standby, and client computer B has been upgraded to main using.Fall machine once more as need, client computer A restarts back completing steps (4), (5), (6), (7).

Claims (10)

1. use that TCP communicates active and standby carries out TCP with two-shipper and connects the method for switching, and it is characterized in that this method specifically comprises following content:
A. main computer A, guest machine B utilize TCP and remote termination C to communicate as two-shipper;
When being used for communicating by letter with remote termination C, uses by primary, spare machine identical IP address d.d.d.d, identical physical address, and perhaps the physical address of primary, spare machine is inequality, network interface card should be set this moment be operated in promiscuous mode under and forbid guest machine transmission packet;
Need all during startup to forbid that destination address is that the TCP bag of remote termination C flows out this machine, forbid that simultaneously source address is that remote termination C and destination address are the tcp protocol stacks that the TCP bag of d.d.d.d enters this machine;
B. in main computer A when work,, at first allowing destination address is that the TCP bag of remote termination flows out this machine, and allowing source address simultaneously is that remote termination and destination address are the tcp protocol stacks that the TCP bag of d.d.d.d enters this machine; Foundation is connected one with the TCP of remote termination C then, realizes and the proper communication of remote termination C that the TCP of main computer A connects one and is operated under the normal mode;
C. after guest machine B starts, when needs are set up standby TCP connection, set up standby TCP and connect two; Connect one with reference to main computer A with the TCP that remote termination C sets up, this standby TCP connect two with main computer A and remote termination C between TCP connect one and have identical TCP local port and remote port, this standby TCP connection two is operated under a kind of special pattern;
D. the standby TCP of guest machine B connect two sets up successfully after, remote termination C and destination address are that the TCP of d.d.d.d wraps the tcp protocol stack that enters guest machine B during the permission source address; Guest machine B manages to receive the various TCP bags that remote termination C sends to main computer A; The tcp protocol stack of guest machine B utilizes TCP to connect an ACK who sends to main computer A with the remote termination C that receives and wraps and upgrade standby TCP and connect two send sequence number and the Receive sequence number relevant parameter, is connected one parameter synchronization thereby the standby TCP that makes guest machine B set up connects two with the TCP of main computer foundation; Connect two through behind 5 effective parameter updates at standby TCP, it is operated under the accurate normal mode;
E. in when falling the machine,, main computer A forbids that destination address is that the TCP bag of remote termination C flows out this machine, and main computer A reduces to standby, and it is connected one with TCP between the remote termination and is operated under the special pattern; Guest machine B permission destination address is that the TCP bag of remote termination flows out this machine, and standby TCP connects two and changes actual connection into, and allows to utilize TCP connection two and remote termination C to continue to communicate by letter; Guest machine B is upgraded to main usefulness, and after utilizing standby TCP to connect two transmissions, 5 bag data, standby TCP connects two and is operated under the normal mode; Active and standby TCP successful connection with two-shipper and remote termination is switched;
F. fall machine if desired again, main computer A, guest machine B repeat D, the E step of front;
G. front and back of falling the machine, the original TCP of remote termination C connects the sensation that not have interruption, remains connection, remains communication; Remote termination C is imperceptible active and standby with switching that two-shipper TCP connects;
If H. remote termination is initiatively abandoned original TCP connection, rebulid new TCP and connect to address d.d.d.d, then main computer is still used as main; Connect two if guest machine has been set up standby TCP, then be operated under the special pattern; Main computer, guest machine repeat D, the E process of front subsequently; Do not connect two if guest machine is set up standby TCP, main computer A, guest machine B repeat C, D, the E process of front;
For active and standby when starting for the first time with two-shipper, all do not have to set up and be connected with remote termination, main computer is finished the TCP establishment of connection according to general normal mode and remote termination, communicates then, and main computer is subsequently all converted by guest machine.
2. as claimed in claim 1ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that the described destination address of forbidding is that the realization that the TCP bag of remote termination C flows out this machine is by using firewall software to mask the TCP bag that destination address is a remote termination; Perhaps in tcp protocol stack, increase switching variable S1, close this switch by upper level applications; The interface function that makes the TCP layer send data to the IP layer of closing of this switch lost efficacy, and the TCP layer can not send data to the IP layer;
The described source address of forbidding is that remote termination C and destination address are that realization that the TCP bag of d.d.d.d enters the tcp protocol stack of this machine is to be that remote termination C and destination address are the TCP bags of d.d.d.d by using firewall software to mask source address; Perhaps in tcp protocol stack, increase switching variable S2, close this switch by upper level applications; Closing of this switch makes the TCP layer lose efficacy from the interface function that the IP layer receives data, and the TCP layer can not receive data from the IP layer.
3. as claimed in claim 1ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that, TCP that described permission destination address is remote termination C bag flows out the realization of this machine, is to be the shielding of the TCP bag of remote termination to destination address by using the firewall software cancellation; Perhaps open switching variable S1 in tcp protocol stack, it is effective to make that the TCP layer sends data to the interface function of IP layer, and TCP course IP layer sends data;
Described permission source address is that remote termination C and destination address are the realizations that the TCP bag of d.d.d.d enters the tcp protocol stack of this machine, is to be that remote termination C and destination address are the shieldings of the TCP bag of d.d.d.d by using the firewall software cancellation to source address; Perhaps open switching variable S2 in tcp protocol stack, make the TCP layer effective from the interface function that the IP layer receives data, the TCP layer receives data from the IP layer.
4. as claimed in claim 1ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that, it is the network interface card that main computer A, guest machine B be used for using when communicating by letter with remote termination C to be set possess identical physical address that described guest machine B manages to receive realization that remote termination C sends to the various TCP bags of main computer A, and guest machine B just receives that the various TCP that remote termination C sends to main computer A wrap like this;
When guest machine B transfer to main with after, guarantee that the Ethernet that sends to remote termination C includes the identical local physical address with former main computer A, the network interface card that main computer A, guest machine B be used for using when communicating by letter with remote termination C is set possesses identical physical address.
5. as claimed in claim 1ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that, the handling process according to traditional Transmission Control Protocol defined that described normal mode refers to tcp protocol stack is handled the reception process of transmitting in a certain TCP connection, and safeguards;
Described special pattern is to be connected one normal mode with the TCP of remote termination C comparatively speaking with main computer A; Standby TCP connects the working method that TCP that working method under two special patterns is different from main computer A connects one normal mode; The selection of special pattern is controlled by connecting related switching variable S3 with TCP, and upper level applications is controlled this switch; When switch S 3 was opened, TCP connected according to special pattern work; Connect the process of setting up, tcp protocol stack relies on the program structure negotiated packet of upper level applications or other simulation remote termination C to finish to connect 3 times of setting up to shake hands; The TCP that tcp protocol stack is delivered to the TCP layer for the IP layer wraps, if wrap at the TCP of standby connection, it is to be operated under the special pattern that the guest machine tcp protocol stack is judged this connection, and then processing mode can be different from the TCP connection of normal mode; Guest machine B when TCP connects two initialization, opens related with it S3 by upper level applications, makes it be operated in special pattern;
Accurate normal mode is very near normal mode, and the selection of pattern switching relies on the switch S 4 related with the TCP connection to control; Upper level applications and tcp protocol stack are all controlled this switch, and when switch S 4 was opened, the TCP connection was operated in accurate normal mode;
These three kinds of mode of operations all are single existence.
6. as claimed in claim 1ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that the TCP that sets up with remote termination C with reference to main computer A among the described content C connects according to following processing:
If the client-side that main computer connects as TCP, the server end that remote termination connects as TCP, the then client-side that would also connect of guest machine as TCP; If the server end that main computer connects as TCP, the client-side that remote termination connects as TCP, the then server end that would also connect of guest machine as TCP; It is identical with the far-end address parameter that local port, remote port and far-end address parameter and the main computer of using when guest machine is set up the TCP connection set up local port, the remote port used when TCP is connected;
In guest machine B when work among the described content C, when needs are set up standby TCP and connected, set up standby TCP and connect two according to following processing:
If the client-side that guest machine B connects as TCP, the upper level applications of guest machine is sent the TCP connection request to tcp protocol stack, and tcp protocol stack sends SYN and wraps to remote termination C; Tcp protocol stack is judged this connection according to the S3 of standby connection two associations and is operated under the special pattern, and this SYN bag reality does not flow out guest machine B; Tcp protocol stack after the transmission of finishing SYN bag is handled, SYN/ACK bag of program structure of upper level applications or other simulation remote termination C, and by link layer or IP layer interface function give TCP layer; At tcp protocol stack, the response packet of Here it is remote termination C; Transmission ACK wrapped to remote termination C after tcp protocol stack was handled this SYN/ACK; This ACK bag reality does not flow out guest machine B, shakes hands for 3 times that set up that TCP connects this moment to finish, and guest machine B and remote termination C standby is connected foundation;
If guest machine B is as server end, the upper level applications of guest machine is informed the standby connection two that needs foundation to tcp protocol stack; After tcp protocol stack is finished the monitoring connection request, tcp protocol stack is judged this connection according to the S3 of standby connection two associations and is operated under the special pattern, SYN bag of the program structure of upper level applications or other simulation remote termination, and by link layer or IP layer interface function give TCP layer, at the TCP layer, the TCP connection request bag of Here it is remote termination C; The TCP layer sends the SYN/ACK response packet to remote termination C after handling this SYN, and this SYN/ACK bag reality does not flow out guest machine; And then, ACK bag of the program structure of upper level applications or other simulation remote termination, and by link layer or IP layer interface function give TCP layer, at the TCP layer, the response packet of Here it is remote termination C; After the TCP layer is handled this ACK, shake hands for 3 times that set up that TCP connects this moment and to finish, guest machine and remote termination be standby to be connected foundation.
7. as claimed in claim 6ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that: structure SYN/ACK is according to following processing in the described content:
SYN sign, ACK sign in the tcp data packet header all are changed to 1; Destination interface item in the TCP packet header is changed to the port that guest machine TCP monitors connection request; Source port entries is changed to the port that remote termination TCP initiates connection in the tcp data packet header; Sequence number item in the tcp data packet header is got any signless integer of 32bits; The sequence number value that affirmation sequence number item in the tcp data packet header is got in the TCP connection request SYN bag that the program of guest machine upper level applications or simulation remote termination sends adds 1; Window item in the tcp data packet header is got any signless integer; Add maximum data segment length item in the tcp data packet header, value gets 1460; Data-bias item in the tcp data packet header gets 6; Verification in the tcp data packet header and item get according to normal calculating TCP packet header verification and method this tcp data bag of calculating verification and; Other parameter puts 0;
Structure SYN wraps according to following processing in the described content:
SYN sign in the tcp data packet header is changed to 1; Destination interface item in the tcp data packet header is changed to the port that guest machine TCP initiates connection; Source port entries is changed to the port that remote termination TCP monitors connection request in the tcp data packet header; Sequence number item in the tcp data packet header is got any signless integer of 32bits; Affirmation sequence number item in the tcp data packet header puts 0; Window item in the tcp data packet header is got any signless integer; Add maximum data segment length item in the tcp data packet header, value gets 1460; Data-bias item in the tcp data packet header gets 6; Verification in the tcp data packet header and item get according to normal calculating TCP packet header verification and method this tcp data bag of calculating verification and; Other parameter puts 0;
Structure ACK in the described content wraps according to following processing:
ACK sign in the tcp data packet header is changed to 1; Destination interface item in the tcp data packet header is changed to the port that guest machine TCP monitors connection request; Source port entries is changed to the port that remote termination TCP initiates connection request in the tcp data packet header; Sequence number item in the tcp data packet header is got the value of the affirmation sequence number item in the SYN/ACK bag that the guest machine tcp protocol stack sends; The value that affirmation sequence number item in the tcp data packet header is got the sequence number item in the SYN/ACK bag that the guest machine tcp protocol stack sends adds 1; Window item in the tcp data packet header is got any signless integer; Data-bias item in the TCP packet header gets 5; Verification in the tcp data packet header and item get according to normal calculating TCP packet header verification and method this tcp data bag of calculating verification and; Other parameter puts 0.
8. as claimed in claim 1ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that special pattern is handled in such a way in the described content:
Tcp protocol stack connects related switch S 3 according to TCP, judges the mode of operation of this connection; Connect the tcp protocol stack special processing for the TCP that is operated under the special pattern; And other TCP that is operated under the normal mode connects on the guest machine, and tcp protocol stack is according to normal process;
Tcp protocol stack knows that connecting two is operated under the special pattern, therefore to connecting two special processings by the related switch S 3 of connection two;
The TCP layer is received connects two relevant TCP bags with standby TCP and is actually remote termination C and sends to main computer A's by TCP connection one;
When the TCP layer is received first bag and connected two relevant ACK bags, upgrade sending sequence number of connection two and Receive sequence number relevant parameter with the useful information in the ACK bag immediately;
For receive subsequently with connect two relevant ACK and wrap, if the sequence number in the ACK bag is greater than the sequence number in the ACK bag of receiving previously, perhaps the sequence number in the ACK bag less than the sequence in the ACK bag of receiving previously good and difference greater than 1000000000, then use the useful information in the ACK bag to upgrade sending sequence number and the Receive sequence number relevant parameter of connecting immediately; Otherwise, need not upgrade;
The ACK bag is not for further processing after the undated parameter, directly abandons; Other do not do any processing with connecting two relevant TCP, directly abandon;
Standby connection two is opened the switch S 4 of self after upgrading through 5 subparameters under the special pattern work, close the switch S 3 of self simultaneously, and tcp protocol stack learns that according to S4 connecting two is operated under the accurate special pattern.
9. as claimed in claim 1ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that, the accurate normal mode of described content is according to following processing:
Tcp protocol stack connects related switch S 4 according to TCP, judges the mode of operation of this connection; Connect the tcp protocol stack special processing for the TCP that is operated under the accurate special pattern; And other TCP that is operated under the normal mode connects on the guest machine, and tcp protocol stack is according to normal process;
The TCP layer upgrades sending sequence number of connection two at first by force for wrapping with connecting two relevant ACK of receiving, and then further handles according to normal mode; Like this, if have actual data-message in the ACK bag, the standby TCP of guest machine B connects two just can be received and handle, thereby the upper level applications of guest machine B just can receive remote termination C by connecting a message that sends to main computer A by standby connection two;
The connection two relevant TCP response packets that the tcp protocol stack of guest machine B produces are under an embargo and flow out guest machine B.
10. as claimed in claim 1ly active and standbyly carry out TCP with two-shipper and connect the method switch, it is characterized in that, main computer is reduced to standbyly among the described content E, and upper layer application no longer is connected to remote termination transmission message by original TCP with remote termination foundation;
Guest machine is upgraded to main usefulness among the described content E, and standby TCP connects two and transfers actual use connection to; Upper level applications receives remote termination C message by connecting two, and by connecting two to remote termination C transmission message; Thereby taking over oneself reduces to standby former main computer and starts working;
After utilizing connection two to send 5 bag data, connect two and be operated under the normal mode among the described content E; Tcp protocol stack send with connect two relevant 5 comprise the TCP bag of data-message after, close the switch S 4 of connection two self, since then, TCP connection two is operated under the normal mode;
The front and back of falling the machine among the described content G, active and standby connect to switch to upper level applications with TCP provide uninterrupted communication with communicating by letter of remote termination; Main computer, guest machine and the remote termination employed different TCP that communicates by letter connects one, connect two and have identical parameter, guest machine be upgraded to main when sending message with the back TCP packet header with parameter be seamless take over that former main computer sends last wrap parameter in the ACK packet header, all all are normal remote termination is seen, and remote termination has not recognized the TCP connection and switched phenomenon;
Described active and standby be two computers with two-shipper, or two systems of active and standby usefulness; And expand to multimachine system.
CNB031343457A 2003-07-02 2003-07-02 A method for primary and standby machine to take turns on TCP connection Expired - Fee Related CN100502384C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB031343457A CN100502384C (en) 2003-07-02 2003-07-02 A method for primary and standby machine to take turns on TCP connection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB031343457A CN100502384C (en) 2003-07-02 2003-07-02 A method for primary and standby machine to take turns on TCP connection

Publications (2)

Publication Number Publication Date
CN1567919A CN1567919A (en) 2005-01-19
CN100502384C true CN100502384C (en) 2009-06-17

Family

ID=34470168

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB031343457A Expired - Fee Related CN100502384C (en) 2003-07-02 2003-07-02 A method for primary and standby machine to take turns on TCP connection

Country Status (1)

Country Link
CN (1) CN100502384C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011157151A3 (en) * 2011-05-31 2012-04-19 华为技术有限公司 Method, device and system for realizing disaster-tolerant backup

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022451B (en) * 2006-02-14 2014-07-23 杭州华三通信技术有限公司 Connection state synchronizing method in data communication and applied communication node thereof
US8051326B2 (en) 2006-12-29 2011-11-01 Futurewei Technologies, Inc. System and method for completeness of TCP data in TCP HA
US9648147B2 (en) 2006-12-29 2017-05-09 Futurewei Technologies, Inc. System and method for TCP high availability
CN101577731B (en) * 2009-06-15 2011-12-21 杭州华三通信技术有限公司 Method and device for TCP connection active-standby changeover and H323 connection active-standby changeover
CN101770411B (en) * 2009-12-31 2012-07-04 北京和利时系统工程有限公司 Method for automatically selecting redundant data, analyzer and method for realizing non-interference switch
CN102142999B (en) * 2011-03-28 2013-08-07 华为技术有限公司 Method, equipment and system for recovering links
CN104348637B (en) * 2013-07-26 2018-07-03 中国科学院声学研究所 A kind of method that TCP connection is kept in failover
CN103944697B (en) * 2014-03-27 2017-06-06 广东佳和通信技术有限公司 A kind of voice dispatch system and redundancy backup method of dual link two server
CN104580215A (en) * 2015-01-09 2015-04-29 烽火通信科技股份有限公司 TCP connection warm backup achieving method
CN106230747B (en) * 2016-08-30 2020-01-31 迈普通信技术股份有限公司 Method, device and system for recovering TCP connection sequence number
CN108111350B (en) * 2017-12-25 2021-07-13 北京格林伟迪科技股份有限公司 Method for implementing hot backup of TCP main/standby switching
CN111835721A (en) * 2020-06-10 2020-10-27 成都国泰网信科技有限公司 Communication method and communication equipment based on link active state addressing

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
高可用性系统服务器双机热备份技术的研究. 蔚保国.无线电通信技术,第25卷第5期. 1999
高可用性系统服务器双机热备份技术的研究. 蔚保国.无线电通信技术,第25卷第5期. 1999 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011157151A3 (en) * 2011-05-31 2012-04-19 华为技术有限公司 Method, device and system for realizing disaster-tolerant backup
US9258183B2 (en) 2011-05-31 2016-02-09 Huawei Technologies Co., Ltd. Method, device, and system for realizing disaster tolerance backup

Also Published As

Publication number Publication date
CN1567919A (en) 2005-01-19

Similar Documents

Publication Publication Date Title
CN100502384C (en) A method for primary and standby machine to take turns on TCP connection
JP4542688B2 (en) How to switch between network access technologies
JP3930743B2 (en) Method for providing network connectivity in a fault tolerant platform
CN101136900B (en) Fast transparent fault shift device and implementing method facing to service
US7107481B2 (en) Server takeover system and method
US7111035B2 (en) Fault tolerance associations for IP transport protocols
CN101262350B (en) A realization method, system and device for Portal dual host hot swap
EP1829267B1 (en) Redundant l2tp end points
EP1689147B1 (en) Network, network terminal and program for IP address management
WO2017219779A1 (en) Device active/standby switchover method and apparatus based on link protocol, and storage medium
CN101764738B (en) Backup method supporting TCP protocol connection and device thereof
CN1980224A (en) Method and system for recovering business after apparatus state switching-over based on main and spare netgate
CN101557317A (en) Active dialogue backup system, equipment and method in dual-server hot-backup network
JP2000307650A (en) Data communication system and recording medium
CN100388721C (en) Method for protecting coupling based on flow control transfer protocol
JP2010283427A (en) Lac device and failover method
JP2011040931A (en) Mobile communication gateway device, and method of controlling mobile communication gateway
CN111934912B (en) Hot standby redundancy system of double-host isolation gateway and control method
CN106411570A (en) Method for realizing SCTP (streaming control transmission protocol) protocol hot backup, system and server host
JPH09326810A (en) Connection changeover method on occurrence of fault
JP3301590B2 (en) Protocol state synchronization system
JP2002354049A (en) Circuit controlling system
JPH0991233A (en) Network connection device
CN107332885A (en) The method and apparatus that a kind of IPSec VPN realize two-node cluster hot backup
WO2011143891A1 (en) Method and apparatus for backup of subscriber service information

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090617

Termination date: 20150702

EXPY Termination of patent right or utility model