Modification of Linux kernel parameter configuration file

Source: Internet
Author: User
Tags file system

Linux modifies kernel parameters (/proc/sys and/etc/sysctl.conf) while the system is running, without rebooting the system, which is implemented through the/proc virtual file system.

Most kernel parameters are stored in the/proc/sys directory and are designed to be changed while the system is running, and can be modified to modify kernel parameters by changing the file corresponding to the kernel parameters in/proc/sys (after modification, the save configuration file will automatically take effect immediately), However, the value of the parameter modified before restarting the machine is invalidated, so it can only be a temporary parameter change scheme. (suitable for debugging kernel parameter optimization values, if the setting value is problematic, restart the server to restore the original settings parameter values.) Simple and convenient. )

However, if you need to permanently save the parameter values after debugging kernel parameter optimization values, you must permanently save the changes by modifying the kernel parameters within the/etc/sysctl.conf. But just modify the parameter values in the Sysctl file, confirm that after saving the modified file, set the parameter value will not immediately take effect, if you want to make the parameter value changes immediately effective, and do not restart the server, you can execute the following command:

#sysctl –p

The following is a description of the/proc/sys kernel file and the variables in the configuration file sysctl.conf:

Because kernel parameters that can be modified are in the/proc/sys directory, the sysctl.conf variable name omits the previous section of the directory (/proc/sys).

The conversion of a file in/proc/sys to a variable in Sysctl is based on the following two simple rules:

1. Remove the front part/proc/sys

2. Change the slash in file name to Dot

These two rules can convert any file name in/proc/sys to a variable name in Sysctl.

For example:

/proc/sys/net/ipv4/ip_forward = "Net.ipv4.ip_forward

/proc/sys/kernel/hostname = "Kernel.hostname

You can use the following command to query all modifiable variable names

# Sysctl–a

PS: Now it is rare to write a blog, you are welcome to shoot bricks. If you are free in a few days, try writing a Linux kernel automatic optimization script.

This article is from the "Network" blog, please be sure to keep this source http://netlin.blog.51cto.com/118225/1167446

Related Article

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.