tech:reseau_linux_pile_tcp_ip_rto_min_scripts
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:reseau_linux_pile_tcp_ip_rto_min_scripts [2025/11/11 22:46] – Jean-Baptiste | tech:reseau_linux_pile_tcp_ip_rto_min_scripts [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Réseau Linux pile TCP/IP rto_min scripts | ||
| + | |||
| + | Voir : | ||
| + | * [[Réseau Linux pile TCP/IP - TCP retransmission timeout RTO]] | ||
| + | * [[reseau_linux_pile_tcp_ip]] | ||
| + | |||
| + | |||
| + | Le hack ci-dessous ne semble plus utile pour RedHat 9. | ||
| + | |||
| + | “NetworkManager now supports advmss, rto_min, and quickack route attributes” | ||
| + | https:// | ||
| + | |||
| + | |||
| + | `network_tcp_tune_change_mto_min.sh` | ||
| + | ~~~bash | ||
| + | #! /bin/bash | ||
| + | |||
| + | set -euo pipefail | ||
| + | |||
| + | declare -i ALREADY_SET | ||
| + | |||
| + | # check if file exist | ||
| + | file_exist() { | ||
| + | [ -e " | ||
| + | } | ||
| + | |||
| + | LINE=" | ||
| + | |||
| + | if echo " | ||
| + | ALREADY_SET=1 | ||
| + | else | ||
| + | ALREADY_SET=0 | ||
| + | fi | ||
| + | |||
| + | usage() { | ||
| + | cat <<EOF | ||
| + | SysV init script. | ||
| + | Args are : status, stop, start, restart | ||
| + | |||
| + | EOF | ||
| + | } | ||
| + | |||
| + | status() { | ||
| + | if [ $ALREADY_SET -eq 1 ]; then | ||
| + | echo Started | ||
| + | else | ||
| + | echo Stopped | ||
| + | fi | ||
| + | ip route show default | grep -e ' | ||
| + | echo | ||
| + | echo "/ | ||
| + | file_exist / | ||
| + | echo | ||
| + | echo "/ | ||
| + | cat / | ||
| + | } | ||
| + | |||
| + | start() { | ||
| + | echo " | ||
| + | file_exist / | ||
| + | echo 1 > / | ||
| + | if [ $ALREADY_SET -eq 0 ]; then | ||
| + | NEW_LINE=" | ||
| + | echo "ip route change $NEW_LINE" | ||
| + | echo " | ||
| + | else | ||
| + | echo " | ||
| + | fi | ||
| + | } | ||
| + | |||
| + | stop() { | ||
| + | echo " | ||
| + | if [ $ALREADY_SET -eq 1 ]; then | ||
| + | NEW_LINE=" | ||
| + | echo "ip route change $NEW_LINE" | ||
| + | echo " | ||
| + | else | ||
| + | echo " | ||
| + | fi | ||
| + | } | ||
| + | |||
| + | case " | ||
| + | start) | ||
| + | start | ||
| + | ;; | ||
| + | restart) | ||
| + | start | ||
| + | ;; | ||
| + | stop) | ||
| + | stop | ||
| + | ;; | ||
| + | status) | ||
| + | status | ||
| + | ;; | ||
| + | -h | --help) | ||
| + | usage | ||
| + | ;; | ||
| + | *) | ||
| + | usage | ||
| + | exit 1 | ||
| + | ;; | ||
| + | esac | ||
| + | |||
| + | echo . | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | `network_tcp_tune_change_mto_min.service` | ||
| + | ~~~ini | ||
| + | [Unit] | ||
| + | Description=Network setting on default gateway. Change rto_min to 8ms. Don not alwaays wait 200ms to resend packet | ||
| + | Wants=network.target network-online.target | ||
| + | After=network.target network-online.target | ||
| + | |||
| + | [Service] | ||
| + | Type=oneshot | ||
| + | # ExecStartPre=/ | ||
| + | ExecStart=/ | ||
| + | ExecStop=/ | ||
| + | RemainAfterExit=yes | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Mesures | ||
| + | |||
| + | ### rsync | ||
| + | |||
| + | ~~~ | ||
| + | truncate -s 1G big_file.img | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | #### Avant | ||
| + | |||
| + | ~~~ | ||
| + | $ rsync --compress-level=0 --progress --human-readable -v --log-file=rsync.log big_file.img target: | ||
| + | 1.07G 100% | ||
| + | 1.07G 100% | ||
| + | 1.07G 100% | ||
| + | 1.07G 100% | ||
| + | 1.07G 100% | ||
| + | 1.07G 100% 129.67MB/ | ||
| + | 1.07G 100% | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | #### Après | ||
| + | |||
| + | ~~~ | ||
| + | $ rsync --compress-level=0 --progress --human-readable -v --log-file=rsync.log big_file.img target: | ||
| + | 1.07G 100% 110.12MB/ | ||
| + | 1.07G 100% 137.35MB/ | ||
| + | 1.07G 100% | ||
| + | 1.07G 100% 129.62MB/ | ||
| + | 1.07G 100% 110.69MB/ | ||
| + | 1.07G 100% 152.42MB/ | ||
| + | 1.07G 100% 110.20MB/ | ||
| + | 1.07G 100% 135.79MB/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Iperf | ||
| + | |||
| + | Serveur | ||
| + | ~~~bash | ||
| + | iperf3 -s -p 8080 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | #### Avant | ||
| + | |||
| + | |||
| + | |||
| + | ~~~ | ||
| + | $ iperf3 -i 1 -P 1 -t 600 -p 8080 -c 192.168.10.10 | ||
| + | Connecting to host 192.168.10.10, | ||
| + | [ 4] local 192.168.10.11 port 43100 connected to 192.168.10.10 port 8080 | ||
| + | [ ID] Interval | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] 10.00-11.00 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | #### Après | ||
| + | |||
| + | ~~~ | ||
| + | $ iperf3 -i 1 -P 1 -t 600 -p 8080 -c 192.168.10.10 | ||
| + | Connecting to host 192.168.10.10, | ||
| + | [ 4] local 192.168.10.11 port 43348 connected to 192.168.10.10 port 8080 | ||
| + | [ ID] Interval | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | [ 4] | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Netcat | ||
| + | |||
| + | Serveur | ||
| + | ~~~bash | ||
| + | nc -p 8080 -lk > /dev/null | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | #### Avant | ||
| + | |||
| + | ~~~ | ||
| + | $ while sleep 0.2 ; do echo -n -e " | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | #### Après | ||
| + | |||
| + | ~~~ | ||
| + | $ while sleep 0.2 ; do echo -n -e " | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | 2024-01-27 11: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autres | ||
| + | |||
| + | ### quickack | ||
| + | |||
| + | ~~~bash | ||
| + | ip route change default via 10.0.0.1 quickack 1 | ||
| + | ~~~ | ||
| + | |||
