tech:reseau_linux_pile_tcp_ip
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:reseau_linux_pile_tcp_ip [2026/04/07 17:59] – Jean-Baptiste | tech:reseau_linux_pile_tcp_ip [2026/06/30 21:54] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | |||
| + | # Réseau Linux pile TCP/IP | ||
| + | |||
| + | Voir aussi : | ||
| + | * MPTCP, SCTP, DCCP | ||
| + | |||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * hping2 | ||
| + | * https:// | ||
| + | |||
| + | ~~~bash | ||
| + | man 7 tcp | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Contrack | ||
| + | |||
| + | Voir : | ||
| + | * / | ||
| + | * / | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install conntrack | ||
| + | ~~~ | ||
| + | |||
| + | Flush | ||
| + | ~~~bash | ||
| + | conntrack -F | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ### / | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | $ sysctl net.ipv4.tcp_syn_retries | ||
| + | net.ipv4.tcp_syn_retries = 6 | ||
| + | ~~~ | ||
| + | |||
| + | Effectively, | ||
| + | |||
| + | |||
| + | ### / | ||
| + | |||
| + | |||
| + | |||
| + | ### / | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | Voir aussi : | ||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | |||
| + | #### Cluster | ||
| + | |||
| + | In a High Availability (HA) situation consider decreasing the setting to 3. | ||
| + | |||
| + | RFC 1122 recommends at least 100 seconds for the timeout, which corresponds to a value of at least 8. | ||
| + | Oracle suggest a value of 3 for a RAC configuration. | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | #### Nb de retransmissions vs temps | ||
| + | |||
| + | An experiment confirms that (on a recent Linux at least) the timeout is more like 13s with the suggested net.ipv4.tcp_retries2=5 | ||
| + | |||
| + | “Windows defaults to just 5 retransmissions which corresponds with a timeout of around 6 seconds.” | ||
| + | “Five retransmissions corresponds with a timeout of around six seconds.” | ||
| + | tcp_retries2=5 means timeout with first transmission plus 5 retransmissions: | ||
| + | tcp_retries2=15: | ||
| + | |||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | Voir aussi : https:// | ||
| + | |||
| + | |||
| + | ### F_RTO | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | |||
| + | ## TCP keepalive | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * Python Scripts https:// | ||
| + | |||
| + | tcp_keepalive_time | ||
| + | https:// | ||
| + | ### Configuring TCP/IP keepalive parameters for high availability clients (JDBC) | ||
| + | |||
| + | * | ||
| + | * | ||
| + | * | ||
| + | * | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | echo " | ||
| + | echo " | ||
| + | echo " | ||
| + | echo " | ||
| + | ~~~ | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | ss -o | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Process / diag tools | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | |||
| + | ## Outils | ||
| + | |||
| + | ### TCP retransmissions | ||
| + | |||
| + | Voir : | ||
| + | * http:// | ||
| + | * net.ipv4.tcp_early_retrans | ||
| + | |||
| + | Outils : | ||
| + | * tcpretrans.bt (bpftrace) | ||
| + | * tcpretrans [perf-tools](https:// | ||
| + | * tcpretrans.py [bpfcc-tools - iovisor/ | ||
| + | |||
| + | |||
| + | Connaitre le rto_min et le rto_max | ||
| + | ~~~ | ||
| + | # grep ^Tcp / | ||
| + | Tcp: RtoAlgorithm | ||
| + | Tcp: 1 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | yum install bpftrace | ||
| + | / | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | timeout 60 ./ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | sar -n ETCP | ||
| + | sar -n TCP | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | # netstat -s | egrep ' | ||
| + | 107428604792 segments send out | ||
| + | 47511527 segments retransmited | ||
| + | |||
| + | # echo "$(( 47511527 * 10000 / 107428604792 ))" | ||
| + | 4 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | https:// | ||
| + | |||
| + | `tcpretransmits.sh` | ||
| + | ~~~bash | ||
| + | #! / | ||
| + | |||
| + | test -x / | ||
| + | test -x / | ||
| + | # https:// | ||
| + | test -x ./ | ||
| + | |||
| + | OUT=/ | ||
| + | |||
| + | if [ -z " | ||
| + | echo "It looks like ' | ||
| + | else | ||
| + | date > $OUT | ||
| + | netstat -s | awk '/ | ||
| + | $TCPRETRANS | tee -a $OUT | ||
| + | netstat -s | awk '/ | ||
| + | fi | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Resolving The Problem \ | ||
| + | TCP retransmissions are almost exclusively caused by failing network hardware, not applications or middleware. | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ## Autres | ||
| + | |||
| + | ** horodatages TCP ** | ||
| + | https:// | ||
| + | |||
| + | tcp_low_latency (Boolean; default: disabled; since Linux 2.4.21/2.6; obsolete since Linux 4.14) | ||
| + | |||
| + | |||
| + | ~~~ini | ||
| + | net.ipv4.tcp_timestamps = 1 | ||
| + | net.ipv4.tcp_window_scaling = 1 | ||
| + | net.ipv4.tcp_sack = 1 | ||
| + | net.ipv4.tcp_moderate_rcvbuf = 1 | ||
| + | ~~~ | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | # ip route get 192.168.100.11 | ||
| + | 192.168.100.11 dev virbr1 src 192.168.100.1 uid 1000 | ||
| + | cache | ||
| + | | ||
| + | # ip route show dev virbr1 | ||
| + | 192.168.100.0/ | ||
| + | |||
| + | |||
| + | # ip route change dev virbr1 192.168.100.0/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
