Debian Codegraph @

man/nm-settings-ifcfg-rh.xsl

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE stylesheet [
3 <!ENTITY % entities SYSTEM "common.ent" >
4 %entities;
5 ]>
6 <xsl:stylesheet version="1.0"
7 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
8
9 <!-- We need to strip whitespaces so that position() function counts correctly.
10 http://www.oxygenxml.com/archives/xsl-list/200305/msg00430.html -->
11 <xsl:strip-space elements="nm-setting-docs setting" />
12
13 <xsl:output
14 method="xml"
15 doctype-public="-//OASIS//DTD DocBook XML V4.5//EN"
16 doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
17 />
18
19 <xsl:template match="nm-setting-docs">
20 <refentry id="nm-settings-ifcfg-rh">
21 <refentryinfo>
22 <title>nm-settings-ifcfg-rh</title>
23 <author>NetworkManager developers</author>
24 </refentryinfo>
25 <refmeta>
26 <refentrytitle>nm-settings-ifcfg-rh</refentrytitle>
27 <manvolnum>5</manvolnum>
28 <refmiscinfo class="source">NetworkManager</refmiscinfo>
29 <refmiscinfo class="manual">Configuration</refmiscinfo>
30 <refmiscinfo class="version">&NM_VERSION;</refmiscinfo>
31 </refmeta>
32 <refnamediv>
33 <refname>nm-settings-ifcfg-rh</refname>
34 <refpurpose>Description of <emphasis>ifcfg-rh</emphasis> settings plugin</refpurpose>
35 </refnamediv>
36 <refsect1 id='description'><title>Description</title>
37 <para>
38 NetworkManager is based on the concept of connection profiles that contain
39 network configuration (see <citerefentry><refentrytitle>nm-settings-nmcli</refentrytitle>
40 <manvolnum>5</manvolnum></citerefentry> for details). The profiles can be
41 stored in various formats. NetworkManager uses plugins for reading and writing
42 the data. The plugins can be configured in <citerefentry>
43 <refentrytitle>NetworkManager.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
44 </para>
45 <para>
46 The <emphasis>ifcfg-rh</emphasis> plugin is used on the Fedora and Red Hat
47 Enterprise Linux distributions to read/write configuration from/to
48 the traditional <filename>/etc/sysconfig/network-scripts/ifcfg-*</filename> files.
49 Each NetworkManager connection maps to one <filename>ifcfg-*</filename> file, with
50 possible usage of <filename>keys-*</filename> for passwords, <filename>route-*</filename>
51 for static IPv4 routes and <filename>route6-*</filename> for static IPv6 routes.
52 The plugin currently supports reading and writing Ethernet, Wi-Fi, InfiniBand,
53 VLAN, Bond, Bridge, and Team connections. Unsupported connection types (such as
54 WWAN, PPPoE, VPN, or ADSL) are handled by <emphasis>keyfile</emphasis> plugin
55 (<link linkend='nm-settings-keyfile'><citerefentry><refentrytitle>nm-settings-keyfile</refentrytitle><manvolnum>5</manvolnum></citerefentry></link>).
56 The main reason for using <emphasis>ifcfg-rh</emphasis> plugin is the compatibility
57 with legacy configurations for <emphasis>ifup</emphasis> and <emphasis>ifdown</emphasis>
58 (initscripts).
59 </para>
60 </refsect1>
61 <refsect1 id='file_format'><title>File Format</title>
62 <para>
63 The <emphasis>ifcfg-rh</emphasis> config format is a simple text file containing
64 VARIABLE="value" lines. The format is described in <filename>sysconfig.txt</filename>
65 of <emphasis>initscripts</emphasis> package. Note that the configuration files
66 may be sourced by <emphasis>initscripts</emphasis>, so they must be valid shell
67 scripts. That means, for instance, that <literal>#</literal> character can be used
68 for comments, strings with spaces must be quoted, special characters must be escaped,
69 etc.
70 </para>
71 <para>
72 Users can create or modify the <emphasis>ifcfg-rh</emphasis> connection files
73 manually, even if that is not the recommended way of managing the profiles.
74 However, if they choose to do that, they must inform NetworkManager about
75 their changes (for example via <emphasis>nmcli con (re)load</emphasis>).
76 </para>
77 <formalpara>
78 <title>Some <emphasis>ifcfg-rh</emphasis> configuration examples:</title>
79 <para>
80 <programlisting>
81 <emphasis role="bold">Simple DHCP ethernet configuration:</emphasis>
82 NAME=ethernet
83 UUID=1c4ddf70-01bf-46d6-b04f-47e842bd98da
84 TYPE=Ethernet
85 BOOTPROTO=dhcp
86 DEFROUTE=yes
87 PEERDNS=yes
88 PEERROUTES=yes
89 IPV4_FAILURE_FATAL=no
90 ONBOOT=yes
91 </programlisting>
92 </para>
93 <para>
94 <programlisting>
95 <emphasis role="bold">Simple ethernet configuration with static IP:</emphasis>
96 TYPE=Ethernet
97 BOOTPROTO=none
98 IPADDR=10.1.0.25
99 PREFIX=24
100 GATEWAY=10.1.0.1
101 DEFROUTE=yes
102 IPV4_FAILURE_FATAL=no
103 IPV6INIT=yes
104 IPV6_AUTOCONF=yes
105 IPV6_DEFROUTE=yes
106 IPV6_PEERDNS=yes
107 IPV6_PEERROUTES=yes
108 IPV6_FAILURE_FATAL=no
109 NAME=ethernet-em2
110 UUID=51bb3904-c0fc-4dfe-83b2-0a71e7928c13
111 DEVICE=em2
112 ONBOOT=yes
113 </programlisting>
114 </para>
115 <para>
116 <programlisting>
117 <emphasis role="bold">WPA2 Enterprise WLAN (TTLS with inner MSCHAPV2 authentication):</emphasis>
118 ESSID="CompanyWLAN"
119 MODE=Managed
120 KEY_MGMT=WPA-EAP
121 TYPE=Wireless
122 IEEE_8021X_EAP_METHODS=TTLS
123 IEEE_8021X_IDENTITY=joe
124 IEEE_8021X_PASSWORD_FLAGS=ask
125 IEEE_8021X_INNER_AUTH_METHODS=MSCHAPV2
126 IEEE_8021X_CA_CERT=/home/joe/.cert/company.crt
127 BOOTPROTO=dhcp
128 DEFROUTE=yes
129 PEERDNS=yes
130 PEERROUTES=yes
131 IPV4_FAILURE_FATAL=no
132 IPV6INIT=no
133 NAME=MyCompany
134 UUID=f79848ff-11a6-4810-9e1a-99039dea84c4
135 ONBOOT=yes
136 </programlisting>
137 </para>
138 <para>
139 <programlisting>
140 <emphasis role="bold">Bridge and bridge port configuration:</emphasis>
141 ifcfg-bridge: ifcfg-bridge-port:
142 NAME=bridge NAME=bridge007-port-eth0
143 UUID=4be99ce0-c5b2-4764-8b77-ec226e440125 UUID=3ad56c4a-47e1-419b-b0d4-8ad86eb967a3
144 DEVICE=bridge007 DEVICE=eth0
145 STP=yes ONBOOT=yes
146 TYPE=Bridge TYPE=Ethernet
147 BRIDGING_OPTS=priority=32768 BRIDGE=bridge007
148 ONBOOT=yes
149 BOOTPROTO=dhcp
150
151 </programlisting>
152 </para>
153 <para>
154 <programlisting>
155 <emphasis role="bold">Bonding configuration:</emphasis>
156 ifcfg-BOND: ifcfg-BOND-port:
157 NAME=BOND NAME=BOND-port
158 UUID=b41888aa-924c-450c-b0f8-85a4f0a51b4a UUID=9bb048e4-286a-4cc3-b104-007dbd20decb
159 DEVICE=bond100 DEVICE=eth0
160 BONDING_OPTS="mode=balance-rr miimon=100" ONBOOT=yes
161 TYPE=Bond TYPE=Ethernet
162 BONDING_MASTER=yes MASTER=bond100
163 ONBOOT=yes SLAVE=yes
164 BOOTPROTO=dhcp
165
166 </programlisting>
167 </para>
168 <para>
169 <programlisting>
170 <emphasis role="bold">Team and team port configuration:</emphasis>
171 ifcfg-my_team0:
172 DEVICE=team0
173 TEAM_CONFIG="{ \"device\": \"team0\", \"runner\": {\"name\": \"roundrobin\"}, \"ports\": {\"eth1\": {}, \"eth2\": {}} }"
174 DEVICETYPE=Team
175 BOOTPROTO=dhcp
176 NAME=team0-profile
177 UUID=1d3460a0-7b37-457f-a300-fe8d92da4807
178 ONBOOT=yes
179
180 ifcfg-my_team0_port1:
181 NAME=team0-port1
182 UUID=d5aed298-c567-4cc1-b808-6d38ecef9e64
183 DEVICE=eth1
184 ONBOOT=yes
185 TEAM_MASTER=team0
186 DEVICETYPE=TeamPort
187
188 ifcfg-my_team0_port2:
189 NAME=team0-port2
190 UUID=94e75f4e-e5ad-401c-8962-31e0ae5d2215
191 DEVICE=eth2
192 ONBOOT=yes
193 TEAM_MASTER=team0
194 DEVICETYPE=TeamPort
195 </programlisting>
196 </para>
197 <para>
198 The UUID values in the config files must be unique. You can use <emphasis>uuidgen</emphasis>
199 command line tool to generate such values. Alternatively, you can leave out UUID
200 entirely. In that case NetworkManager will generate a UUID based on the file name.
201 </para>
202 </formalpara>
203 </refsect1>
204
205 <refsect1 id='differences_against_initscripts'><title>Differences against initscripts</title>
206 <para>
207 The main differences of NetworkManager ifcfg-rh plugin and traditional
208 initscripts are:
209 <variablelist class="NM-initscripts-differences">
210 <varlistentry>
211 <term><emphasis role="bold">NM_CONTROLLED=yes|no</emphasis></term>
212 <listitem><para>
213 NM_CONTROLLED is NetworkManager-specific variable used by NetworkManager
214 for determining whether the device of the <emphasis>ifcfg</emphasis> file
215 should be managed. NM_CONTROLLED=yes is supposed if the variable is not
216 present in the file.
217 Note that if you have more <emphasis>ifcfg</emphasis> files for a single
218 device, NM_CONTROLLED=no in one of the files will cause the device not
219 to be managed. The profile may not even be the active one.
220 </para></listitem>
221 </varlistentry>
222 <varlistentry>
223 <term><emphasis role="bold">New variables</emphasis></term>
224 <listitem><para>
225 NetworkManager has introduced some new variable, not present in initscripts,
226 to be able to store data for its new features. The variables are marked
227 as extensions in the tables below.
228 </para></listitem>
229 </varlistentry>
230 <varlistentry>
231 <term><emphasis role="bold">Semantic change of variables and differences</emphasis></term>
232 <listitem>
233 <para>
234 NetworkManager changes the semantics for a few variables and there are other behavioral differences.
235 <itemizedlist>
236 <listitem>
237 <para><literal>PEERDNS</literal> -
238 initscripts interpret PEERDNS=no to mean "never touch resolv.conf".
239 NetworkManager interprets it to say "never add automatic (DHCP, PPP, VPN, etc.)
240 nameservers to resolv.conf".</para>
241 </listitem>
242 <listitem>
243 <para><literal>ONBOOT</literal> -
244 initscripts use ONBOOT=yes to mark the devices that are to be activated
245 during boot. NetworkManager extends this to also mean that this profile
246 can be used for auto-connecting at any time.</para>
247 </listitem>
248 <listitem>
249 <para><literal>BOOTPROTO</literal> -
250 NetworkManager supports traditional values <emphasis>none</emphasis> (static),
251 <emphasis>dhcp</emphasis>. But it also allows additional values to
252 enable new addressing methods. They are <emphasis>autoip</emphasis> for IPv4
253 link-local addressing using Avahi daemon and <emphasis>shared</emphasis> for
254 connection sharing. When <emphasis>shared</emphasis> is used, NetworkManager
255 assigns the interface 10.42.0.1, or it uses the first static address,
256 if configured.</para>
257 </listitem>
258 <listitem>
259 <para><literal>HWADDR</literal> -
260 initscripts compare the currently set hardware address of a device, while
261 NetworkManager considers the permanent one.</para>
262 </listitem>
263 <listitem>
264 <para><literal>NOZEROCONF</literal> -
265 initscripts add an on-link route to 169.254.0.0/16 for ethernet profiles that don't
266 explicitly opt-out by setting <literal>NOZEROCONF</literal> variable. NetworkManager does
267 not do that. Instead a static, manual route with scope=253 (link) should be added to get
268 that behavior.</para>
269 </listitem>
270 </itemizedlist>
271 </para>
272 </listitem>
273 </varlistentry>
274 </variablelist>
275 </para>
276 <para>
277 See the next section for detailed mapping of NetworkManager properties and
278 <emphasis>ifcfg-rh</emphasis> variables. Variable names, format and usage
279 differences in NetworkManager and initscripts are documented in the tables below.
280 </para>
281 </refsect1>
282
283 <refsect1 id='details'><title>Details</title>
284 <para>
285 <emphasis>ifcfg-rh</emphasis> plugin variables marked with <emphasis>(+)</emphasis>
286 are NetworkManager specific extensions not understood by traditional initscripts.
287 </para>
288 <xsl:apply-templates />
289 <refsect2 id="secrets-flags">
290 <title>Secret flags</title>
291 <para>
292 Each secret property in a NetworkManager setting has an associated
293 <emphasis>flags</emphasis> property that describes how to handle that secret.
294 In the <emphasis>ifcfg-rh</emphasis> plugin variables for secret flags have a
295 <emphasis>_FLAGS</emphasis> suffix. The variables contain one or more of the
296 following values (space separated). Missing (or empty) *_FLAGS variable means
297 that the password is owned by NetworkManager.
298 </para>
299 <itemizedlist>
300 <listitem>
301 <para><literal>user</literal> - a user-session secret agent is responsible for providing
302 and storing this secret; when it is required, agents will be asked to provide it.</para>
303 </listitem>
304 <listitem>
305 <para><literal>ask</literal> - the associated password is not saved but it will be
306 requested from the user each time it is required.</para>
307 </listitem>
308 <listitem>
309 <para><literal>unused</literal> - in some situations it cannot be automatically determined
310 that a secret is required or not. This flag hints that the secret is not required and should
311 not be requested from the user.</para>
312 </listitem>
313 </itemizedlist>
314 </refsect2>
315 </refsect1>
316
317 <refsect1 id='files'><title>Files</title>
318 <para><filename>/etc/sysconfig/network-scripts/ifcfg-*</filename></para>
319 <para><filename>/etc/sysconfig/network-scripts/keys-*</filename></para>
320 <para><filename>/etc/sysconfig/network-scripts/route-*</filename></para>
321 <para><filename>/etc/sysconfig/network-scripts/route6-*</filename></para>
322 <para><filename>/usr/share/doc/initscripts/sysconfig.txt</filename></para>
323 </refsect1>
324 <refsect1 id='see_also'><title>See Also</title>
325 <para><link linkend='nm-settings-nmcli'><citerefentry><refentrytitle>nm-settings-nmcli</refentrytitle><manvolnum>5</manvolnum></citerefentry></link>,
326 <link linkend='nm-settings-keyfile'><citerefentry><refentrytitle>nm-settings-keyfile</refentrytitle><manvolnum>5</manvolnum></citerefentry></link>,
327 <link linkend='NetworkManager'><citerefentry><refentrytitle>NetworkManager</refentrytitle><manvolnum>8</manvolnum></citerefentry></link>,
328 <link linkend='NetworkManager.conf'><citerefentry><refentrytitle>NetworkManager.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></link>,
329 <link linkend='nmcli'><citerefentry><refentrytitle>nmcli</refentrytitle><manvolnum>1</manvolnum></citerefentry></link>,
330 <link linkend='nmcli-examples'><citerefentry><refentrytitle>nmcli-examples</refentrytitle><manvolnum>7</manvolnum></citerefentry></link></para>
331 </refsect1>
332 </refentry>
333 </xsl:template>
334
335 <xsl:template match="setting">
336 <xsl:variable name="setting_name" select="../@name"/>
337 <xsl:variable name="unsupported" select="'6lowpan, 802-11-olpc-mesh, adsl, bluetooth, cdma, dummy, generic, gsm, ip-tunnel, link, loopback, macsec, macvlan, ovs-bridge, ovs-dpdk, ovs-interface, ovs-patch, ovs-port, ppp, pppoe, serial, tun, veth, vpn, vrf, vxlan, wifi-p2p, wimax, wireguard, wpan'"/>
338 <xsl:if test="not (contains(concat(' ', $unsupported, ','), concat(' ', @name, ',')))">
339 <table>
340 <title><xsl:value-of select="@name"/> setting</title>
341 <tgroup cols="4">
342 <thead>
343 <row>
344 <entry>Property</entry>
345 <entry>Ifcfg-rh Variable</entry>
346 <entry>Default</entry>
347 <entry>Description</entry>
348 </row>
349 </thead>
350 <tbody>
351 <xsl:apply-templates/>
352 </tbody>
353 </tgroup>
354 </table>
355 </xsl:if>
356
357 <xsl:if test="@name = 'dcb'">
358 <para>
359 All DCB related configuration is a NetworkManager extension. DCB=yes must be
360 used explicitly to enable DCB so that the rest of the DCB_* variables can apply.
361 </para>
362 </xsl:if>
363
364 <xsl:if test="position() = last()">
365 <para>The following settings are not supported by <emphasis>ifcfg-rh</emphasis> plugin:</para>
366 <para><xsl:value-of select="$unsupported"/></para>
367 </xsl:if>
368 </xsl:template>
369
370 <xsl:template match="property">
371 <xsl:variable name="setting_name" select="../@name"/>
372
373
374 <row>
375 <entry align="left"><xsl:value-of select="@name"/></entry>
376 <entry align="left">
377 <xsl:call-template name="string-emphasize-all">
378 <xsl:with-param name="text" select="@variable"/>
379 <xsl:with-param name="emphasize" select="'(+)'"/>
380 </xsl:call-template>
381 </entry>
382 <entry align="left"><xsl:value-of select="@default"/></entry>
383 <entry align="left">
384 <xsl:value-of select="description"/><xsl:if test="@format = 'NMSettingSecretFlags'"> (see <xref linkend="secrets-flags"/> for _FLAGS values)</xsl:if>
385
386 <xsl:if test="string-length(@example)">
387 <emphasis role="bold">
388
389 Example: </emphasis><xsl:value-of select="@example"/>
390 </xsl:if>
391 <xsl:if test="string-length(@values)">
392 <emphasis role="bold">
393
394 Allowed values: </emphasis><xsl:value-of select="@values"/>
395 </xsl:if>
396 </entry>
397 </row>
398 </xsl:template>
399
400 <xsl:template name="string-emphasize-all">
401 <xsl:param name="text"/>
402 <xsl:param name="emphasize"/>
403 <xsl:choose>
404 <xsl:when test="contains($text, $emphasize)">
405 <xsl:value-of select="substring-before($text,$emphasize)"/>
406 <emphasis><xsl:value-of select="$emphasize"/></emphasis>
407 <xsl:call-template name="string-emphasize-all">
408 <xsl:with-param name="text" select="substring-after($text,$emphasize)"/>
409 <xsl:with-param name="emphasize" select="$emphasize"/>
410 </xsl:call-template>
411 </xsl:when>
412 <xsl:otherwise>
413 <xsl:value-of select="$text"/>
414 </xsl:otherwise>
415 </xsl:choose>
416 </xsl:template>
417
418 </xsl:stylesheet>