Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCP: Server sends [RST, ACK] immediately after receiving [SYN] from Client

Tags:

Host_A tries to send some data to Host_B over TCP. Host_B is listening on port 8181. Both Host_A & Host_B are Linux boxes (Red Hat Enterprise). The TCP layer is implemented using Java NIO API.

Whatever Host_A sends, Host_B is unable to receive. Sniffing the data on wire using WireShark resulted in the following log:

1) Host_A (33253) > Host_B (8181): [SYN] Seq=0 Win=5840 Len=0 MSS=1460 TSV=513413781 TSER=0 WS=7
2) Host_B (8181) > Host_A (33253): [RST, ACK] Seq=1 Ack=1 Win=0 Len=0

The logs show that Host_A sends a [SYN] flag to Host_B in order to establish connection. But instead of [SYN, ACK] Host_B responds with an [RST, ACK] which resets/closes the connection. This behavior is observed always.

I am wondering under what circumstance does a TCP listener sends [RST,ACK] in response to a [SYN]?

like image 894
Riyaz Avatar asked Mar 11 '11 10:03

Riyaz


People also ask

What causes TCP RST ACK?

This is very simply that the port you are trying to connect to is not being listened to on the remote host. Either your service is not running on the host, or possibly it has been firewalled.

What does TCP RST ACK mean?

TCP Connection reset (RST, RST Ack) This may be because of a system errors or protocol errors. For example, a TCP ends receives a packet for which there is no connection. Receiving side will send a TCP RST to the remote, to close the connection and again setup if requires. The other ends sends the TCP RST Ack.

Why does server send TCP RST?

In TCP, packets with the "Reset" (RST or R) flag are sent to abort a connection. Probably the most common reason you are seeing this is that an SYN packet is sent to a closed port. But RST packets may be sent in other cases to indicate that a connection should be closed.

What is the outcome if a TCP message is received with RST bit?

Normally, when it receives an RST or SYN message for an existing connection, TCP attempts to shut down the TCP connection. This action is expected under normal conditions, but someone maliciously generating otherwise valid RST or SYN messages can cause problems for network applications and the network as a whole.


1 Answers

RST, ACK means the port is closed. You sure Host_B is listening on the right IP/interface?

Also check your firewall for a -j REJECT --reject-with tcp-reset

like image 125
Erik Avatar answered Sep 21 '22 05:09

Erik