Linux Server kernel parameter optimization

Source: Internet
Author: User

Linux kernel parameter tuning is achieved primarily by modifying the parameters of the/proc pseudo-file system and the/etc/sysctl.conf configuration file.

The/PROC directory structure is as follows:

/proc/driver information related to drives

/PROC/FS File System Parameters

/proc/net Network Information

/proc/pid information for each process

/proc/sys Kernel Parameters

/PROC/SCSI SCSI-related information

/proc/sys/kernel Universal Kernel Parameters

/PROC/SYS/VM Memory Management parameters

/proc/sys/dev information related to the device

/proc/sys/net Network Information


Vim/etc/sysctl.conf

net.ipv4.tcp_syncookies = 1 #开启SYN Cookies. Can protect against a small amount of SYN attacks.

Net.ipv4.ip_local_port_range = 10000 65535 #设置向外连接的端口范围

Net.ipv4.route.gc_timeout = #路由缓存刷新频率

Net.core.netdev_max_backlog = 16384 #允许排队更多的报文

Net.core.somaxconn = 16384 #指定更大的accept队列backlog

Net.ipv4.tcp_max_syn_backlog = 16384 #增加SYN队列长度

Net.ipv4.tcp_synack_retries = 1 #重新发送响应的次数

Net.ipv4.tcp_retries2 = 5 #向远程主机重新发送数据的次数

Net.ipv4.tcp_keepalive_time = #内核向远程主机发送Keepalive消息的频度

NET.IPV4.TCP_KEEPALIVE_INTVL = #内核向远程主机发送探测消息的间隔


System Optimization Script:

#!/bin/bash

Yum-y Groupinstall "Development tools"

Cd/usr/local/src

wget https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

RPM-IVH epel-release-6-8.noarch.rpm

Sed-i ' s/selinux=enforcing/selinux=disabled/g '/etc/selinux/config

Sed-i ' S/start on control-alt-delete/#start on control-alt-delete/'/etc/init/control-alt-delete.conf

Sed-i ' [email protected]/sbin/shutdown-r Now "Control-alt-delete pressed" @ #exec/sbin/shutdown-r Now "Control-alt-dele Te pressed "@ '/etc/init/control-alt-delete.conf

Service Iptables Stop

Chkconfig iptables off


Ulimit-shn 65534

echo "Ulimit-shn 65534" >>/etc/rc.local


Cat >>/etc/sysctl.conf << EOF

Net.ipv4.tcp_syncookies = 1

Net.ipv4.ip_local_port_range = 10000 65535

Net.ipv4.route.gc_timeout = 100

Net.core.netdev_max_backlog = 16384

Net.core.somaxconn = 16384

Net.ipv4.tcp_max_syn_backlog = 16384

Net.ipv4.tcp_synack_retries = 1

Net.ipv4.tcp_retries2 = 5

Net.ipv4.tcp_keepalive_time = 1200

NET.IPV4.TCP_KEEPALIVE_INTVL = 30

Eof

/sbin/sysctl-p


For i in ' chkconfig | grep 3:on | awk ' {print '} '

Do

Chkconfig--level 3 $i off

Done

For service in Crond rsyslog sshd Network

Do

Chkconfig--level 3 $service on

Done

Reboot


This article from "10,000 years too long, seize" blog, please be sure to keep this source http://zengwj1949.blog.51cto.com/10747365/1928018

Linux Server kernel parameter optimization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.