Gentoo Archives: gentoo-doc-cvs

From: "Sven Vermeulen (swift)" <swift@g.o>
To: gentoo-doc-cvs@l.g.o
Subject: [gentoo-doc-cvs] gentoo commit in xml/htdocs/doc/en/handbook: hb-install-config.xml hb-install-network.xml hb-net-advanced.xml hb-net-start.xml
Date: Mon, 06 May 2013 14:24:26
Message-Id: 20130506142420.B3A042171D@flycatcher.gentoo.org
1 swift 13/05/06 14:24:20
2
3 Modified: hb-install-config.xml hb-install-network.xml
4 hb-net-advanced.xml hb-net-start.xml
5 Log:
6 Fix bug #466262 - Document predictable naming of interfaces
7
8 Revision Changes Path
9 1.119 xml/htdocs/doc/en/handbook/hb-install-config.xml
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-config.xml?rev=1.119&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-config.xml?rev=1.119&content-type=text/plain
13 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-config.xml?r1=1.118&r2=1.119
14
15 Index: hb-install-config.xml
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-config.xml,v
18 retrieving revision 1.118
19 retrieving revision 1.119
20 diff -u -r1.118 -r1.119
21 --- hb-install-config.xml 23 Feb 2013 18:38:22 -0000 1.118
22 +++ hb-install-config.xml 6 May 2013 14:24:20 -0000 1.119
23 @@ -4,7 +4,7 @@
24 <!-- The content of this document is licensed under the CC-BY-SA license -->
25 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
26
27 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-config.xml,v 1.118 2013/02/23 18:38:22 swift Exp $ -->
28 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-config.xml,v 1.119 2013/05/06 14:24:20 swift Exp $ -->
29
30 <sections>
31
32 @@ -14,8 +14,8 @@
33 proceed.
34 </abstract>
35
36 -<version>24</version>
37 -<date>2013-02-23</date>
38 +<version>25</version>
39 +<date>2013-05-06</date>
40
41 <section>
42 <title>Filesystem Information</title>
43 @@ -298,6 +298,13 @@
44 to set both <c>config_eth0</c> and <c>routes_eth0</c>:
45 </p>
46
47 +<note>
48 +This assumes that your network interface will be called eth0. This is, however,
49 +very system dependent. It is recommended to assume that the interface is named
50 +the same as the interface name when booted from the installation media <e>if</e>
51 +the installation media is sufficiently recent.
52 +</note>
53 +
54 <pre caption="Manually setting IP information for eth0">
55 config_eth0="192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255"
56 routes_eth0="default via 192.168.0.1"
57 @@ -345,10 +352,33 @@
58
59 <p>
60 If you have several network interfaces, you need to create the appropriate
61 -<path>net.eth1</path>, <path>net.eth2</path> etc. just like you did with
62 -<path>net.eth0</path>.
63 +<path>net.*</path> files just like you did with <path>net.eth0</path>.
64 </p>
65
66 +<p>
67 +If you later find out the assumption about the network interface name (which we
68 +currently document as eth0) was wrong, then
69 +</p>
70 +
71 +<ol>
72 +<li>
73 +update the <path>/etc/conf.d/net</path> file with the correct interface name (like enp3s0
74 +instead of eth0),
75 +</li>
76 +<li>
77 +create new symbolic link (like <path>/etc/init.d/net.enp3s0</path>),
78 +</li>
79 +<li>
80 +remove the old symbolic link (<c>rm /etc/init.d/net.eth0</c>),
81 +</li>
82 +<li>
83 +add the new one to the default runlevel, and
84 +</li>
85 +<li>
86 +remove the old one using <c>rc-update del net.eth0 default</c>.
87 +</li>
88 +</ol>
89 +
90 </body>
91 </subsection>
92 <subsection>
93
94
95
96 1.57 xml/htdocs/doc/en/handbook/hb-install-network.xml
97
98 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-network.xml?rev=1.57&view=markup
99 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-network.xml?rev=1.57&content-type=text/plain
100 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-network.xml?r1=1.56&r2=1.57
101
102 Index: hb-install-network.xml
103 ===================================================================
104 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-network.xml,v
105 retrieving revision 1.56
106 retrieving revision 1.57
107 diff -u -r1.56 -r1.57
108 --- hb-install-network.xml 14 Jan 2013 06:00:45 -0000 1.56
109 +++ hb-install-network.xml 6 May 2013 14:24:20 -0000 1.57
110 @@ -4,7 +4,7 @@
111 <!-- The content of this document is licensed under the CC-BY-SA license -->
112 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
113
114 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-network.xml,v 1.56 2013/01/14 06:00:45 nightmorph Exp $ -->
115 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-network.xml,v 1.57 2013/05/06 14:24:20 swift Exp $ -->
116
117 <sections>
118
119 @@ -13,8 +13,8 @@
120 networking.
121 </abstract>
122
123 -<version>6</version>
124 -<date>2013-01-12</date>
125 +<version>7</version>
126 +<date>2013-05-06</date>
127
128 <section>
129 <title>Automatic Network Detection</title>
130 @@ -50,6 +50,18 @@
131 Interrupt:11 Base address:0xe800
132 </pre>
133
134 +<p>
135 +The interface name on your system can be quite different from eth0. Recent
136 +installation media might show regular network interfaces names like eno0, ens1
137 +or enp5s0. Just seek the interface in the <c>ifconfig</c> output that has an IP
138 +address related to your local network.
139 +</p>
140 +
141 +<p>
142 +In the remainder of this document, we will assume that the interface is called
143 +eth0.
144 +</p>
145 +
146 </body>
147 </subsection>
148 <subsection>
149 @@ -291,7 +303,8 @@
150
151 <p>
152 To check if your network card is now detected, use <c>ifconfig</c>. A
153 -detected network card would result in something like this:
154 +detected network card would result in something like this (again, eth0 here is
155 +just an example):
156 </p>
157
158 <pre caption="Testing availability of your network card, successful">
159 @@ -315,10 +328,18 @@
160 </pre>
161
162 <p>
163 -If you have multiple network cards in your system they are named <e>eth0</e>,
164 -<e>eth1</e>, etc. Make sure that the network card you want to use works well and
165 -remember to use the correct naming throughout this document. We will assume that
166 -the network card <e>eth0</e> is used.
167 +The available network interface names on your system can be listed through the
168 +<path>/sys</path> file system:
169 +</p>
170 +
171 +<pre caption="Viewing the available network interfaces">
172 +# <i>ls /sys/class/net</i>
173 +dummy0 eth0 lo sit0 tap0 wlan0
174 +</pre>
175 +
176 +<p>
177 +In the above example, 6 interfaces are found. The eth0 one is most likely the
178 +(wired) Ethernet adapter whereas wlan0 is the wireless one.
179 </p>
180
181 <p>
182
183
184
185 1.19 xml/htdocs/doc/en/handbook/hb-net-advanced.xml
186
187 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml?rev=1.19&view=markup
188 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml?rev=1.19&content-type=text/plain
189 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml?r1=1.18&r2=1.19
190
191 Index: hb-net-advanced.xml
192 ===================================================================
193 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml,v
194 retrieving revision 1.18
195 retrieving revision 1.19
196 diff -u -r1.18 -r1.19
197 --- hb-net-advanced.xml 19 Aug 2011 16:07:30 -0000 1.18
198 +++ hb-net-advanced.xml 6 May 2013 14:24:20 -0000 1.19
199 @@ -4,7 +4,7 @@
200 <!-- The content of this document is licensed under the CC-BY-SA license -->
201 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
202
203 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml,v 1.18 2011/08/19 16:07:30 swift Exp $ -->
204 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml,v 1.19 2013/05/06 14:24:20 swift Exp $ -->
205
206 <sections>
207
208 @@ -13,8 +13,8 @@
209 before we learn about modular networking.
210 </abstract>
211
212 -<version>11</version>
213 -<date>2011-08-19</date>
214 +<version>12</version>
215 +<date>2013-05-06</date>
216
217 <section>
218 <title>Advanced Configuration</title>
219 @@ -229,4 +229,134 @@
220
221 </body>
222 </section>
223 +<section>
224 +<title>Network Interface Naming</title>
225 +<subsection>
226 +<title>How It Works</title>
227 +<body>
228 +
229 +<p>
230 +Network interface names are not chosen arbitrarily: the Linux kernel and the
231 +device manager (most sytems have udev as their device manager although others
232 +are available as well) choose the interface name through a fixed set of rules.
233 +</p>
234 +
235 +<p>
236 +When an interface card is detected on a system, the Linux kernel gathers the
237 +necessary data about this card. This includes:
238 +</p>
239 +
240 +<ol>
241 + <li>
242 + the onboard (on the interface itself) registered name of the network card,
243 + which is later seen through the <c>ID_NET_NAME_ONBARD</c> parameter;
244 + </li>
245 + <li>
246 + the slot in which the network card is plugged in, which is later seen
247 + through the <c>ID_NET_NAME_SLOT</c> parameter;
248 + </li>
249 + <li>
250 + the path through which the network card device can be accessed, which is
251 + later seen through the <c>ID_NET_NAME_PATH</c> parameter;
252 + </li>
253 + <li>
254 + the (vendor-provided) MAC address of the card, which is later seen through
255 + the <c>ID_NET_NAME_MAC</c> parameter;
256 + </li>
257 +</ol>
258 +
259 +<p>
260 +Based on this information, the device manager decides how to name the interface
261 +on the system. By default, it uses the first hit of the above three parameters.
262 +For instance, if <c>ID_NET_NAME_ONBARD</c> is found and set to <c>eno1</c>, then
263 +the interface will be called eno1.
264 +</p>
265 +
266 +<p>
267 +If you know your interface name, you can see the values of the provided
268 +parameters using <c>udevadm</c>:
269 +</p>
270 +
271 +<pre caption="Reading the network interface card information">
272 +# <i>udevadm test-builtin net_id /sys/class/net/enp3s0 2>/dev/null</i>
273 +ID_NET_NAME_MAC=enxc80aa9429d76
274 +ID_OUI_FROM_DATABASE=Quanta Computer Inc.
275 +ID_NET_NAME_PATH=enp3s0
276 +</pre>
277 +
278 +<p>
279 +As the first (and actually only) hit of the top three parameters is the
280 +<c>ID_NET_NAME_PATH</c> one, its value is used as the interface name. If none of
281 +the parameters is found, then the system reverts back to the kernel-provided
282 +naming (eth0, eth1, etc.)
283 +</p>
284 +
285 +</body>
286 +</subsection>
287 +<subsection>
288 +<title>Using the Old-style Kernel Naming</title>
289 +<body>
290 +
291 +<p>
292 +Before this change, network interface cards were named by the Linux kernel
293 +itself, depending on the order that drivers are loaded (amongst other, possibly
294 +more obscure reasons). This behavior can still be enabled by setting the
295 +<c>net.ifnames=0</c> boot option in the boot loader.
296 +</p>
297 +
298 +<p>
299 +Another way of disabling this behavior (and thus reverting back to the
300 +kernel-provided naming) is to create an empty udev rule named
301 +<path>80-net-name-slot.rules</path> which will then override the default
302 +provided one (with the same name) that is responsible for taking care of network
303 +interface naming.
304 +</p>
305 +
306 +<pre caption="Overriding the network naming scheme">
307 +# <i>ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules</i>
308 +</pre>
309 +
310 +</body>
311 +</subsection>
312 +<subsection>
313 +<title>Using your Own Names</title>
314 +<body>
315 +
316 +<p>
317 +The entire idea behind the change in naming is not to confuse people, but to
318 +make changing the names easier. Suppose you have two interfaces that are
319 +otherwise called eth0 and eth1. One is meant to access the network through a
320 +wire, the other one is for wireless access. With the support for interface
321 +naming, you can have these called lan0 (wired) and wifi0 (wireless - it is best
322 +to avoid using the previously well-known names like eth* and wlan* as those can
323 +still collide with your suggested names).
324 +</p>
325 +
326 +<p>
327 +All you need to do is to find out what the parameters are for the cards and then
328 +use this information to set up your own naming rule:
329 +</p>
330 +
331 +<pre caption="Setting the lan0 name for the current eth0 interface">
332 +# <i>udevadm test-builtin net_id /sys/class/net/eth0 2>/dev/null</i>
333 +ID_NET_NAME_MAC=enxc80aa9429d76
334 +ID_OUI_FROM_DATABASE=Quanta Computer Inc.
335 +
336 +# <i>vim /etc/udev/rules.d/70-net-name-use-custom.rules</i>
337 +<comment># First one uses MAC information</comment>
338 +SUBSYSTEM=="net", ACTION=="add", ENV{ID_NET_NAME_MAC}=="enxc80aa9429d76", NAME="lan0"
339 +<comment># Second one uses ID_NET_NAME_PATH information</comment>
340 +SUBSYSTEM=="net", ACTION=="add", ENV{ID_NET_NAME_PATH}=="enp3s0", NAME="wifi0"
341 +</pre>
342 +
343 +<p>
344 +Because the rules are triggered before the default one (rules are triggered in
345 +alphanumerical order, so 70 comes before 80) the names provided in the rule file
346 +will be used instead of the default ones.
347 +</p>
348 +
349 +</body>
350 +</subsection>
351 +</section>
352 +
353 </sections>
354
355
356
357 1.12 xml/htdocs/doc/en/handbook/hb-net-start.xml
358
359 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-net-start.xml?rev=1.12&view=markup
360 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-net-start.xml?rev=1.12&content-type=text/plain
361 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-net-start.xml?r1=1.11&r2=1.12
362
363 Index: hb-net-start.xml
364 ===================================================================
365 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-start.xml,v
366 retrieving revision 1.11
367 retrieving revision 1.12
368 diff -u -r1.11 -r1.12
369 --- hb-net-start.xml 29 Jun 2012 15:32:13 -0000 1.11
370 +++ hb-net-start.xml 6 May 2013 14:24:20 -0000 1.12
371 @@ -4,7 +4,7 @@
372 <!-- The content of this document is licensed under the CC-BY-SA license -->
373 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
374
375 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-start.xml,v 1.11 2012/06/29 15:32:13 swift Exp $ -->
376 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-start.xml,v 1.12 2013/05/06 14:24:20 swift Exp $ -->
377
378 <sections>
379
380 @@ -13,8 +13,8 @@
381 environments.
382 </abstract>
383
384 -<version>10</version>
385 -<date>2012-06-29</date>
386 +<version>11</version>
387 +<date>2013-05-06</date>
388
389 <section>
390 <title>Getting started</title>
391 @@ -24,13 +24,14 @@
392 This document assumes that you have correctly configured your kernel, its
393 modules for your hardware and you know the interface name of your hardware.
394 We also assume that you are configuring <c>eth0</c>, but it could also be
395 -<c>eth1</c>, <c>wlan0</c>, etc.
396 +<c>eno0</c>, <c>ens1</c>, <c>wlan0</c>, <c>enp1s0</c> etc.
397 </note>
398
399 <p>
400 To get started configuring your network card, you need to tell the Gentoo RC
401 system about it. This is done by creating a symbolic link from
402 -<path>net.lo</path> to <path>net.eth0</path> in <path>/etc/init.d</path>.
403 +<path>net.lo</path> to <path>net.eth0</path> (or whatever the network interface
404 +name is on your system) in <path>/etc/init.d</path>.
405 </p>
406
407 <pre caption="Symlinking net.eth0 to net.lo">