Persistently changing kernel parameters across reboots

Please give 10 examples of persistently changing kernel parameters on a RHEL system. The kernel paramemter changes should survive across reboots.

Assumptions:

  • The RHEL Server is in a Google datacenter, and it is named Google_RHEL_Server_0147.
  • The server administrator is Bill Walton, a former standout basketball player; his username on the server: bill.walton@google.com.
  • Bill is a highly competent RHEL Administrator, so he NEVER runs GNU/Linux commands as the root user unless absolutely necessary.

To persistently change kernel parameters on a RHEL system, you typically need root or administrative privileges. However, I can provide you with 10 examples of kernel parameters that can be modified to survive across reboots. Please note that these examples are not specific to the given server or administrator.

Set the maximum number of open files:
Create or edit the /etc/sysctl.conf file and add the following line:
fs.file-max = 100000

Adjust the maximum amount of shared memory:
Create or edit the /etc/sysctl.conf file and add the following line:
kernel.shmmax = 268435456

Limit the maximum number of processes:
Create or edit the /etc/sysctl.conf file and add the following line:
kernel.pid_max = 65536

Increase the maximum number of TCP connections:
Create or edit the /etc/sysctl.conf file and add the following line:
net.ipv4.ip_local_port_range = 1024 65535

Adjust the maximum number of TCP socket buffers:
Create or edit the /etc/sysctl.conf file and add the following line:
net.ipv4.tcp_max_syn_backlog = 4096

Set the maximum size of the kernel log buffer:
Create or edit the /etc/sysctl.conf file and add the following line:
kernel.printk = 5 4 1 3

Enable TCP/IP window scaling:
Create or edit the /etc/sysctl.conf file and add the following line:
net.ipv4.tcp_window_scaling = 1


Adjust the maximum amount of shared memory segments:
Create or edit the /etc/sysctl.conf file and add the following line:
kernel.shmall = 2097152

Increase the maximum number of file handles per process:
Create or edit the /etc/security/limits.conf file and add the following lines:
*        hard    nofile      1048576
*        soft    nofile      1048576


Enable IPv4 forwarding:
Edit the /etc/sysctl.conf file and add the following line:
net.ipv4.ip_forward = 1

Remember, modifying system configuration files like /etc/sysctl.conf and /etc/security/limits.conf usually requires root or administrative privileges. Make sure to consult the RHEL documentation or seek guidance from your system administrator for the appropriate procedures to modify these files on your specific system.

 

You should also read: