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. If the vendor configuration file is included
73 in the initrd image, the image has to be regenerated.
74
76 Example 1. Set kernel YP domain name
77
78 /etc/sysctl.d/domain-name.conf:
79
80 kernel.domainname=example.com
81
82 Example 2. Apply settings available only when a certain module is
83 loaded (method one)
84
85 /etc/udev/rules.d/99-bridge.rules:
86
87 ACTION=="add", SUBSYSTEM=="module", KERNEL=="br_netfilter", \
88 RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/net/bridge"
89
90 /etc/sysctl.d/bridge.conf:
91
92 net.bridge.bridge-nf-call-ip6tables = 0
93 net.bridge.bridge-nf-call-iptables = 0
94 net.bridge.bridge-nf-call-arptables = 0
95
96 This method applies settings when the module is loaded. Please note
97 that, unless the br_netfilter module is loaded, bridged packets will
98 not be filtered by Netfilter (starting with kernel 3.18), so simply not
99 loading the module is sufficient to avoid filtering.
100
101 Example 3. Apply settings available only when a certain module is
102 loaded (method two)
103
104 /etc/modules-load.d/bridge.conf:
105
106 br_netfilter
107
108 /etc/sysctl.d/bridge.conf:
109
110 net.bridge.bridge-nf-call-ip6tables = 0
111 net.bridge.bridge-nf-call-iptables = 0
112 net.bridge.bridge-nf-call-arptables = 0
113
114 This method forces the module to be always loaded. Please note that,
115 unless the br_netfilter module is loaded, bridged packets will not be
116 filtered with Netfilter (starting with kernel 3.18), so simply not
117 loading the module is sufficient to avoid filtering.
118
120 systemd(1), systemd-sysctl.service(8), systemd-delta(1), sysctl(8),
121 sysctl.conf(5), modprobe(8)
122
123
124
125systemd 241 SYSCTL.D(5)