kernel parameters & Sysctl

There are lot of kernel parameters and those parameters can be viewed from /proc/sys/ directory. Modification of values of these parameters will persit only until the next reboot of the system.

We can modify these kernel parameter values manually. i.e. by echoing new values to files in /proc/sys/ [Each parameters have a file in /proc/sys/ directory].

sysctl provides CLI interface for editing/viewing these parameters. It has various options too.

I am going to exaplain little more about kernel parameters with an example.

hostname is a kernel parameter which stores hostname of the system. Its location is "/proc/sys/kernel/hostname"

The value for this parameter is loaded to kernel by rc.sysinit file during the boot process.

[root@ ~]# cat /etc/rc.sysinit



# /etc/rc.d/rc.sysinit - run once at boot time


# Taken in part from Miquel van Smoorenburg's bcheckrc.




Note :I truncated the remaining portion of this file since currently we are only intrested in HOSTNAME

So while booting the OS we pass the value of hostname to kernel through rc.sysinit file and hence changing the hostname through /etc/sysconfig/network file needs rebooting the OS to take into effect.

Alternatively we can change the hostname without any reboot by following method.

[root@ ~]# hostname

[root@ ~]# vi /etc/sysconfig/network # Edit the value for HOSTNAME to

[root@ ~]# sysctl -w kernel.hostname=""

[root@ ~]# bash

[root@ ~]# hostname

This can also be done via echoing new value to /proc/sys/kernel/hostname

Like this:

echo > /proc/sys/kernel/hostname

Note : I mean this article only for make you undestatnd about the kernel parameters and its values. The simplest way for modifying the hostname is by using /bin/hostname

Parameters available for sysctl


The name of a key to read from.  An example is kernel.ostype.  The ’/’ separator is also accepted in place of a ’.’.


To set a key, use the form variable=value, where variable is the key and value is the value to set it to. If the value contains quotes or characters which are parsed by the shell, you may need to enclose the value in double quotes. This requires the -w parameter to use.

-n Use this option to disable printing of the key name when printing values.

-e Use this option to ignore errors about unknown keys.

-N Use this option to only print the names. It may be useful with shells that have programmable completion.

-q Use this option to not display the values set to stdout.

-w Use this option when you want to change a sysctl setting.

-p Load in sysctl settings from the file specified or /etc/sysctl.conf if none given. Specifying – as filename means reading data from standard input.

-a Display all values currently available.

-A Display all values currently available in table form.


/sbin/sysctl -a

/sbin/sysctl -n kernel.hostname

/sbin/sysctl -w kernel.domainname=””

/sbin/sysctl -p /etc/sysctl.conf

We can add persistance to the kernel values by editing/adding values in /etc/sysctl.conf

[root@host13 ~]# cat /etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat Linux


# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and

# sysctl.conf(5) for more details.

# Controls IP packet forwarding

net.ipv4.ip_forward = 0

# Controls source route verification

net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.

# Useful for debugging multi-threaded applications.

kernel.core_uses_pid = 1

# Disable netfilter on bridges.

net.bridge.bridge-nf-call-ip6tables = 0

net.bridge.bridge-nf-call-iptables = 0

net.bridge.bridge-nf-call-arptables = 0

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: