Should custom sysctl settings go in sysctl.conf or sysctl.conf.local?

Hello,
I looked at the sysctl.conf manual, and this is what it says:

Code:
/etc/sysctl.conf          Initial settings for sysctl(8).
/etc/sysctl.conf.local    Machine-specific settings for sites with a common /etc/sysctl.conf.

I'm not sure if I understood correctly. If I have custom configurations, is it recommended to use the sysctl.conf.local instead of sysctl.conf ? I think the advantage here is that if I put settings in sysctl.conf.local, they won't be accidentally overwritten by an update or something similar, right? I also checked the "Absolute FreeBSD" book but couldn't find any information about the .local file, the author just mentions the sysctl.conf.
 
The difference comes into play if you have multiple machines that are configured in a similar way. You put the common statements in sysctl.com and copy that file around. Statements for a single machine are in local.
 
The sysctl.conf.local option exists for deployments that have a network‑wide shared sysctl.conf, cmp. PR 254901.​
  • /etc/rc.d/sysctl processes /etc/sysctl.conf first, /etc/sysctl.conf.local second. Should you want to override some values from your globally shared sysctl.conf on one machine, define the overrides in sysctl.conf.local. Note that this obviously creates a time window when some undesired sysctl(8) settings are in effect.​
  • Furthermore, a freebsd-update(8) won’t bother you with a merge conflict if you edit /etc/sysctl.conf.local since /etc/sysctl.conf.local is not (and will not be) distributed.​
My recommendation is: Use /etc/sysctl.conf. More files correlates to more complexity (case in point: your question). Unless you can justify that added complexity – i. e. the intended use case of network‑wide shared sysctl.conf vs. some local deviations – don’t use it (don’t use sysctl.conf.local).​
 
Back
Top