]>
Commit | Line | Data |
---|---|---|
3802a3d3 | 1 | <?xml version="1.0"?> <!--*-nxml-*--> |
12b42c76 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
c91faef3 LP |
3 | <!-- |
4 | This file is part of systemd. | |
5 | ||
6 | Copyright 2011 Lennart Poettering | |
7 | ||
8 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
9 | under the terms of the GNU Lesser General Public License as published by |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
c91faef3 LP |
11 | (at your option) any later version. |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 16 | Lesser General Public License for more details. |
c91faef3 | 17 | |
5430f7f2 | 18 | You should have received a copy of the GNU Lesser General Public License |
c91faef3 LP |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
20 | --> | |
d3fae78f | 21 | <refentry id="sysctl.d" |
798d3a52 ZJS |
22 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
23 | ||
24 | <refentryinfo> | |
25 | <title>sysctl.d</title> | |
26 | <productname>systemd</productname> | |
27 | ||
28 | <authorgroup> | |
29 | <author> | |
30 | <contrib>Developer</contrib> | |
31 | <firstname>Lennart</firstname> | |
32 | <surname>Poettering</surname> | |
33 | <email>lennart@poettering.net</email> | |
34 | </author> | |
35 | </authorgroup> | |
36 | </refentryinfo> | |
37 | ||
38 | <refmeta> | |
39 | <refentrytitle>sysctl.d</refentrytitle> | |
40 | <manvolnum>5</manvolnum> | |
41 | </refmeta> | |
42 | ||
43 | <refnamediv> | |
44 | <refname>sysctl.d</refname> | |
45 | <refpurpose>Configure kernel parameters at boot</refpurpose> | |
46 | </refnamediv> | |
47 | ||
48 | <refsynopsisdiv> | |
49 | <para><filename>/etc/sysctl.d/*.conf</filename></para> | |
50 | <para><filename>/run/sysctl.d/*.conf</filename></para> | |
51 | <para><filename>/usr/lib/sysctl.d/*.conf</filename></para> | |
52 | </refsynopsisdiv> | |
53 | ||
54 | <refsect1> | |
55 | <title>Description</title> | |
56 | ||
57 | <para>At boot, | |
58 | <citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
59 | reads configuration files from the above directories to configure | |
3ba3a79d | 60 | <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
61 | kernel parameters.</para> |
62 | </refsect1> | |
63 | ||
64 | <refsect1> | |
65 | <title>Configuration Format</title> | |
66 | ||
67 | <para>The configuration files contain a list of variable | |
68 | assignments, separated by newlines. Empty lines and lines whose | |
69 | first non-whitespace character is <literal>#</literal> or | |
70 | <literal>;</literal> are ignored.</para> | |
71 | ||
72 | <para>Note that either <literal>/</literal> or | |
73 | <literal>.</literal> may be used as separators within sysctl | |
74 | variable names. If the first separator is a slash, remaining | |
75 | slashes and dots are left intact. If the first separator is a dot, | |
76 | dots and slashes are interchanged. | |
77 | <literal>kernel.domainname=foo</literal> and | |
78 | <literal>kernel/domainname=foo</literal> are equivalent and will | |
79 | cause <literal>foo</literal> to be written to | |
80 | <filename>/proc/sys/kernel/domainname</filename>. Either | |
81 | <literal>net.ipv4.conf.enp3s0/200.forwarding</literal> or | |
82 | <literal>net/ipv4/conf/enp3s0.200/forwarding</literal> may be used | |
83 | to refer to | |
84 | <filename>/proc/sys/net/ipv4/conf/enp3s0.200/forwarding</filename>. | |
85 | </para> | |
86 | ||
87 | <para>The settings configured with <filename>sysctl.d</filename> | |
88 | files will be applied early on boot. The network | |
89 | interface-specific options will also be applied individually for | |
90 | each network interface as it shows up in the system. (More | |
91 | specifically, <filename>net.ipv4.conf.*</filename>, | |
92 | <filename>net.ipv6.conf.*</filename>, | |
93 | <filename>net.ipv4.neigh.*</filename> and | |
94 | <filename>net.ipv6.neigh.*</filename>).</para> | |
95 | ||
96 | <para>Many sysctl parameters only become available when certain | |
97 | kernel modules are loaded. Modules are usually loaded on demand, | |
98 | e.g. when certain hardware is plugged in or network brought up. | |
99 | This means that | |
100 | <citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
101 | which runs during early boot will not configure such parameters if | |
102 | they become available after it has run. To set such parameters, it | |
103 | is recommended to add an | |
104 | <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
105 | rule to set those parameters when they become available. | |
106 | Alternatively, a slightly simpler and less efficient option is to | |
107 | add the module to | |
108 | <citerefentry><refentrytitle>modules-load.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
109 | causing it to be loaded statically before sysctl settings are | |
110 | applied (see example below).</para> | |
111 | </refsect1> | |
112 | ||
113 | <xi:include href="standard-conf.xml" xpointer="confd" /> | |
114 | ||
115 | <refsect1> | |
116 | <title>Examples</title> | |
117 | <example> | |
118 | <title>Set kernel YP domain name</title> | |
119 | <para><filename>/etc/sysctl.d/domain-name.conf</filename>: | |
120 | </para> | |
121 | ||
122 | <programlisting>kernel.domainname=example.com</programlisting> | |
123 | </example> | |
124 | ||
125 | <example> | |
9407bc2d | 126 | <title>Apply settings available only when a certain module is loaded (method one)</title> |
798d3a52 ZJS |
127 | <para><filename>/etc/udev/rules.d/99-bridge.rules</filename>: |
128 | </para> | |
129 | ||
9407bc2d ZJS |
130 | <programlisting>ACTION=="add", SUBSYSTEM=="module", KERNEL=="br_netfilter", \ |
131 | RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/net/bridge" | |
71418295 ZJS |
132 | </programlisting> |
133 | ||
798d3a52 ZJS |
134 | <para><filename>/etc/sysctl.d/bridge.conf</filename>: |
135 | </para> | |
71418295 | 136 | |
798d3a52 | 137 | <programlisting>net.bridge.bridge-nf-call-ip6tables = 0 |
71418295 ZJS |
138 | net.bridge.bridge-nf-call-iptables = 0 |
139 | net.bridge.bridge-nf-call-arptables = 0 | |
140 | </programlisting> | |
9407bc2d ZJS |
141 | |
142 | <para>This method applies settings when the module is | |
b938cb90 | 143 | loaded. Please note that, unless the <filename>br_netfilter</filename> |
9407bc2d | 144 | module is loaded, bridged packets will not be filtered by |
a8eaaee7 JE |
145 | Netfilter (starting with kernel 3.18), so simply not loading the |
146 | module is sufficient to avoid filtering.</para> | |
798d3a52 | 147 | </example> |
71418295 | 148 | |
798d3a52 | 149 | <example> |
9407bc2d | 150 | <title>Apply settings available only when a certain module is loaded (method two)</title> |
798d3a52 ZJS |
151 | <para><filename>/etc/modules-load.d/bridge.conf</filename>: |
152 | </para> | |
7284335a | 153 | |
9407bc2d | 154 | <programlisting>br_netfilter</programlisting> |
7284335a | 155 | |
798d3a52 ZJS |
156 | <para><filename>/etc/sysctl.d/bridge.conf</filename>: |
157 | </para> | |
c91faef3 | 158 | |
798d3a52 | 159 | <programlisting>net.bridge.bridge-nf-call-ip6tables = 0 |
7284335a ZJS |
160 | net.bridge.bridge-nf-call-iptables = 0 |
161 | net.bridge.bridge-nf-call-arptables = 0 | |
162 | </programlisting> | |
9407bc2d ZJS |
163 | |
164 | <para>This method forces the module to be always loaded. Please | |
b938cb90 | 165 | note that, unless the <filename>br_netfilter</filename> module is |
a8eaaee7 | 166 | loaded, bridged packets will not be filtered with Netfilter |
9407bc2d | 167 | (starting with kernel 3.18), so simply not loading the module is |
a8eaaee7 | 168 | sufficient to avoid filtering.</para> |
798d3a52 ZJS |
169 | </example> |
170 | </refsect1> | |
171 | ||
172 | <refsect1> | |
173 | <title>See Also</title> | |
174 | <para> | |
175 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
176 | <citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
177 | <citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
3ba3a79d ZJS |
178 | <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
179 | <citerefentry project='man-pages'><refentrytitle>sysctl.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
180 | <citerefentry project='man-pages'><refentrytitle>modprobe</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
798d3a52 ZJS |
181 | </para> |
182 | </refsect1> | |
c91faef3 LP |
183 | |
184 | </refentry> |