|
Lines 8-25
Link Here
|
| 8 |
|
8 |
|
| 9 |
<sections> |
9 |
<sections> |
| 10 |
|
10 |
|
| 11 |
<version>1.3</version> |
11 |
<version>1.4</version> |
| 12 |
<date>2005-08-14</date> |
12 |
<date>2005-12-21</date> |
| 13 |
|
13 |
|
| 14 |
<section> |
14 |
<section> |
| 15 |
<title>Advanced Configuration</title> |
15 |
<title>Advanced Configuration</title> |
| 16 |
<body> |
16 |
<body> |
| 17 |
|
17 |
|
| 18 |
<p> |
18 |
<p> |
| 19 |
The config_eth0 variable is the heart of an interface's configuration. It's a |
19 |
The <c>config_eth0</c> variable is the heart of an interface configuration. It's |
| 20 |
high level instruction list for configuring the interface (eth0 in this case). |
20 |
a high level instruction list for configuring the interface (<c>eth0</c> in this |
| 21 |
Each command in the instruction list is performed sequentially. The interface is |
21 |
case). Each command in the instruction list is performed sequentially. The |
| 22 |
deemed OK if at least one command works. |
22 |
interface is deemed OK if at least one command works. |
| 23 |
</p> |
23 |
</p> |
| 24 |
|
24 |
|
| 25 |
<p> |
25 |
<p> |
|
Lines 32-42
Link Here
|
| 32 |
<th>Description</th> |
32 |
<th>Description</th> |
| 33 |
</tr> |
33 |
</tr> |
| 34 |
<tr> |
34 |
<tr> |
| 35 |
<ti>null</ti> |
35 |
<ti><c>null</c></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><c>noop</c></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 |
|
Lines 48-59
Link Here
|
| 48 |
</tr> |
48 |
</tr> |
| 49 |
<tr> |
49 |
<tr> |
| 50 |
<ti> |
50 |
<ti> |
| 51 |
dhcp, adsl or apipa (or a custom command from a 3rd party module) |
51 |
<c>dhcp</c>, <c>adsl</c> or <c>apipa</c> (or a custom command from a 3rd |
|
|
52 |
party module) |
| 52 |
</ti> |
53 |
</ti> |
| 53 |
<ti> |
54 |
<ti> |
| 54 |
Run the module which provides the command. For example "dhcp" will run a |
55 |
Run the module which provides the command. For example <c>dhcp</c> will run |
| 55 |
module that provides dhcp which can be one of either dhcpcd, udhcpc, |
56 |
a module that provides DHCP which can be one of either <c>dhcpcd</c>, |
| 56 |
dhclient or pump. |
57 |
<c>udhcpc</c>, <c>dhclient</c> or <c>pump</c>. |
| 57 |
</ti> |
58 |
</ti> |
| 58 |
</tr> |
59 |
</tr> |
| 59 |
</table> |
60 |
</table> |
|
Lines 96-111
Link Here
|
| 96 |
</pre> |
97 |
</pre> |
| 97 |
|
98 |
|
| 98 |
<note> |
99 |
<note> |
| 99 |
When using the ifconfig module and adding more than one address, interface |
100 |
When using the <c>ifconfig</c> module and adding more than one address, |
| 100 |
aliases are created for each extra address. So with the above two examples you |
101 |
interface aliases are created for each extra address. So with the above two |
| 101 |
will get interfaces eth0, eth0:1 and eth0:2. You cannot do anything special with |
102 |
examples you will get interfaces <c>eth0</c>, <c>eth0:1</c> and <c>eth0:2</c>. |
| 102 |
these interfaces as the kernel and other programs will just treat eth0:1 and |
103 |
You cannot do anything special with these interfaces as the kernel and other |
| 103 |
eth0:2 as eth0. |
104 |
programs will just treat <c>eth0:1</c> and <c>eth0:2</c> as <c>eth0</c>. |
| 104 |
</note> |
105 |
</note> |
| 105 |
|
106 |
|
| 106 |
<impo> |
107 |
<impo> |
| 107 |
The fallback order is important! If we did not specify the "null" option then |
108 |
The fallback order is important! If we did not specify the <c>null</c> option |
| 108 |
the "apipa" command would only be run if the "noop" command failed. |
109 |
then the <c>apipa</c> command would only be run if the <c>noop</c> command |
|
|
110 |
failed. |
| 109 |
</impo> |
111 |
</impo> |
| 110 |
|
112 |
|
| 111 |
<note> |
113 |
<note> |
|
Lines 121-128
Link Here
|
| 121 |
|
123 |
|
| 122 |
<p> |
124 |
<p> |
| 123 |
Init scripts in <path>/etc/init.d</path> can depend on a specific network |
125 |
Init scripts in <path>/etc/init.d</path> can depend on a specific network |
| 124 |
interface or just net. "net" can be defined in <path>/etc/conf.d/rc</path> to |
126 |
interface or just net. <c>net</c> can be defined in <path>/etc/conf.d/rc</path> |
| 125 |
mean different things using the <c>RC_NET_STRICT_CHECKING</c> variable. |
127 |
to mean different things using the <c>RC_NET_STRICT_CHECKING</c> variable. |
| 126 |
</p> |
128 |
</p> |
| 127 |
|
129 |
|
| 128 |
<table> |
130 |
<table> |
|
Lines 131-173
Link Here
|
| 131 |
<th>Description</th> |
133 |
<th>Description</th> |
| 132 |
</tr> |
134 |
</tr> |
| 133 |
<tr> |
135 |
<tr> |
| 134 |
<ti>none</ti> |
136 |
<ti><c>none</c></ti> |
| 135 |
<ti>The net service is always considered up</ti> |
137 |
<ti>The <path>net</path> service is always considered up</ti> |
| 136 |
</tr> |
138 |
</tr> |
| 137 |
<tr> |
139 |
<tr> |
| 138 |
<ti>no</ti> |
140 |
<ti><c>no</c></ti> |
| 139 |
<ti> |
141 |
<ti> |
| 140 |
This basically means that at least one net.* service besides net.lo must be |
142 |
This basically means that at least one <path>net.*</path> service besides |
| 141 |
up. This can be used by notebook users that have a wifi and a static nic, |
143 |
<path>net.lo</path> must be up. This can be used by notebook users that |
| 142 |
and only wants one up at any given time to have the net service seen as up. |
144 |
have a WIFI and a static NIC, and only wants one up at any given time to |
|
|
145 |
have the net service seen as up. |
| 143 |
</ti> |
146 |
</ti> |
| 144 |
</tr> |
147 |
</tr> |
| 145 |
<tr> |
148 |
<tr> |
| 146 |
<ti>lo</ti> |
149 |
<ti><c>lo</c></ti> |
| 147 |
<ti> |
150 |
<ti> |
| 148 |
This is the same as the 'no' option, but net.lo is also counted. This should |
151 |
This is the same as the <c>no</c> option, but <path>net.lo</path> is also |
| 149 |
be useful to people that do not care about any specific interface being up |
152 |
counted. This should be useful to people that do not care about any specific |
| 150 |
at boot. |
153 |
interface being up at boot. |
| 151 |
</ti> |
154 |
</ti> |
| 152 |
</tr> |
155 |
</tr> |
| 153 |
<tr> |
156 |
<tr> |
| 154 |
<ti>yes</ti> |
157 |
<ti><c>yes</c></ti> |
| 155 |
<ti> |
158 |
<ti> |
| 156 |
For this ALL network interfaces MUST be up for the 'net' service to be |
159 |
For this ALL network interfaces MUST be up for the <path>net</path> service |
| 157 |
considered up. |
160 |
to be considered up. |
| 158 |
</ti> |
161 |
</ti> |
| 159 |
</tr> |
162 |
</tr> |
| 160 |
</table> |
163 |
</table> |
| 161 |
|
164 |
|
| 162 |
<p> |
165 |
<p> |
| 163 |
But what about net.br0 depending on net.eth0 and net.eth1? net.eth1 may be a |
166 |
But what about <path>net.br0</path> depending on <path>net.eth0</path> and |
| 164 |
wireless or ppp device that needs configuration before it can be added to the |
167 |
<path>net.eth1</path>? <path>net.eth1</path> may be a wireless or PPP device |
| 165 |
bridge. This cannot be done in <path>/etc/init.d/net.br0</path> as that's a |
168 |
that needs configuration before it can be added to the bridge. This cannot be |
| 166 |
symbolic link to net.lo |
169 |
done in <path>/etc/init.d/net.br0</path> as that's a symbolic link to |
|
|
170 |
<path>net.lo</path>. |
| 167 |
</p> |
171 |
</p> |
| 168 |
|
172 |
|
| 169 |
<p> |
173 |
<p> |
| 170 |
The answer is making your own depend() function in <path>/etc/conf.d/net</path>. |
174 |
The answer is making your own <c>depend()</c> function in |
|
|
175 |
<path>/etc/conf.d/net</path>. |
| 171 |
</p> |
176 |
</p> |
| 172 |
|
177 |
|
| 173 |
<pre caption="net.br0 dependency in /etc/conf.d/net"> |
178 |
<pre caption="net.br0 dependency in /etc/conf.d/net"> |
|
Lines 195-201
Link Here
|
| 195 |
<c>variable_${interface|mac|essid|apmac}</c>. For example, the variable |
200 |
<c>variable_${interface|mac|essid|apmac}</c>. For example, the variable |
| 196 |
<c>dhcpcd_eth0</c> holds the value for dhcpcd options for eth0 and |
201 |
<c>dhcpcd_eth0</c> holds the value for dhcpcd options for eth0 and |
| 197 |
<c>dhcpcd_essid</c> holds the value for dhcpcd options when any interface |
202 |
<c>dhcpcd_essid</c> holds the value for dhcpcd options when any interface |
| 198 |
connects to the essid "essid". |
203 |
connects to the ESSID "essid". |
| 199 |
</p> |
204 |
</p> |
| 200 |
|
205 |
|
| 201 |
<p> |
206 |
<p> |
|
Lines 211-223
Link Here
|
| 211 |
The downside of all this is that Gentoo uses bash variables for networking - |
216 |
The downside of all this is that Gentoo uses bash variables for networking - |
| 212 |
and bash cannot use anything outside of English alpha-numerics. To get around |
217 |
and bash cannot use anything outside of English alpha-numerics. To get around |
| 213 |
this limitation we change every character that is not an English alpha-numeric |
218 |
this limitation we change every character that is not an English alpha-numeric |
| 214 |
into a _ character. |
219 |
into a <c>_</c> character. |
| 215 |
</p> |
220 |
</p> |
| 216 |
|
221 |
|
| 217 |
<p> |
222 |
<p> |
| 218 |
Another downside of bash is the content of variables - some characters need to |
223 |
Another downside of bash is the content of variables - some characters need to |
| 219 |
be escaped. This can be achived by placing the \ character in front of the |
224 |
be escaped. This can be achived by placing the <c>\</c> character in front of |
| 220 |
character that needs to be escaped. The following list of characters needs |
225 |
the character that needs to be escaped. The following list of characters needs |
| 221 |
to be escaped in this way: <c>"</c>, <c>'</c> and <c>\</c>. |
226 |
to be escaped in this way: <c>"</c>, <c>'</c> and <c>\</c>. |
| 222 |
</p> |
227 |
</p> |
| 223 |
|
228 |
|