![sysctl修改内核参数](https://i-blog.csdnimg.cn/blog_migrate/94c70b351f0e7dcc7803dd2e027fadea.png)
sysctl修改内核参数
Linux operating systems run on the kernel actually Linux kernel. The kernel name is Linux but the distributions are generally named as Linux. Kernel provides operating system services to the user space applications. Kernel have a lot of option and configurations possibilities to meet user space applications, libraries and system administrator needs. These configurations may be IP stack, disk read limit, loaded modules etc. There are different ways to manage this configuration variables or kernel parameters. Sysctl is a tool which provides easy configuration of these kernel parameter.
Linux操作系统实际上是在Linux内核上运行的。 内核名称为Linux,但是发行版通常命名为Linux。 内核为用户空间应用程序提供操作系统服务。 内核具有很多选项和配置可能性,可以满足用户空间应用程序,库和系统管理员的需求。 这些配置可能是IP堆栈,磁盘读取限制,加载的模块等。可以使用不同的方法来管理此配置变量或内核参数。 Sysctl是一个工具,可以轻松配置这些内核参数。
句法 (Syntax)
We will use following syntax for sysctl
command.
sysctl
命令将使用以下语法。
sysctl [options] [variable[=value] ...]
帮帮我 (Help)
$ sysctl
![Help](https://i-blog.csdnimg.cn/blog_migrate/9b95089eaf52bf8318b65ef0c708393b.png)
内核参数配置文件(Kernel Parameter Configuration File)
Linux Kernel configuration is stored in a file named sysctl.conf
. This file is locate at /etc
. Following is a sample part from this configuration file.
Linux内核配置存储在名为sysctl.conf
的文件中。 该文件位于/etc
以下是此配置文件中的样本部分。
# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
net.ipv6.conf.all.forwarding=1
There is also a directory named sysctl.d
which holds configuration files too. There are some prepared files by operating system. For example kernel hardening configurations can be put into 10-kernel-hardening.conf
file for easy management. This files are generally used to make configuration persistent and effect through boots.
还有一个名为sysctl.d
的目录,该目录也包含配置文件。 按操作系统有一些准备好的文件。 例如,可以将内核强化配置放入10-kernel-hardening.conf
文件中,