1 <?xml version=
"1.0"?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5 <refentry id=
"sysctl.d"
6 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
9 <title>sysctl.d
</title>
10 <productname>systemd
</productname>
14 <refentrytitle>sysctl.d
</refentrytitle>
15 <manvolnum>5</manvolnum>
19 <refname>sysctl.d
</refname>
20 <refpurpose>Configure kernel parameters at boot
</refpurpose>
24 <para><filename>/etc/sysctl.d/*.conf
</filename></para>
25 <para><filename>/run/sysctl.d/*.conf
</filename></para>
26 <para><filename>/usr/lib/sysctl.d/*.conf
</filename></para>
30 <title>Description
</title>
33 <citerefentry><refentrytitle>systemd-sysctl.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
34 reads configuration files from the above directories to configure
35 <citerefentry project='man-pages'
><refentrytitle>sysctl
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
36 kernel parameters.
</para>
40 <title>Configuration Format
</title>
42 <para>The configuration files contain a list of variable
43 assignments, separated by newlines. Empty lines and lines whose
44 first non-whitespace character is
<literal>#
</literal> or
45 <literal>;
</literal> are ignored.
</para>
47 <para>Note that either
<literal>/
</literal> or
48 <literal>.
</literal> may be used as separators within sysctl
49 variable names. If the first separator is a slash, remaining
50 slashes and dots are left intact. If the first separator is a dot,
51 dots and slashes are interchanged.
52 <literal>kernel.domainname=foo
</literal> and
53 <literal>kernel/domainname=foo
</literal> are equivalent and will
54 cause
<literal>foo
</literal> to be written to
55 <filename>/proc/sys/kernel/domainname
</filename>. Either
56 <literal>net.ipv4.conf.enp3s0/
200.forwarding
</literal> or
57 <literal>net/ipv4/conf/enp3s0.200/forwarding
</literal> may be used
59 <filename>/proc/sys/net/ipv4/conf/enp3s0.200/forwarding
</filename>.
62 <para>The settings configured with
<filename>sysctl.d
</filename>
63 files will be applied early on boot. The network
64 interface-specific options will also be applied individually for
65 each network interface as it shows up in the system. (More
66 specifically,
<filename>net.ipv4.conf.*
</filename>,
67 <filename>net.ipv6.conf.*
</filename>,
68 <filename>net.ipv4.neigh.*
</filename> and
69 <filename>net.ipv6.neigh.*
</filename>).
</para>
71 <para>Many sysctl parameters only become available when certain
72 kernel modules are loaded. Modules are usually loaded on demand,
73 e.g. when certain hardware is plugged in or network brought up.
75 <citerefentry><refentrytitle>systemd-sysctl.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
76 which runs during early boot will not configure such parameters if
77 they become available after it has run. To set such parameters, it
78 is recommended to add an
79 <citerefentry><refentrytitle>udev
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
80 rule to set those parameters when they become available.
81 Alternatively, a slightly simpler and less efficient option is to
83 <citerefentry><refentrytitle>modules-load.d
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
84 causing it to be loaded statically before sysctl settings are
85 applied (see example below).
</para>
88 <xi:include href=
"standard-conf.xml" xpointer=
"confd" />
91 <title>Examples
</title>
93 <title>Set kernel YP domain name
</title>
94 <para><filename>/etc/sysctl.d/domain-name.conf
</filename>:
97 <programlisting>kernel.domainname=example.com
</programlisting>
101 <title>Apply settings available only when a certain module is loaded (method one)
</title>
102 <para><filename>/etc/udev/rules.d/
99-bridge.rules
</filename>:
105 <programlisting>ACTION==
"add", SUBSYSTEM==
"module", KERNEL==
"br_netfilter", \
106 RUN+=
"/usr/lib/systemd/systemd-sysctl --prefix=/net/bridge"
109 <para><filename>/etc/sysctl.d/bridge.conf
</filename>:
112 <programlisting>net.bridge.bridge-nf-call-ip6tables =
0
113 net.bridge.bridge-nf-call-iptables =
0
114 net.bridge.bridge-nf-call-arptables =
0
117 <para>This method applies settings when the module is
118 loaded. Please note that, unless the
<filename>br_netfilter
</filename>
119 module is loaded, bridged packets will not be filtered by
120 Netfilter (starting with kernel
3.18), so simply not loading the
121 module is sufficient to avoid filtering.
</para>
125 <title>Apply settings available only when a certain module is loaded (method two)
</title>
126 <para><filename>/etc/modules-load.d/bridge.conf
</filename>:
129 <programlisting>br_netfilter
</programlisting>
131 <para><filename>/etc/sysctl.d/bridge.conf
</filename>:
134 <programlisting>net.bridge.bridge-nf-call-ip6tables =
0
135 net.bridge.bridge-nf-call-iptables =
0
136 net.bridge.bridge-nf-call-arptables =
0
139 <para>This method forces the module to be always loaded. Please
140 note that, unless the
<filename>br_netfilter
</filename> module is
141 loaded, bridged packets will not be filtered with Netfilter
142 (starting with kernel
3.18), so simply not loading the module is
143 sufficient to avoid filtering.
</para>
148 <title>See Also
</title>
150 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>systemd-sysctl.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
152 <citerefentry><refentrytitle>systemd-delta
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
153 <citerefentry project='man-pages'
><refentrytitle>sysctl
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
154 <citerefentry project='man-pages'
><refentrytitle>sysctl.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
155 <citerefentry project='man-pages'
><refentrytitle>modprobe
</refentrytitle><manvolnum>8</manvolnum></citerefentry>