Created
March 17, 2018 08:58
-
-
Save bewho/483c66031f1392266e21fd993a68fdf0 to your computer and use it in GitHub Desktop.
自用优化的 sysctl.conf 配置 @2018.03.17
This file contains hidden or 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
| # sysctl settings are defined through files in | |
| # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. | |
| # | |
| # Vendors settings live in /usr/lib/sysctl.d/. | |
| # To override a whole file, create a new file with the same in | |
| # /etc/sysctl.d/ and put new settings there. To override | |
| # only specific settings, add a file with a lexically later | |
| # name in /etc/sysctl.d/ and put new settings there. | |
| # | |
| # For more information, see sysctl.conf(5) and sysctl.d(5). | |
| net.ipv6.conf.all.disable_ipv6 = 1 | |
| net.ipv6.conf.default.disable_ipv6 = 1 | |
| net.ipv6.conf.lo.disable_ipv6 = 1 | |
| vm.swappiness = 0 | |
| net.ipv4.neigh.default.gc_stale_time=120 | |
| # see details in https://help.aliyun.com/knowledge_detail/39428.html | |
| net.ipv4.ip_forward = 0 | |
| net.ipv4.conf.all.rp_filter=0 | |
| net.ipv4.conf.default.rp_filter=1 | |
| net.ipv4.conf.default.accept_source_route = 0 | |
| net.ipv4.conf.default.arp_announce = 2 | |
| net.ipv4.conf.lo.arp_announce=2 | |
| net.ipv4.conf.all.arp_announce=2 | |
| # see details in https://help.aliyun.com/knowledge_detail/41334.html | |
| net.ipv4.tcp_max_tw_buckets = 6000 | |
| net.ipv4.tcp_syncookies = 1 | |
| net.ipv4.icmp_echo_ignore_all=1 | |
| kernel.msgmnb = 65536 | |
| kernel.msgmax = 65536 | |
| kernel.shmmax = 68719476736 | |
| kernel.shmall = 4294967296 | |
| kernel.softlockup_panic = 1 | |
| kernel.sysrq = 0 | |
| kernel.core_uses_pid = 1 | |
| kernel.numa_balancing = 0 | |
| net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 1800 | |
| net.ipv4.ip_conntrack_max = 16777216 #如果使用默认参数,容易出现网络丢包 | |
| net.ipv4.netfilter.ip_conntrack_max = 16777216 #如果使用默认参数,容易出现网络丢包 | |
| net.ipv4.tcp_max_syn_backlog = 262144 | |
| net.ipv4.tcp_sack = 1 | |
| net.ipv4.tcp_window_scaling = 1 | |
| net.ipv4.tcp_wmem = 8192 4336600 873200 | |
| net.ipv4.tcp_rmem = 32768 4336600 873200 | |
| net.core.netdev_max_backlog = 262144 | |
| net.core.somaxconn = 262144 | |
| net.core.wmem_default = 8388608 | |
| net.core.rmem_default = 8388608 | |
| net.core.rmem_max = 16777216 | |
| net.core.wmem_max = 16777216 | |
| net.ipv4.tcp_timestamps = 1 | |
| net.ipv4.tcp_synack_retries = 1 | |
| net.ipv4.tcp_syn_retries = 1 | |
| net.ipv4.tcp_syncookies = 1 | |
| net.ipv4.tcp_fin_timeout=30 #改系統默认的TIMEOUT时间 | |
| net.ipv4.tcp_keepalive_time = 300 | |
| net.ipv4.tcp_tw_recycle = 1 #开启TCP连接中TIME-WAIT sockets的快速回收 默认为0 表示关闭 | |
| net.ipv4.tcp_tw_reuse = 1 #启重用,允许将TIME-WAIT sockets重新用于新的TCP连接 默认为0表示关闭 | |
| net.ipv4.tcp_mem = 94500000 915000000 927000000 | |
| net.ipv4.tcp_max_orphans = 3276800 | |
| net.ipv4.ip_local_port_range = 1024 65535 | |
| net.ipv4.conf.all.promote_secondaries = 1 | |
| net.ipv4.conf.default.promote_secondaries = 1 | |
| net.ipv6.neigh.default.gc_thresh3 = 4096 | |
| net.ipv4.neigh.default.gc_thresh3 = 4096 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment