编辑文件
vim /etc/sysctl.conf
vm.swappiness = 0
fs.file-max = 655360
vm.max_map_count = 262144
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.tcp_max_orphans = 409600
句柄上,可防止Dos。
net.core.netdev_max_backlog = 40960
列的数据包的最大数目。
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 1000 65000
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_synack_retries = 2
收到上一个SYN连接请求包。
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_syn_retries = 2
数。
net.ipv4.tcp_syncookies = 1
net.core.somaxconn = 40960
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 8192
服务不可用。
net.netfilter.nf_conntrack_max = 655350
net.netfilter.nf_conntrack_tcp_timeout_established = 1200
net.core.rmem_max = 8388608
net.core.rmem_default = 65536
net.core.wmem_max = 8388608
net.core.wmem_default = 65536
net.ipv4.tcp_mem = 8388608 8388608 8388608
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 65536 8388608
生效
sysctl -p