Docs / Server Management / Kernel Parameter Tuning with sysctl

Kernel Parameter Tuning with sysctl

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 29 views · 1 min read

What is sysctl?

sysctl allows you to view and modify kernel parameters at runtime. These parameters control networking, memory management, filesystem behavior, and security features.

View Parameters

# Show all
sysctl -a

# Show specific
sysctl net.ipv4.ip_forward
sysctl vm.swappiness

Modify at Runtime

# Temporary (lost on reboot)
sudo sysctl -w net.ipv4.ip_forward=1
sudo sysctl -w vm.swappiness=10

Make Permanent

Create /etc/sysctl.d/99-custom.conf:

# Network performance
net.core.somaxconn = 65535
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_tw_reuse = 1

# Memory
vm.swappiness = 10
vm.dirty_ratio = 40
vm.dirty_background_ratio = 10

# Security
net.ipv4.conf.all.rp_filter = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
kernel.randomize_va_space = 2

# File handles
fs.file-max = 2097152
fs.inotify.max_user_watches = 524288
sudo sysctl -p /etc/sysctl.d/99-custom.conf

Common Tuning Categories

  • Web servers — increase connection limits and TCP buffers
  • Database servers — tune dirty page ratios and swappiness
  • Security — enable SYN cookies, disable source routing

Was this article helpful?