Disabling of TCP SYN retransmission

Akshay R

I am developing a client which connects to server through TCP. Servers are configured such that if one server is down, connection is set up with another server.

My requirement is that if TCP connection is not established with the 1st server within 2s, client needs to establish connection with the 2nd server.

Below is my observation based on testing- TCP SYN message is sent by client to the 1st server to establish connection. Since 1st server is down, after 1s, TCP SYN retransmission is sent to the 1st server. After 2s(owing to processing and network delays), TCP SYN message is sent to the 2nd server by the client. So its taking 3s (1s + 2s) for the SYN message to be sent to the 2nd server, which is not what I wanted. I want the TCP SYN message to be sent to 2nd server within 2s.

In order to send TCP SYN message to the 2nd server within 2s, I want to avoid TCP SYN retransmission.

I tried setting net.ipv4.tcp_syn_retries=0 in /etc/sysctl.conf. But I get 1 TCP SYN retransmission.

So is there any way to disable TCP SYN retransmission from userspace without changing the kernel source?

Steffen Ullrich

My requirement is that if TCP connection is not established with the 1st server within 2s, client needs to establish connection with the 2nd server.

In this case just do a connect with a timeout of 2 seconds at the client and if the connect does not succeed retry with the other server. Once you have closed the socket the kernel will stop trying to connect to the first server. This is much better and more independent from a specific platform than to fiddle with the built in reliability behavior and timing of TCP.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

TCP Retransmission vs. TCP Fast Retransmission

From Dev

Counting TCP retransmission in pyshark

From Dev

OnOffApplication with TCP retransmission

From Dev

tcp retransmission on lan, wifi is fine

From Dev

TCP starting without SYN?

From Dev

TCP starting without SYN?

From Dev

Are application level Retransmission and Acknowledgement needed over TCP?

From Dev

Send TCP SYN packet with payload

From Dev

TCP-Syn is not being answered

From Dev

Filter only TCP SYN segments in scapy

From Dev

Advantage of using "--syn" for matching new TCP connections

From Dev

Reject TCP SYN with ICMP error messages in python

From Dev

How does TCP packet numbering make it easier for retransmission?

From Dev

TCP spurious retransmission and duplicate ACKs for Virtualbox guests when bridged

From Dev

How does TCP packet numbering make it easier for retransmission?

From Dev

TCP Retransmission: how many packets will be re-sent?

From Dev

Scapy and sniff. how can I filter TCP SYN?

From Dev

Trying to understand anti TCP SYN flood attack IPTables rule

From Dev

Client not responding TCP SYN-ACK packet ethernet driver

From Dev

Simple TCP client with control over SYN, ACK, FIN

From Dev

Scapy and sniff. how can I filter TCP SYN?

From Dev

HTTP 1.1 GET requests are too quick for server to respond causing TCP Retransmission

From Dev

How can I extract TCP SYN flag from pcap file and detect SYN Flood attack using Python (Scapy)?

From Dev

How can I extract TCP SYN flag from pcap file and detect SYN Flood attack using Python (Scapy)?

From Dev

why my TCP server code send a SYN/ACK on only first packet or only on the first connection?

From Dev

Attempting to send TCP SYN packet with data and RST with data, but raw data field disappears in transit. Why?

From Dev

TCP: Possible SYN flooding on port 80. Dropping request even though net.ipv4.tcp_syncookies set to zero

From Dev

Sending a raw tcp packet with syn flag set just goes through the lo interface, not eth0 as I want

From Dev

Asterisk,SIP Retransmission timeout

Related Related

  1. 1

    TCP Retransmission vs. TCP Fast Retransmission

  2. 2

    Counting TCP retransmission in pyshark

  3. 3

    OnOffApplication with TCP retransmission

  4. 4

    tcp retransmission on lan, wifi is fine

  5. 5

    TCP starting without SYN?

  6. 6

    TCP starting without SYN?

  7. 7

    Are application level Retransmission and Acknowledgement needed over TCP?

  8. 8

    Send TCP SYN packet with payload

  9. 9

    TCP-Syn is not being answered

  10. 10

    Filter only TCP SYN segments in scapy

  11. 11

    Advantage of using "--syn" for matching new TCP connections

  12. 12

    Reject TCP SYN with ICMP error messages in python

  13. 13

    How does TCP packet numbering make it easier for retransmission?

  14. 14

    TCP spurious retransmission and duplicate ACKs for Virtualbox guests when bridged

  15. 15

    How does TCP packet numbering make it easier for retransmission?

  16. 16

    TCP Retransmission: how many packets will be re-sent?

  17. 17

    Scapy and sniff. how can I filter TCP SYN?

  18. 18

    Trying to understand anti TCP SYN flood attack IPTables rule

  19. 19

    Client not responding TCP SYN-ACK packet ethernet driver

  20. 20

    Simple TCP client with control over SYN, ACK, FIN

  21. 21

    Scapy and sniff. how can I filter TCP SYN?

  22. 22

    HTTP 1.1 GET requests are too quick for server to respond causing TCP Retransmission

  23. 23

    How can I extract TCP SYN flag from pcap file and detect SYN Flood attack using Python (Scapy)?

  24. 24

    How can I extract TCP SYN flag from pcap file and detect SYN Flood attack using Python (Scapy)?

  25. 25

    why my TCP server code send a SYN/ACK on only first packet or only on the first connection?

  26. 26

    Attempting to send TCP SYN packet with data and RST with data, but raw data field disappears in transit. Why?

  27. 27

    TCP: Possible SYN flooding on port 80. Dropping request even though net.ipv4.tcp_syncookies set to zero

  28. 28

    Sending a raw tcp packet with syn flag set just goes through the lo interface, not eth0 as I want

  29. 29

    Asterisk,SIP Retransmission timeout

HotTag

Archive