1SYSCTL.D(5) sysctl.d SYSCTL.D(5)
2
3
4
6 sysctl.d - Configure kernel parameters at boot
7
9 /etc/sysctl.d/*.conf
10
11 /run/sysctl.d/*.conf
12
13 /usr/lib/sysctl.d/*.conf
14
16 At boot, systemd-sysctl.service(8) reads configuration files from the
17 above directories to configure sysctl(8) kernel parameters.
18
20 The configuration files contain a list of variable assignments,
21 separated by newlines. Empty lines and lines whose first non-whitespace
22 character is "#" or ";" are ignored.
23
24 Note that either "/" or "." may be used as separators within sysctl
25 variable names. If the first separator is a slash, remaining slashes
26 and dots are left intact. If the first separator is a dot, dots and
27 slashes are interchanged. "kernel.domainname=foo" and
28 "kernel/domainname=foo" are equivalent and will cause "foo" to be
29 written to /proc/sys/kernel/domainname. Either
30 "net.ipv4.conf.enp3s0/200.forwarding" or
31 "net/ipv4/conf/enp3s0.200/forwarding" may be used to refer to
32 /proc/sys/net/ipv4/conf/enp3s0.200/forwarding.
33
34 The settings configured with sysctl.d files will be applied early on
35 boot. The network interface-specific options will also be applied
36 individually for each network interface as it shows up in the system.
37 (More specifically, net.ipv4.conf.*, net.ipv6.conf.*, net.ipv4.neigh.*
38 and net.ipv6.neigh.*).
39
40 Many sysctl parameters only become available when certain kernel
41 modules are loaded. Modules are usually loaded on demand, e.g. when
42 certain hardware is plugged in or network brought up. This means that
43 systemd-sysctl.service(8) which runs during early boot will not
44 configure such parameters if they become available after it has run. To
45 set such parameters, it is recommended to add an udev(7) rule to set
46 those parameters when they become available. Alternatively, a slightly
47 simpler and less efficient option is to add the module to modules-
48 load.d(5), causing it to be loaded statically before sysctl settings
49 are applied (see example below).
50
52 Configuration files are read from directories in /etc/, /run/, and
53 /usr/lib/, in order of precedence. Each configuration file in these
54 configuration directories shall be named in the style of filename.conf.
55 Files in /etc/ override files with the same name in /run/ and
56 /usr/lib/. Files in /run/ override files with the same name in
57 /usr/lib/.
58
59 Packages should install their configuration files in /usr/lib/. Files
60 in /etc/ are reserved for the local administrator, who may use this
61 logic to override the configuration files installed by vendor packages.
62 All configuration files are sorted by their filename in lexicographic
63 order, regardless of which of the directories they reside in. If
64 multiple files specify the same option, the entry in the file with the
65 lexicographically latest name will take precedence. It is recommended
66 to prefix all filenames with a two-digit number and a dash, to simplify
67 the ordering of the files.
68
69 If the administrator wants to disable a configuration file supplied by
70 the vendor, the recommended way is to place a symlink to /dev/null in
71 the configuration directory in /etc/, with the same filename as the
72 vendor configuration file.
73
75 Example 1. Set kernel YP domain name
76
77 /etc/sysctl.d/domain-name.conf:
78
79 kernel.domainname=example.com
80
81 Example 2. Disable packet filter on bridged packets (method one)
82
83 /etc/udev/rules.d/99-bridge.rules:
84
85 ACTION=="add", SUBSYSTEM=="module", KERNEL=="bridge", RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/net/bridge"
86
87 /etc/sysctl.d/bridge.conf:
88
89 net.bridge.bridge-nf-call-ip6tables = 0
90 net.bridge.bridge-nf-call-iptables = 0
91 net.bridge.bridge-nf-call-arptables = 0
92
93 Example 3. Disable packet filter on bridged packets (method two)
94
95 /etc/modules-load.d/bridge.conf:
96
97 bridge
98
99 /etc/sysctl.d/bridge.conf:
100
101 net.bridge.bridge-nf-call-ip6tables = 0
102 net.bridge.bridge-nf-call-iptables = 0
103 net.bridge.bridge-nf-call-arptables = 0
104
106 systemd(1), systemd-sysctl.service(8), systemd-delta(1), sysctl(8),
107 sysctl.conf(5), modprobe(8)
108
109
110
111systemd 219 SYSCTL.D(5)