This script applies various TCP optimizations by updating the /etc/sysctl.conf file and then applying the changes. These optimizations are intended to improve network performance and reliability.
The purpose of this script is to easily configure TCP settings on a Linux system to optimize network performance. This includes adjustments to TCP windows, retries, timeouts, and enabling BBR congestion control.
- Backs up the current
/etc/sysctl.conffile. - Adds a set of TCP optimization parameters to
/etc/sysctl.conf. - Applies the changes using
sysctl -p.
- Clone the repository or download the script.
- Make the script executable:
chmod +x optimize_tcp.sh
- Run the script with
sudo:sudo ./optimize_tcp.sh
net.ipv4.tcp_slow_start_after_idle = 0net.ipv4.tcp_no_metrics_save = 0net.ipv4.tcp_abort_on_overflow = 0net.ipv4.tcp_window_scaling = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_rfc1337 = 1net.ipv4.tcp_sack = 1net.ipv4.tcp_fack = 1net.ipv4.tcp_workaround_signed_windows = 1net.ipv4.tcp_syncookies = 1net.ipv4.tcp_syn_retries = 4net.ipv4.tcp_synack_retries = 2net.ipv4.tcp_orphan_retries = 2net.ipv4.tcp_retries2 = 12net.ipv4.tcp_max_tw_buckets = 262144net.ipv4.tcp_max_syn_backlog = 8192net.ipv4.tcp_mtu_probing = 1net.ipv4.tcp_fin_timeout = 30net.ipv4.tcp_keepalive_time = 7200net.ipv4.tcp_keepalive_intvl = 75net.ipv4.tcp_keepalive_probes = 9net.ipv4.tcp_max_orphans = 262144net.ipv4.tcp_timestamps = 0net.ipv4.ip_no_pmtu_disc = 0net.ipv4.tcp_rmem = 8192 2097152 16777216net.ipv4.tcp_wmem = 4096 16384 33554432net.ipv4.tcp_adv_win_scale = -2net.ipv4.tcp_notsent_lowat = 4294967295net.core.default_qdisc = fqnet.ipv4.tcp_congestion_control = bbruser.max_inotify_watches = 2097152
- Ensure you have a backup of your current
/etc/sysctl.confbefore running the script. - These settings are designed for general network performance improvement and may not be suitable for all environments. Adjustments might be necessary based on specific needs.
This project is licensed under the MIT License.