Ubuntu kernel parameters

Look! there's a flower!·2024년 12월 9일

1. Checking kernel parameters

$ sysctl -a // list all kernel parameters
or
$ /etc/sysctl.conf or /etc/sysctl.d//.conf
has subdirectories that contains subdirectory for the definitions.

NOTE THAT ALL KERNEL PARAMETERS ARE LISTED IN /etc/sysctl.conf!!!

Kernel parameters works this way:
1. Kernel has built-in default values for all parameters
2. If the same parameter is defined in /etc/sysctl.conf or /etc/sysctl.d/*.conf, it will override the kernel's built-in default
3. You can add any kernel parameter to these config files, even if it wasn't there before

So for example, if net.core.rmem_max isn't defined in any config file:
1. System uses kernel's built-in default
2. You can add net.core.rmem_max = 16777216 to /etc/sysctl.conf
3. After reboot (or sysctl -p), this value will override the kernel default

This is why it's perfectly fine that many parameters aren't listed in the config files - they only need to be added when you want to override the kernel defaults.

2. socket related parameters

fs.mqueue.msg_max = 1000
fs.mqueue.msgsize_max = 16304

net.core.default_qdisc = fq
net.core.netdev_max_backlog = 16384

net.core.optmem_max = 65536
net.core.rmem_default = 1048576
net.core.rmem_max = 16777216
net.core.wmem_default = 1048576
net.core.wmem_max = 16777216

net.ipv4.udp_rmem_min = 512000
net.ipv4.udp_wmem_min = 512000

3. how to apply change

a. change parameters
$ sudo sysctl -w net.core.rmem_max=16777216 // for example
or, $ sudo vi /etc/sysctl.conf
b. apply change
$ sudo sysctl -p
c. verify the change
$ sysctl net.core.rmem_max

profile
Why don't you take a look around for a moment?

0개의 댓글