sysctl.si › Parameters › net.ipv4.tcp_fin_timeout

net.ipv4.tcp_fin_timeout

Seconds a closing socket waits in FIN_WAIT_2.

Default
60
Typical value
15

When to change it

Lower it to free sockets from closing connections sooner. Very low values can cause problems on slow networks.

Check the current value

sysctl net.ipv4.tcp_fin_timeout

Change it until the next reboot

sudo sysctl -w net.ipv4.tcp_fin_timeout=15

Make it permanent

echo "net.ipv4.tcp_fin_timeout = 15" | sudo tee /etc/sysctl.d/99-custom.conf
sudo sysctl --system

Related parameters

net.core.somaxconn · net.ipv4.tcp_max_syn_backlog · net.core.netdev_max_backlog · net.core.rmem_max · net.core.wmem_max · net.ipv4.tcp_congestion_control · net.core.default_qdisc · net.ipv4.tcp_tw_reuse

Generate a full sysctl config for your server

Values are starting points. Test on a staging machine and measure before and after.