GNU/Linux >> Tutoriales Linux >  >> Cent OS

CentOS / RHEL 7:el parámetro del kernel sysctl no tiene efecto después de reiniciar

El problema

El parámetro sysctl no surtió efecto después de un reinicio en el servidor RHEL 7. El parámetro "net.ipv4.conf.all.forwarding" se deshabilitó antes de reiniciar el servidor.

# 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

La solución

RHEL 7 tiene un servicio llamado "sintonizado ” que ayuda a crear perfiles personalizados y anula los valores “sysctl” establecidos en el archivo /etc/sysctl.conf, porque el servicio “sintonizado” se iniciará después del servicio “sysctl”. Utilice cualquiera de los métodos siguientes para definir los parámetros del kernel en el servidor RHEL/CentOS 7.

1. Verifique el perfil de sintonización activo en el servidor afectado.

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

2. Navegue hasta el directorio del perfil sintonizado respectivo y verifique si el parámetro del kernel sysctl problemático está definido con algún valor alternativo.

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

En caso afirmativo, hay dos opciones para corregir el parámetro del kernel sysctl incorrecto después de reiniciar.

a) Elimine la entrada en el perfil sintonizado, para que el valor "/etc/sysctl.conf" tenga efecto.

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

b) De lo contrario, elimine la entrada en "/etc/sysctl.conf", lo que hará que el valor sintonizado persista después de reiniciar.

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

En este caso, asegúrese de tener el parámetro presente en el archivo de perfil ajustado.

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


Cent OS
  1. CentOS/RHEL 7:Cómo agregar un parámetro de kernel solo a un kernel específico

  2. Cómo habilitar IPv6 en CentOS / RHEL 6

  3. Cómo consultar y modificar los parámetros del kernel usando sysctl (inmediata y persistentemente) en CentOS / RHEL

  4. Cómo usar la herramienta Magic SysRq en CentOS / RHEL

  5. Después de reiniciar, el disco RAID1 se elimina o no está sincronizado (CentOS/RHEL)

Deshabilite el reinicio usando las teclas Ctrl-Alt-Del en RHEL / CentOS

Cómo deshabilitar IPv6 en CentOS 7 / RHEL 7

Cómo deshabilitar IPv6 en CentOS 8 / RHEL 8

CentOS / RHEL 7:Cómo configurar kdump usando GUI

CentOS/RHEL 8:"ACPI MEMORY OR I/O RESET_REG" Servidor bloqueado después de reiniciar

Después de reiniciar el cuadro de Debian, ignore los valores de sysctl.conf