Forum Discussion
TCP 3-WAY Handshake vs TCP Half-Open
1. TCP 3-Way handshake –
TCP is a connection-oriented protocol, a connection needs to be established before two devices can communicate. TCP uses a process called three-way handshake to negotiate the sequence and acknowledgment fields and start the session. Here is a graphical representation of the process.
The three way handshake process consists of three steps:
a. Host A initiates the connection by sending the TCP SYN packet to the destination host. The packet contains the random sequence number (e.g. 5432) which marks the beginning of the sequence numbers for data that the Host A will transmit.
b. The Server receives the packet and responds with its own sequence number. The response also includes the acknowledgment number, which is Host A’s sequence number incremented by 1 (in our case, that would be 5433).
a. Host A acknowledges the response of the Server by sending the acknowledgment number, which is the Server’s sequence number incremented by 1.
Post TCP 3 way handshake, the data transfer starts. After the data transmission process is finished, the connection will get terminated by sending FIN (FINISHED) flag which does graceful termination of connection.
TCP Half Open connection –
TCP connections are called Half Open connections when the third step of the 3-Way handshake sending final ACK to the server fails (as shown in below figure) or if one of the hosts closes the connection without acknowledging the other.
Half Open connection process is given below –
1. Host initializes the request by sending SYN packet.
2. Server replies to the client with SYN_ACK, and at this point server reserves some resource for the client and waits for the final ACK to arrive (Acknowledgment message).
3. However, the client does not respond to the server with final Acknowledgment.
So an established connection is said to be "half-open" if one of the TCPs has closed or aborted the connection at its end without the knowledge of the other, or if the two ends of the connection have become desynchronized owing to a crash that resulted in loss of memory. Such connections will automatically become reset if an attempt is made to send data in either direction. However, half-open connections are expected to be unusual.
F5 TCP-Half Open monitor –
F5 also have TCP-Half Open monitor available under Local trafficàMonitors. Tcp_half_open monitor is most widely used for gateway monitoring when you just need to ensure the socket is responding to connection requests and desire the lowest overhead on the monitoring target.
The tcp_half_open monitor sends a SYN packet to the pool member, and if a SYN-ACK is received from the server in response, the pool member is marked UP.
There are few use cases to use TCP-half open monitor as given below –
For example, a webserver would be less impacted by a half open connection request that is immediately reset than a connection that completes the entire open and close handshake sequence.
Another common use for the tcp_half_open monitor is to prevent the application from spewing a bunch of log messages indicating connections were opened but not used.
It should be noted that some applications cannot gracefully handle the half open connection and subsequent reset, so some testing should be done in order before implementing this monitor.
There is option available to test same under ‘Test’ tab shown in above image. Under Test tab, you can put webserver IP alongwith its associated port.
And it will show Test results and it can be confirmed if application supports TCP-Half open or not.
Do test same in your environment and share your observations.
I hope, this article helps you. Your inputs, suggestions or questions are always welcome.
Mayur
Thank you for your time and response. My main purpose of sharing article here was to distinguish handshaking process between 3-way handshake and TCP halp open and ending it by explaining tcp half open monitor present in F5 and how/where it can be used. I agreed, the content and objective of old article (ed. https://devcentral.f5.com/s/articles/monitoring-tcp-applications-01) and new article seems to be quite same. I am fine if you keep this post under Q/A section.
Mayur
- VikashCCirrus
Informative. Thanks for sharing it.
Hi Mayur, wouldn't it be better if you published this article in the "Articles" section? This is more of a Q&A section :)
Yes I also wanted to add it under Articles section but i was not able to see any option to publish it there.
Mayur
Just drop a quick and short email to devcentralteam@f5.com and say you wanna be a DevCentral author and publish articles. The reason there's no button is because by default we don't allow everyone to create articles. We need to grant you the permission first. Cheers
thank you, and I agree, this is written in the style of an article, but at this point articles can only be authored by F5 employees. It does not hurt to have this content here, and perhaps we should compare/contrast your article with one Rodrigo found: https://devcentral.f5.com/s/articles/monitoring-tcp-applications-01
Is there value in drawing distinctions between this older one and your newer content?
Thank you for your time and response. My main purpose of sharing article here was to distinguish handshaking process between 3-way handshake and TCP halp open and ending it by explaining tcp half open monitor present in F5 and how/where it can be used. I agreed, the content and objective of old article (ed. https://devcentral.f5.com/s/articles/monitoring-tcp-applications-01) and new article seems to be quite same. I am fine if you keep this post under Q/A section.
Mayur
Got it. Thanks for sharing same.
Mayur
- JohndeCirrus
Good Article.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com