How to set kernel parameters in Redhat Enterprise Linux and Suse Linux

Setting Kernel parameters permanently in Red hat Enterprise Linux

Every time the system boots, the ‘/etc/rc.d/rc.sysinit‘ script is executed by init process. This shell script contains a call to sysctl command and reads the values from /etc/sysctl.conf file as the ones to be set

Therefore, any values added to /etc/sysctl.conf will take effect after the system boot or without downtime using “ sysctl -p ” command

sysctl.conf is a simple file containing sysctl values to be read in and set by sysctl

The syntax is simply as follows:

# comment
; comment

token = value


Note that blank lines are ignored, and whitespace before and after a token or value is ignored, although a value can contain whitespace within. Lines which begin with a # or ; are considered remarks / comments and ignored.

Example:

# sysctl.conf sample
#
kernel.sysrq = 1
kernel.sem = 250 32000 100 128 #This sets SEMMSL, SEMMNS, SEMOPM, SEMMNI
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni = 4096
;
fs.file-max = 65536
;
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.ip_local_port_range = 1024 65000
;
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144

The sysctl command is used to view, set, and automated kernel settings in the /proc/sys/ directory. To get a quick overview of all settings configurable in the /proc/sys/ directory, type the sysctl -a command as root. This will create a large, comprehensive list.

Setting kernel parameters for SUSE Linux , permanently

On SUSE SLES, to set kernel parameter modifications permanently is to use the ‘/etc/init.d/boot.local‘ file.

You can put in that file the commands setting the kernel parameters. At the boot time ‘boot.local’ is started and the these setting processed

Example:

#! /bin/sh
#
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.
#
# Author: Werner Fink <werner@suse.de>, 1996
# Burchard Steinbild <feedback@suse.de>, 1996
#
# /etc/init.d/boot.local
#
# script with local commands to be executed from init on system startup
#
# Here you should add things, that should happen directly after booting
# before we’re going to the first run level.
#
echo -n $”Start Setting kernel parameters on “
echo 250 32000 100 128 > /proc/sys/kernel/sem #This sets SEMMSL, SEMMNS, SEMOPM, SEMMNI
echo 2097152 > /proc/sys/kernel/shmall
echo 2147483648 > /proc/sys/kernel/shmmax
echo 4096 > /proc/sys/kernel/shmmni
#
echo 65536 > /proc/sys/fs/file-max
#
echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
#
echo 4194304 > /proc/sys/net/core/rmem_default
echo 4194304 > /proc/sys/net/core/rmem_max
echo 262144 > /proc/sys/net/core/wmem_default
echo 262144 > /proc/sys/net/core/wmem_max
#
ulimit -n 65536 >/dev/null 2>&1
ulimit -u 16384 >/dev/null 2>&1
#
echo -n $”End Setting kernel parameters on “
echo

Again on SUSE SLES (with orarun-XXXX.rpm) you can use ‘/etc/sysconfig/oracle‘ file to set kernel parameter modifications permanently.

Example:

SET_ORACLE_KERNEL_PARAMETERS=”yes”
SHMMAX=3294967296
SHMMNI=4096
SHMALL=2097152
SEMMSL=1250
SEMMNS=32000
SEMOPM=128
SEMMNI=4096
IP_LOCAL_PORT_RANGE=”1024 65000″
FILE_MAX_KERNEL=131072
FILE_MAX_SHELL=65536
PROCESSES_MAX_SHELL=16384

Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

2 Responses

  1. March 2, 2012

    extensiones de plumas para el pelo…

    […]unix administration @ gurkulindia.com » How to set kernel parameters in Redhat Enterprise Linux and Suse Linux[…]…

  2. September 17, 2015

    […] Read How to set kernel parameters in Redhat Enterprise Linux and Suse Linux […]

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us