1

How does the TCP Retransmission? Which formula is determined by how many packets will be re-sent? I understand it is set somewhere in the cubic tcp, but where?

Interested in how it works in Linux. I use Debian 8 and just looking dumps. I set up a connection using netcat to 27000 port. I usually do on the server that makes iptables drop all packets on port 27000 and send a packet(And look how many times the package has been re-sent.).

  • This is a *very* broad question (see my answer). **You might want to be more specific.** Your question may very well be flagged as "too broad" or off-topic (because not directly programming related), and put on hold. – jbm Apr 04 '16 at 15:04

1 Answers1

2

This is a very broad question.

No, this is not basically nor necessarily CUBIC.

Retransmission is firstly specified in TCP "basic" RFC 793 (1981), section 3.7 Data Communication, paragraph "Retransmission Timeout".

Since then, there's been many (really many[*]) enhancements. A very noticeable one is "slow-start", last specified by RFC 5681, but which roots go back to 1997 RFC 2001, "TCP Slow Start, Congestion Avoidance, Fast Retransmit, and Fast Recovery Algorithms".

There's no "one size fits all" in this domain, there's always trade-off. Plus "smart" algorithms will have more footprint (software + CPU use) so they may or may not be used or simply even available depending on the application (think embedded devices). And as these things are in the implementation (i.e. not seen in the exchanged data between host), you can never know for sure which host use which. You'll see the TCP window size and scale in the segments for instance, but you will not know by which algorithm it is managed.

As for Linux, it's supposed to default to PRR since 3.2. Prior to that was CUBIC, and prior BIC.

Though, default does not mean it's the only one available. On my debian stock 4.4.0 kernel, it's CUBIC:

jbmaillet@sumo:~$ cat /proc/sys/net/ipv4/tcp_congestion_control
cubic

Though Reno is available too:

jbmaillet@sumo:~$ cat /proc/sys/net/ipv4/tcp_allowed_congestion_control
cubic reno

...and there's a dozen available in the "TCP: advanced congestion control" section of the kernel configuration.

*: https://en.wikipedia.org/wiki/TCP_congestion-avoidance_algorithm

jbm
  • 3,063
  • 1
  • 16
  • 25
  • I also use Debian(Just I use netcat and look dumps). It's really a difficult question, I now understand what is considered the rto, but I have not found total rto(or total retransmission packets). I do not understand why the option /proc/sys/net/ipv4/tcp_retries2. I will continue to watch RFC. – Alex Panchenko Apr 05 '16 at 12:09
  • So of course you've read https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt, and maybe the (122 pages long) RFC 1122. This is a _huge_ topic in itself, Linux networking implementation is a _humongous_ pile of code. 2 pieces of advice: 1/ Keep in mind that in networking Linux is not "alone": I've worked on embedded Linux for 15 years, mostly on networking middleware, and more often than not find myself talking to _other_ TCP/IP implementations, from Windows CE to proprietary avionics stacks to what not. So what you learn from Linux alone does _not_ translate to "the real world". – jbm Apr 05 '16 at 12:31
  • (...and second piece of advice,) 2/ There may be some simpler TCP/IP congestion handling implementation to study, look at eCos, RTEMS, FreeRTOS etc. But if you want to focus on CUBIC, so be it and maybe OK with Linux implementation. As for myself, I do not even know (nor have a need to know yet) if `/proc/sys/net/ipv4/tcp_retries2` is related in any way to CUBIC. Example: just for the test, I switched to Reno, and it's still there with the same '15' value. – jbm Apr 05 '16 at 12:44
  • Many thanks! With the RENO works tcp_retries2(The truth all the same is misunderstanding. tcp_retries2 = 10, but the number of packets retransmission 11. tcp_retries2 = 7, number of retransmission 10 ). Very interesting theme (Thanks for the advice to see: eCos, RTEMS, FreeRTOS). Maybe someday I will learn how to calculate the last retransmission package in CUBIC. – Alex Panchenko Apr 06 '16 at 13:36