Tag Archives: set up sysctl rhel

Set up sysctl variables on CentOS/RHEL

A sysctl variable represents file locations under the /proc/sys directory. The dot(“.”) notation is used when setting in a configuration file.

RHEL/CentOS 7
– Set a sysctl parameter value immediately (not persistent/not applied on boot) on any version of RHEL:
Use the sysctl -w command. Parameter which take multiple values should have the values enclosed in quotes. For example, to set net.ipv4.ip_forward to 1 and net.ipv4.ip_local_port_range to 1025-65535:

# sysctl -w net.ipv4.ip_forward=1
# sysctl -w net.ipv4.ip_local_port_range="1025 65535"

Alternatively, it is possible to echo values directly into the procfs file which represents a sysctl parameter:

# echo 1 > /proc/sys/net/ipv4/ip_forward
# echo "1025 65535" > /proc/sys/net/ipv4/ip_local_port_range

Continue reading