/[gentoo]/xml/htdocs/doc/en/handbook/hb-net-modules.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-net-modules.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download) (as text)
Wed Jul 20 06:18:51 2005 UTC (9 years, 2 months ago) by fox2mike
Branch: MAIN
Changes since 1.5: +5 -5 lines
File MIME type: application/xml
#99550 - Removing duplicate mention of dhclient. Version bumping as da, es, ja, pl, pt_br, ro and sv all have the same issue.  Thanks to pclouds for reporting.

1 swift 1.1 <?xml version="1.0" encoding="UTF-8"?>
2     <!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3    
4     <!-- The content of this document is licensed under the CC-BY-SA license -->
5 swift 1.2 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
6 swift 1.1
7 fox2mike 1.6 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-modules.xml,v 1.5 2005/06/14 18:34:32 neysx Exp $ -->
8 neysx 1.5
9 swift 1.1 <sections>
10    
11 fox2mike 1.6 <version>1.2</version>
12     <date>2005-07-20</date>
13 swift 1.1
14     <section>
15     <title>Network Modules</title>
16     <body>
17    
18     <p>
19     We now support modular networking scripts, which means we can easily
20     add support for new interface types and configuration modules while keeping
21     compatibility with existing ones.
22     </p>
23    
24     <p>
25     Modules load by default if the package they need is installed. If
26     you specify a module here that doesn't have its package installed
27     then you get an error stating which package you need to install.
28     Ideally, you only use the modules setting when you have two or more
29     packages installed that supply the same service and you need to prefer
30     one over the other.
31     </p>
32    
33     <pre caption="Module preference">
34     <comment># Prefer iproute2 over ifconfig</comment>
35     modules=( "iproute2" )
36    
37     <comment># You can also specify other modules for an interface
38     # In this case we prefer udhcpc over dhcpcd</comment>
39     modules_eth0=( "udhcpc" )
40    
41     <comment># You can also specify which modules not to use - for example you may be
42     # using a supplicant or linux-wlan-ng to control wireless configuration but
43     # you still want to configure network settings per ESSID associated with.</comment>
44     modules=( "!iwconfig" )
45     </pre>
46    
47     </body>
48     </section>
49     <section>
50     <title>Interface Handlers</title>
51     <body>
52    
53     <p>
54     We provide two interface handlers presently: ifconfig and iproute2.
55     You need one of these to do any kind of network configuration.
56     </p>
57    
58     <p>
59 swift 1.3 ifconfig is the current Gentoo default and it's included in the system profile.
60 swift 1.2 iproute2 is a more powerful and flexible package, but it's not included by
61     default.
62 swift 1.1 </p>
63    
64     <pre caption="To install iproute2">
65     # <i>emerge sys-apps/iproute2</i>
66    
67     <comment># To prefer iproute2 over ifconfig if both are installed</comment>
68     modules=( "iproute2" )
69     </pre>
70    
71     <p>
72 swift 1.2 As both ifconfig and iproute2 do very similar things we allow their basic
73     configuration to work with each other. For example both the below code
74     snippets work regardless of which module you are using.
75 swift 1.1 </p>
76    
77     <pre caption="ifconfig and iproute2 examples">
78     config_eth0=( "192.168.0.2/24" )
79     config_eth0=( "192.168.0.2 netmask 255.255.255.0" )
80    
81     <comment># We can also specify broadcast</comment>
82     config_eth0=( "192.168.0.2/24 brd 192.168.0.255" )
83     config_eth0=( "192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" )
84     </pre>
85    
86     </body>
87     </section>
88     <section id="dhcp">
89     <title>DHCP</title>
90     <body>
91    
92     <p>
93     DHCP is a means of obtaining network information (IP address, DNS servers,
94     Gateway, etc) from a DHCP server. This means that if there is a DHCP server
95     running on the network, you just have to tell each client to use DHCP and it
96     sets up the network all by itself. Of course, you will have to configure for
97     other things like wireless, ppp or other things if required before you can use
98     DHCP.
99     </p>
100    
101     <p>
102 fox2mike 1.6 DHCP can be provided by dhclient, dhcpcd, pump or udhcpc. Each DHCP module has
103     its pros and cons - here's a quick run down.
104 swift 1.1 </p>
105    
106     <table>
107 swift 1.2 <tr>
108     <th>DHCP Module</th>
109     <th>Package</th>
110     <th>Pros</th>
111     <th>Cons</th>
112     </tr>
113     <tr>
114     <ti>dhclient</ti>
115     <ti>net-misc/dhcp</ti>
116     <ti>
117 swift 1.3 Made by ISC, the same people who make the BIND DNS software. Very
118     configurable
119 swift 1.2 </ti>
120     <ti>
121 swift 1.3 Configuration is overly complex, software is quite bloated, cannot get
122     NTP servers from DHCP, does not send hostname by default
123 swift 1.2 </ti>
124     </tr>
125     <tr>
126     <ti>dhcpcd</ti>
127     <ti>net-misc/dhcpcd</ti>
128     <ti>
129 swift 1.3 Long time Gentoo default, no reliance on outside tools
130 swift 1.2 </ti>
131     <ti>
132 swift 1.3 No longer maintained upstream, can be slow at times, does not daemonize
133     when lease is infinite
134 swift 1.2 </ti>
135     </tr>
136     <tr>
137     <ti>pump</ti>
138     <ti>net-misc/pump</ti>
139     <ti>
140 swift 1.3 Lightweight, no reliance on outside tools
141 swift 1.2 </ti>
142     <ti>
143 swift 1.3 No longer maintained upstream, unreliable, especially over modems, cannot
144     get NIS servers from DHCP
145 swift 1.2 </ti>
146     </tr>
147     <tr>
148     <ti>udhcpc</ti>
149     <ti>net-misc/udhcp</ti>
150     <ti>
151 swift 1.3 Lightweight - smallest dhcp client around, made for embedded systems
152 swift 1.2 </ti>
153     <ti>
154 swift 1.3 Unproven - no distro uses it by default, cannot define a timeout beyond 3
155     seconds
156 swift 1.2 </ti>
157     </tr>
158 swift 1.1 </table>
159    
160     <p>
161     If you have more than one DHCP client installed, you need to specify which
162     one to use - otherwise we default to dhcpcd if available.
163     </p>
164    
165     <p>
166     To send specific options to the dhcp module, use module_eth0="..."
167     <e>(change module to the DHCP module you're using - ie dhcpcd_eth0)</e>
168     </p>
169    
170     <p>
171     We try and make DHCP relatively agnostic - as such we support the following
172     commands using the dhcp_eth0 variable. The default is not to set any of them
173     </p>
174    
175     <ul>
176     <li>release - releases the IP address for re-use</li>
177     <li>nodns - don't overwrite /etc/resolv.conf</li>
178     <li>nontp - don't overwrite /etc/ntp.conf</li>
179     <li>nonis - don't overwrite /etc/yp.conf</li>
180     </ul>
181    
182     <pre caption="Sample DHCP configuration in /etc/conf.d/net">
183     <comment># Only needed if you have more than one DHCP module installed</comment>
184     modules=( "dhcpcd" )
185    
186     config_eth0=( "dhcp" )
187     dhcpcd_eth0="-t 10" <comment># Timeout after 10 seconds</comment>
188     dhcp_eth0="release nodns nontp nonis" <comment># Only get an address</comment>
189     </pre>
190    
191     <note>
192     dhcpcd, udhcpc and pump send the current hostname to the DHCP server by
193     default so you don't need to specify this anymore.
194     </note>
195    
196     </body>
197     </section>
198     <section>
199     <title>ADSL Modem</title>
200     <body>
201    
202     <p>
203     First we need to install the ADSL software.
204     </p>
205    
206     <pre caption="Install the rp-pppoe package">
207     # <i>emerge net-dialup/rp-pppoe</i>
208     </pre>
209    
210     <warn>
211 swift 1.3 baselayout-1.11.x supports PPPOE only. Hopefully future versions will support
212     PPPOA.
213 swift 1.1 </warn>
214    
215     <p>
216     Now we need to instruct configure eth0 to be an ADSL interface and enter our
217     username.
218     </p>
219    
220     <pre caption="Configure eth0 for ADSL">
221     config_eth0=( "adsl" )
222     user_eth0="username"
223     </pre>
224    
225     <p>
226     Finally you need to define your username and password in
227     <path>/etc/ppp/pap-secrets</path>
228     </p>
229    
230     <pre caption="sample /etc/ppp/pap-secrets">
231     <comment># The * is important</comment>
232 swift 1.4 "username" * "password"
233 swift 1.1 </pre>
234    
235     </body>
236     </section>
237     <section id="apipa">
238     <title>APIPA (Automatic Private IP Addressing)</title>
239     <body>
240    
241     <p>
242     APIPA tries to find a free address in the range 169.254.0.0-169.254.255.255
243     by arping a random address in that range on the interface. If no reply is
244     found then we assign that address to the interface.
245     </p>
246    
247     <p>
248     This is only useful for LANs where there is no DHCP server and you don't
249     connect directly to the internet and all other computers use APIPA.
250     </p>
251    
252     <p>
253     For APIPA support, emerge net-misc/iputils or net-analyzer/arping
254     </p>
255    
256     <pre caption="APIPA configuration in /etc/conf.d/net">
257     <comment># Try DHCP first - if that fails then fallback to APIPA</comment>
258     config_eth0=( "dhcp" )
259     fallback_eth0=( "apipa" )
260    
261     <comment># Just use APIPA</comment>
262     config_eth0=( "apipa" )
263     </pre>
264    
265     </body>
266     </section>
267     <section>
268     <title>Bonding</title>
269     <body>
270    
271     <p>
272     For link bonding/trunking emerge net-misc/ifenslave
273     </p>
274    
275     <p>
276     Bonding is used to increase network bandwidth. If you have two network
277     cards going to the same network, you can bond them together so your
278     applications see just one interface but they really use both network cards.
279     </p>
280    
281     <pre caption="bonding configuration in /etc/conf.d/net">
282     <comment>To bond interfaces together</comment>
283     slaves_bond0="eth0 eth1 eth2"
284    
285     <comment># You may not want to assign an IP to the bonded interface</comment>
286     config_bond0=( "null" )
287    
288     <comment># Depend on eth0, eth1 and eth2 as they may require extra configuration</comment>
289     depend_bond0() {
290 swift 1.4 need net.eth0 net.eth1 net.eth2
291 swift 1.1 }
292     </pre>
293    
294     </body>
295     </section>
296     <section>
297     <title>Bridging (802.1d support)</title>
298     <body>
299    
300     <p>
301     For bridging support emerge net-misc/bridge-utils
302     </p>
303    
304     <p>
305     Bridging is used to join networks together. For example, you may have a
306     server that connects to the internet via an ADSL modem and a wireless
307     access card to enable other computers to connect to the internet via the
308     ADSL modem. You could create a bridge to join the two interfaces together.
309     </p>
310    
311     <pre caption="Bridge configuration in /etc/conf.d/net">
312     <comment># Configure the bridge - "man btctl" for more details</comment>
313     brctl_br0=( "setfd 0" "sethello 0" "stp off" )
314    
315     <comment># To add ports to bridge br0</comment>
316     bridge_br0="eth0 eth1"
317    
318     <comment># You need to configure the ports to null values so dhcp does not get started</comment>
319     config_eth0=( "null" )
320     config_eth1=( "null" )
321    
322     <comment># Finally give the bridge an address - you could use DHCP as well</comment>
323     config_br0=( "192.168.0.1/24" )
324    
325     <comment># Depend on eth0 and eth1 as they may require extra configuration</comment>
326     depend_br0() {
327 swift 1.4 need net.eth0 net.eth1
328 swift 1.1 }
329     </pre>
330    
331     <impo>
332     For using some bridge setups, you may need to consult the
333     <uri link="?part=3&amp;chap=2#variable_name">variable name</uri>
334     documentation.
335     </impo>
336    
337     </body>
338     </section>
339     <section>
340     <title>MAC Address</title>
341     <body>
342    
343     <p>
344     You don't need to emerge anything for changing the MAC address of your
345     interface if you change to a specific address. However, if you need to
346     change to a random address or a random address of a given type then you
347     need to emerge net-analyzer/macchanger.
348     </p>
349    
350     <pre caption="MAC Address change example">
351     <comment># To set the MAC address of the interface</comment>
352     mac_eth0="00:11:22:33:44:55"
353    
354     <comment># To randomize the last 3 bytes only</comment>
355     mac_eth0="random-ending"
356    
357     <comment># To randomize between the same physical type of connection (eg fibre,
358     # copper, wireless) , all vendors</comment>
359     mac_eth0="random-samekind"
360    
361     <comment># To randomize between any physical type of connection (eg fibre, copper,
362     # wireless) , all vendors</comment>
363     mac_eth0="random-anykind"
364    
365     <comment># Full randomization - WARNING: some MAC addresses generated by this may
366     # NOT act as expected</comment>
367     mac_eth0="random-full"
368     </pre>
369    
370     </body>
371     </section>
372     <section>
373     <title>Tunnelling</title>
374     <body>
375    
376     <p>
377     You don't need to emerge anything for tunnelling as the interface handler
378     can do it for you.
379     </p>
380    
381     <pre caption="Tunnelling configuration in /etc/conf.d/net">
382     <comment># For GRE tunnels</comment>
383     iptunnel_vpn0="mode gre remote 207.170.82.1 key 0xffffffff ttl 255"
384    
385     <comment># For IPIP tunnels</comment>
386     iptunnel_vpn0="mode ipip remote 207.170.82.2 ttl 255"
387    
388     <comment># To configure the interface</comment>
389     config_vpn0=( "192.168.0.2 peer 192.168.1.1" )
390     </pre>
391    
392     </body>
393     </section>
394     <section>
395     <title>VLAN (802.1q support)</title>
396     <body>
397    
398     <p>
399     For VLAN support, emerge net-misc/vconfig
400     </p>
401    
402 swift 1.2 <p>
403     Virtual LAN is a group of network devices that behave as if they were
404 swift 1.1 connected to a single network segment - even though they may not be.
405     VLAN members can only see members of the same VLAN even though they may
406     share the same physical network.
407     </p>
408    
409     <pre caption="VLAN configuration in /etc/conf.d/net">
410     <comment># Specify the VLAN numbers for the interface like so</comment>
411     <comment># Please ensure your VLAN IDs are NOT zero-padded</comment>
412     vlans_eth0="1 2"
413    
414     <comment># You can also configure the VLAN</comment>
415     <comment># see for vconfig man page for more details</comment>
416     vconfig_eth0=( "set_name_type VLAN_PLUS_VID_NO_PAD" )
417     vconfig_vlan1=( "set_flag 1" "set_egress_map 2 6" )
418    
419     <comment># Configure the interface as usual</comment>
420     config_vlan1=( "172.16.3.1 netmask 255.255.254.0" )
421     config_vlan2=( "172.16.2.1 netmask 255.255.254.0" )
422     </pre>
423    
424     <impo>
425     For using some VLAN setups, you may need to consult the
426     <uri link="?part=3&amp;chap=2#variable_name">variable name</uri>
427     documentation.
428     </impo>
429    
430     </body>
431     </section>
432    
433     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20