2

Im running Ubuntu 14.0.4 LTS and im trying to change some default values to optimize.

I run sysctl -a to see all values.

I have /etc/sysctl.conf and /etc/sysctl.d/ which has a few 10-*.conf files in it.

I want to change net.ipv4.tcp_max_syn_backlog value but it is not present in any of the configuration files above.

a) Shall I just enter the new value in any of those files? Where is the default value stored?

b) After changing the value shall I run service procps start or sysctl -p?

I have read that the configuration files can be in the following places:

  1. /run/sysctl.d/*.conf (not present on my system)
  2. /usr/local/lib/sysctl.d/*.conf (not present on my system)
  3. /usr/lib/sysctl.d/*.conf (not present on my system)
  4. /lib/sysctl.d/*.conf (not present on my system)
  5. /etc/sysctl.d/*.conf
  6. /etc/sysctl.conf

Thanks in advance

Kevin
  • 21
  • 2

1 Answers1

1

The default value for kernel runtime parameters is selected/set at compilation time of the kernel (module). sysctl is used to read those parameters and allows you to modify/override those parameters at both system boot and at runtime.

Personally I have never used any other file than /etc/sysctl.conf and I would use sysctl -p to verify the syntax of the new parameters I set.
(Except when I don't use sysctl at all and manipulate kernel paramaters directly e.g. with the traditional echo 1 > /proc/sys/net/ipv4/ip_forward )

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • 1
    I prefer making a new file under `sysctl.d`. That way possible OS updates on the `sysctl.conf` file won't overwrite my changes. – Tero Kilkanen Oct 29 '16 at 10:05
  • Thanks for your reply. I see, so if the default is 256 and I set it to 5000, then in order to "go back" to default I will have to set it to the value it originally was, removing the new value wont restore the default value. However isn't directly writing to "/proc/sys/..." temporary? Or will it survive reboot? Thanks in advance – Kevin Oct 29 '16 at 13:19