• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL 7 : sysctl kernel parameter doesn’t take effect after reboot

by admin

The Problem

sysctl parameter didn’t take effect after a reboot on RHEL 7 server. Parameter “net.ipv4.conf.all.forwarding” was disable before rebooting the server.

# cat /proc/sys/net/ipv4/conf/all/forwarding
1
# sysctl net.ipv4.conf.all.forwarding=0
net.ipv4.conf.all.forwarding = 0
# cat /proc/sys/net/ipv4/conf/all/forwarding
0
#cat /etc/sysctl.conf|grep net.ipv4.conf.all.forwarding
net.ipv4.conf.all.forwarding = 0
# shutdown -r now
# cat /proc/sys/net/ipv4/conf/all/forwarding            ### Gets enabled after reboot.
1

The Solution

RHEL 7 has a service named “tuned” which helps to create custom profiles and it overrides the “sysctl” values set in the /etc/sysctl.conf file, because “tuned” service will start after “sysctl” service. Use any one of the methods below to define the kernel parameters on RHEL/CentOS 7 server.

1. Check the active tune profile in the affected server.

# tuned-adm active
Current active profile: virtual-guest

2. Navigate to the respective tuned profile directory and verify if the problematic sysctl kernel parameter is defined with any alternate value.

# cd /usr/lib/tuned/virtual-guest
# cat tuned.conf 
#
# tuned configuration
#
[main]
include=throughput-performance
[sysctl]
net.ipv4.conf.all.forwarding = 1

If yes, then there are two option to fix the incorrect sysctl kernel parameter after reboot.

a) Remove the entry in tuned profile, so that “/etc/sysctl.conf” value takes effect.

# cd /usr/lib/tuned/virtual-guest
# cat tuned.conf
#
# tuned configuration
#
[main]
include=throughput-performance
[sysctl]

b) Else, remove the entry in “/etc/sysctl.conf” which will make the tuned value persistent after reboot.

# cat /etc/sysctl.conf | grep net.ipv4.conf.all.forwarding
#

In this case, make sure you have the parameter present in the tuned profile file.

# cd /usr/lib/tuned/virtual-guest
# cat tuned.conf 
#
# tuned configuration
#
[main]
include=throughput-performance
[sysctl]
net.ipv4.conf.all.forwarding = 0

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. mkfs.btrfs: command not found
  2. How To Configure 802.1q VLAN On NIC On CentOS/RHEL 7 and 8
  3. efibootmgr: command not found
  4. “uname” Command Examples to Check UNIX/Linux Version
  5. mv: command not found
  6. “systemd-udevd: Cannot Allocate Memory” and “A start job is running for dev-mapper-\x2droot.device” – CentOS/RHEL 7 booting issue
  7. debsecan: command not found
  8. How to use ipset Command in Linux
  9. Medusa: command not found
  10. Echo Command with Practical Examples

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright