/[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.3 - (hide annotations) (download) (as text)
Tue Jun 14 10:07:18 2005 UTC (9 years, 6 months ago) by swift
Branch: MAIN
Changes since 1.2: +18 -25 lines
File MIME type: application/xml
Remove use of <br/>s

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

  ViewVC Help
Powered by ViewVC 1.1.20