Last active
August 29, 2015 13:59
-
-
Save m13253/10980968 to your computer and use it in GitHub Desktop.
TCP tuning for high latency network in sysctl.conf -- http://hong.im/2013/04/20/linux-tcp-tuning/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://hong.im/2013/04/20/linux-tcp-tuning/ | |
net.ipv4.tcp_syncookies = 1 | |
# 表示开启 SYN Cookies。当出现 SYN 等待队列溢出时,启用 cookies 来处理,可防范少量 SYN 攻击,默认为 0,表示关闭; | |
net.ipv4.tcp_tw_reuse = 1 | |
# 表示开启重用。允许将 TIME-WAIT sockets 重新用于新的 TCP 连接,默认为 0,表示关闭; | |
net.ipv4.tcp_tw_recycle = 1 | |
# 表示开启 TCP 连接中 TIME-WAIT sockets 的快速回收,默认为 0,表示关闭; | |
net.ipv4.tcp_fin_timeout = 15 | |
# 修改系統默认的 TIMEOUT 时间。 | |
net.ipv4.tcp_keepalive_time = 1200 | |
# 表示当 keepalive 启用的时候,TCP 发送 keepalive 消息的频度。缺省是 2 小时,改为 20 分钟。 | |
net.ipv4.ip_local_port_range = 10000 65000 | |
# 表示用于向外连接的端口范围。缺省情况下很小:32768 到 61000,改为 10000 到 65000。(注意:这里不要将最低值设的太低,否则可能会占用掉正常的端口!) | |
net.ipv4.tcp_max_syn_backlog = 8192 | |
# 表示 SYN 队列的长度,默认为 1024,加大队列长度为 8192,可以容纳更多等待连接的网络连接数。 | |
net.ipv4.tcp_max_tw_buckets = 5000 | |
# 表示系统同时保持 TIME_WAIT 的最大数量,如果超过这个数字,TIME_WAIT 将立刻被清除并打印警告信息。 | |
# increase TCP max buffer size settable using setsockopt() | |
net.core.rmem_max = 67108864 | |
net.core.wmem_max = 67108864 | |
# increase Linux autotuning TCP buffer limit | |
net.ipv4.tcp_rmem = 4096 87380 67108864 | |
net.ipv4.tcp_wmem = 4096 65536 67108864 | |
# increase the length of the processor input queue | |
net.core.netdev_max_backlog = 250000 | |
# recommended for hosts with jumbo frames enabled | |
net.ipv4.tcp_mtu_probing=1 | |
# 设置 TCP 拥塞算法为 hybla | |
net.ipv4.tcp_congestion_control=hybla | |
# http://shadowsocks.org/en/config/advanced.html | |
net.ipv4.tcp_window_scaling = 1 | |
net.ipv4.tcp_tw_reuse = 1 | |
net.ipv4.tcp_syn_retries = 2 | |
net.ipv4.tcp_synack_retries = 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment