sysctl is a Linux utility that allows you to view and modify kernel parameters at runtime. These parameters control various aspects of system behavior, such as memory management, networking, and security.
-
Configuration Files:
- Persistent settings are stored in:
/etc/sysctl.conf(main file)/etc/sysctl.d/*.conf(additional configuration files)
- Persistent settings are stored in:
-
Kernel Parameter Locations:
- Parameters are found under
/proc/sys/ - Example:
/proc/sys/net/ipv4/ip_forwardcontrols IP forwarding.
- Parameters are found under
-
View all current settings:
sysctl -a
-
Check a specific parameter:
sysctl net.ipv4.ip_forward
-
Modify a parameter temporarily:
sysctl -w net.ipv4.ip_forward=1
(Changes will be lost after reboot.)
-
Make a setting persistent: Add to
/etc/sysctl.confor a file in/etc/sysctl.d/:echo "net.ipv4.ip_forward = 1" | sudo tee /etc/sysctl.d/99-custom.conf sudo sysctl --system # Apply changes
Would you like help tuning any specific kernel parameters?