# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.cookie
# Controls IP packet forwarding
net.ipv4.ip_forward = 1網絡
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1app
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0socket
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0tcp
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1優化
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1.net
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0debug
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536隊列
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536ip
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
#對於一個新建鏈接,內核要發送多少個 SYN 鏈接請求才決定放棄,不該該大於255,默認值是5,對應於180秒左右時間
net.ipv4.tcp_syn_retries=2
#net.ipv4.tcp_synack_retries=2
#表示當keepalive起用的時候,TCP發送keepalive消息的頻度。缺省是2小時,改成300秒
net.ipv4.tcp_keepalive_time=1200
net.ipv4.tcp_orphan_retries=3
#表示SYN隊列的長度,默認爲1024,加大隊列長度爲8192,能夠容納更多等待鏈接的網絡鏈接數。
net.ipv4.tcp_max_syn_backlog = 4096
#表示開啓SYN Cookies。當出現SYN等待隊列溢出時,啓用cookies來處理,可防範少許SYN攻擊。默認爲0,表示關閉
net.ipv4.tcp_syncookies = 1
#表示開啓重用tcp鏈接。容許將TIME-WAIT sockets從新用於新的TCP鏈接。默認爲0,表示關閉
net.ipv4.tcp_tw_reuse = 1
#表示開啓TCP鏈接中TIME-WAIT sockets的快速回收。默認爲0,表示關閉
net.ipv4.tcp_tw_recycle = 1
#表示若是套接字由本端要求關閉,這個參數決定了它保持在FIN-WAIT-2狀態的時間
net.ipv4.tcp_fin_timeout = 30
#減小超時前的探測次數
net.ipv4.tcp_keepalive_probes=5
#優化網絡設備接收隊列
net.core.netdev_max_backlog=3000
#儘快的回收TIME_WAIT狀態的鏈接
fs.file-max = 1048576
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_mem = 786432 2097152 3145728
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
#鏈接數過多,nf_conntrack的哈希表滿
net.nf_conntrack_max = 655360
net.netfilter.nf_conntrack_max = 655350
net.netfilter.nf_conntrack_tcp_timeout_established = 1200
#用於解決TCP: time wait bucket table overflow問題,佔用大量端口號,使得新鏈接沒法綁定端口net.ipv4.tcp_max_tw_buckets = 262144