| 1 | <?xml version="1.0" encoding="UTF-8"?> |
1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE sections SYSTEM "/dtd/book.dtd"> |
2 | <!DOCTYPE sections SYSTEM "/dtd/book.dtd"> |
| 3 | |
3 | |
| 4 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
4 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
| 5 | <!-- See http://creativecommons.org/licenses/by-sa/2.0 --> |
5 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
| 6 | |
6 | |
| 7 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml,v 1.4 2005/06/13 07:03:41 swift Exp $ --> |
7 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml,v 1.5 2005/06/14 09:47:20 swift Exp $ --> |
| 8 | |
8 | |
| 9 | <sections> |
9 | <sections> |
| 10 | |
10 | |
| 11 | <version>1.1</version> |
11 | <version>1.1</version> |
| 12 | <date>2005-06-09</date> |
12 | <date>2005-06-09</date> |
| … | |
… | |
| 25 | <p> |
25 | <p> |
| 26 | Here's a list of in-built instructions. |
26 | Here's a list of in-built instructions. |
| 27 | </p> |
27 | </p> |
| 28 | |
28 | |
| 29 | <table> |
29 | <table> |
| 30 | <tr> |
30 | <tr> |
| 31 | <th>Command</th> |
31 | <th>Command</th> |
| 32 | <th>Description</th> |
32 | <th>Description</th> |
| 33 | </tr> |
33 | </tr> |
| 34 | <tr> |
34 | <tr> |
| 35 | <ti>null</ti> |
35 | <ti>null</ti> |
| 36 | <ti>Do nothing</ti> |
36 | <ti>Do nothing</ti> |
| 37 | </tr> |
37 | </tr> |
| 38 | <tr> |
38 | <tr> |
| 39 | <ti>noop</ti> |
39 | <ti>noop</ti> |
| 40 | <ti> |
40 | <ti> |
| 41 | If the interface is up and there is an address then abort configuration |
41 | If the interface is up and there is an address then abort configuration |
| 42 | successfully |
42 | successfully |
| 43 | </ti> |
43 | </ti> |
| 44 | </tr> |
44 | </tr> |
| 45 | <tr> |
45 | <tr> |
| 46 | <ti>an IPv4 or IPv6 address</ti> |
46 | <ti>an IPv4 or IPv6 address</ti> |
| 47 | <ti>Add the address to the interface</ti> |
47 | <ti>Add the address to the interface</ti> |
| 48 | </tr> |
48 | </tr> |
| 49 | <tr> |
49 | <tr> |
| 50 | <ti> |
50 | <ti> |
| 51 | dhcp, adsl or apipa<br/> |
|
|
| 52 | (or a custom command from a 3rd party module) |
51 | dhcp, adsl or apipa (or a custom command from a 3rd party module) |
| 53 | </ti> |
52 | </ti> |
| 54 | <ti> |
53 | <ti> |
| 55 | Run the module which provides the command. For example "dhcp" will |
54 | Run the module which provides the command. For example "dhcp" will |
| 56 | run a module that provides dhcp which can be one of either dhcpcd, |
55 | run a module that provides dhcp which can be one of either dhcpcd, |
| 57 | udhcpc, dhclient or pump. |
56 | udhcpc, dhclient or pump. |
| 58 | </ti> |
57 | </ti> |
| 59 | </tr> |
58 | </tr> |
| 60 | </table> |
59 | </table> |
| 61 | |
60 | |
| 62 | <p> |
61 | <p> |
| 63 | If a command fails, you can specify a fallback command. The fallback has to |
62 | If a command fails, you can specify a fallback command. The fallback has to |
| 64 | match the config structure exactly. |
63 | match the config structure exactly. |
| … | |
… | |
| 99 | <note> |
98 | <note> |
| 100 | When using the ifconfig module and adding more than one address, interface |
99 | When using the ifconfig module and adding more than one address, interface |
| 101 | aliases are created for each extra address. So with the above two examples you |
100 | aliases are created for each extra address. So with the above two examples you |
| 102 | will get interfaces eth0, eth0:1 and eth0:2. |
101 | will get interfaces eth0, eth0:1 and eth0:2. |
| 103 | You cannot do anything special with these interfaces as the kernel and other |
102 | You cannot do anything special with these interfaces as the kernel and other |
| 104 | programs will just treat eth0:1 and eth0:2 as eth0 |
103 | programs will just treat eth0:1 and eth0:2 as eth0. |
| 105 | </note> |
104 | </note> |
| 106 | |
105 | |
| 107 | <impo> |
106 | <impo> |
| 108 | The fallback order is important! If we did not specify the "null" option then |
107 | The fallback order is important! If we did not specify the "null" option then |
| 109 | the "apipa" command would only be run if the "noop" command failed. |
108 | the "apipa" command would only be run if the "noop" command failed. |
| 110 | </impo> |
109 | </impo> |
| 111 | |
110 | |
| 112 | <note> |
111 | <note> |
| 113 | <uri link="?part=4&chap=3#apipa">APIPA</uri> and |
112 | <uri link="?part=4&chap=3#apipa">APIPA</uri> and |
| 114 | <uri link="?part=4&chap=3#dhcp">DHCP</uri> are discussed later |
113 | <uri link="?part=4&chap=3#dhcp">DHCP</uri> are discussed later. |
| 115 | </note> |
114 | </note> |
| 116 | |
115 | |
| 117 | </body> |
116 | </body> |
| 118 | </section> |
117 | </section> |
| 119 | |
118 | |
| 120 | <section> |
119 | <section> |
| 121 | <title>Network Dependencies</title> |
120 | <title>Network Dependencies</title> |
| 122 | <body> |
121 | <body> |
| 123 | |
122 | |
|
|
123 | <p> |
| 124 | <p>Init scripts in <path>/etc/init.d</path> can depend on a specific network |
124 | Init scripts in <path>/etc/init.d</path> can depend on a specific network |
| 125 | interface or just net. "net" can be defined in <path>/etc/conf.d/rc</path> to |
125 | interface or just net. "net" can be defined in <path>/etc/conf.d/rc</path> to |
| 126 | mean different things using the <c>RC_NET_STRICT_CHECKING</c> variable. |
126 | mean different things using the <c>RC_NET_STRICT_CHECKING</c> variable. |
| 127 | </p> |
127 | </p> |
| 128 | |
128 | |
| 129 | <table> |
129 | <table> |
| 130 | <tr> |
130 | <tr> |
| 131 | <th>Value</th> |
131 | <th>Value</th> |
| 132 | <th>Description</th> |
132 | <th>Description</th> |
| 133 | </tr> |
133 | </tr> |
| 134 | <tr> |
134 | <tr> |
| 135 | <ti>none</ti> |
135 | <ti>none</ti> |
| 136 | <ti>The net service is always considered up</ti> |
136 | <ti>The net service is always considered up</ti> |
| 137 | </tr> |
137 | </tr> |
| 138 | <tr> |
138 | <tr> |
| 139 | <ti>no</ti> |
139 | <ti>no</ti> |
| 140 | <ti> |
140 | <ti> |
| 141 | This basically means that at least one net.* service besides net.lo |
141 | This basically means that at least one net.* service besides net.lo |
| 142 | must be up. This can be used by notebook users that have a wifi and |
142 | must be up. This can be used by notebook users that have a wifi and |
| 143 | a static nic, and only wants one up at any given time to have the |
143 | a static nic, and only wants one up at any given time to have the |
| 144 | net service seen as up. |
144 | net service seen as up. |
| 145 | </ti> |
145 | </ti> |
| 146 | </tr> |
146 | </tr> |
| 147 | <tr> |
147 | <tr> |
| 148 | <ti>lo</ti> |
148 | <ti>lo</ti> |
| 149 | <ti> |
149 | <ti> |
| 150 | This is the same as the 'no' option, but net.lo is also counted. |
150 | This is the same as the 'no' option, but net.lo is also counted. |
| 151 | This should be useful to people that do not care about any specific |
151 | This should be useful to people that do not care about any specific |
| 152 | interface being up at boot. |
152 | interface being up at boot. |
| 153 | </ti> |
153 | </ti> |
| 154 | </tr> |
154 | </tr> |
| 155 | <tr> |
155 | <tr> |
| 156 | <ti>yes</ti> |
156 | <ti>yes</ti> |
| 157 | <ti> |
157 | <ti> |
| 158 | For this ALL network interfaces MUST be up for the 'net' service to |
158 | For this ALL network interfaces MUST be up for the 'net' service to |
| 159 | be considered up. |
159 | be considered up. |
| 160 | </ti> |
160 | </ti> |
| 161 | </tr> |
161 | </tr> |
| 162 | </table> |
162 | </table> |
| 163 | |
163 | |
| 164 | <p> |
164 | <p> |
| 165 | But what about net.br0 depending on net.eth0 and net.eth1? |
165 | But what about net.br0 depending on net.eth0 and net.eth1? |
| 166 | net.eth1 may be a wireless or ppp device that needs configuration before it |
166 | net.eth1 may be a wireless or ppp device that needs configuration before it |
| … | |
… | |
| 201 | connects to the essid "essid". |
201 | connects to the essid "essid". |
| 202 | </p> |
202 | </p> |
| 203 | |
203 | |
| 204 | <p> |
204 | <p> |
| 205 | However, there is no hard and fast rule that states interface names must be |
205 | However, there is no hard and fast rule that states interface names must be |
| 206 | ethx. In fact, many wireless interfaces have names like wlanx, rax as well as ethx. |
206 | ethx. In fact, many wireless interfaces have names like wlanx, rax as well as |
| 207 | Also, some user defined interfaces such as bridges can be given any name, such |
207 | ethx. Also, some user defined interfaces such as bridges can be given any name, |
| 208 | as foo. To make life more interesting, wireless Access Points can have names with |
208 | such as foo. To make life more interesting, wireless Access Points can have |
| 209 | non alpha-numeric characters in them - this is important because you can configure |
209 | names with non alpha-numeric characters in them - this is important because |
| 210 | networking parameters per ESSID. |
210 | you can configure networking parameters per ESSID. |
| 211 | </p> |
211 | </p> |
| 212 | |
212 | |
| 213 | <p> |
213 | <p> |
| 214 | The downside of all this is that Gentoo uses bash variables for networking - |
214 | The downside of all this is that Gentoo uses bash variables for networking - |
| 215 | and bash cannot use anything outside of English alpha-numerics. To get around |
215 | and bash cannot use anything outside of English alpha-numerics. To get around |