---
title: "CentOS7内核优化参数"
author: "binyan17"
date: "2015-01-20T15:14:35Z"
tags: ["CentOS", "Linux"]
categories: ["操作系统"]
slug: "centos7"
draft: false
lastmod: "2015-01-20T15:14:35Z"
id: 2177679
url: "https://binyan17.iteye.com/blog/2177679"
---

参考：http://www.centoscn.com/CentOS/Intermediate/2014/0318/2594.html

 

目前服务器内存为64GB

 

把参数添加到/etc/sysctl.conf中，然后执行sysctl -p使参数生效，永久生效

 

 

net.ipv4.tcp\_syn\_retries = 1

net.ipv4.tcp\_synack\_retries = 1

net.ipv4.tcp\_keepalive\_time = 600

net.ipv4.tcp\_keepalive\_probes = 3

net.ipv4.tcp\_keepalive\_intvl =15

net.ipv4.tcp\_retries2 = 5

net.ipv4.tcp\_fin\_timeout = 2

net.ipv4.tcp\_max\_tw\_buckets = 36000

net.ipv4.tcp\_tw\_recycle = 1

net.ipv4.tcp\_tw\_reuse = 1

net.ipv4.tcp\_max\_orphans = 32768

net.ipv4.tcp\_syncookies = 1

net.ipv4.tcp\_max\_syn\_backlog = 16384

net.ipv4.tcp\_wmem = 51200 131072 204800

net.ipv4.tcp\_rmem = 51200 131072 204800

net.ipv4.ip\_local\_port\_range = 1024 65000

net.ipv4.ip\_conntrack\_max = 65536

net.core.somaxconn = 16384

net.core.netdev\_max\_backlog = 16384

\# net.ipv4.tcp\_mem = 786432 1048576 1572864

#net.ipv4.netfilter.ip\_conntrack\_max=65536

#net.ipv4.netfilter.ip\_conntrack\_tcp\_timeout\_established=180