| … | |
… | |
| 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.5 --> |
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.16 2011/08/14 16:12:13 swift Exp $ --> |
7 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-net-advanced.xml,v 1.17 2011/08/17 08:05:11 swift Exp $ --> |
| 8 | |
8 | |
| 9 | <sections> |
9 | <sections> |
| 10 | |
10 | |
| 11 | <abstract> |
11 | <abstract> |
| 12 | Here we learn about how the configuration works - you need to know this |
12 | Here we learn about how the configuration works - you need to know this |
| 13 | before we learn about modular networking. |
13 | before we learn about modular networking. |
| 14 | </abstract> |
14 | </abstract> |
| 15 | |
15 | |
| 16 | <version>9</version> |
16 | <version>10</version> |
| 17 | <date>2011-08-13</date> |
17 | <date>2011-08-17</date> |
| 18 | |
18 | |
| 19 | <section> |
19 | <section> |
| 20 | <title>Advanced Configuration</title> |
20 | <title>Advanced Configuration</title> |
| 21 | <body> |
21 | <body> |
| 22 | |
22 | |
| … | |
… | |
| 73 | You can chain these commands together. Here are some real world examples. |
73 | You can chain these commands together. Here are some real world examples. |
| 74 | </p> |
74 | </p> |
| 75 | |
75 | |
| 76 | <pre caption="Configuration examples"> |
76 | <pre caption="Configuration examples"> |
| 77 | <comment># Adding three IPv4 addresses</comment> |
77 | <comment># Adding three IPv4 addresses</comment> |
| 78 | config_eth0=( |
78 | config_eth0="192.168.0.2/24 |
| 79 | "192.168.0.2/24" |
|
|
| 80 | "192.168.0.3/24" |
79 | 192.168.0.3/24 |
| 81 | "192.168.0.4/24" |
80 | 192.168.0.4/24" |
| 82 | ) |
|
|
| 83 | |
81 | |
| 84 | <comment># Adding an IPv4 address and two IPv6 addresses</comment> |
82 | <comment># Adding an IPv4 address and two IPv6 addresses</comment> |
| 85 | config_eth0=( |
83 | config_eth0="192.168.0.2/24 |
| 86 | "192.168.0.2/24" |
|
|
| 87 | "4321:0:1:2:3:4:567:89ab" |
84 | 4321:0:1:2:3:4:567:89ab |
| 88 | "4321:0:1:2:3:4:567:89ac" |
85 | 4321:0:1:2:3:4:567:89ac" |
| 89 | ) |
86 | ) |
| 90 | |
87 | |
| 91 | <comment># Keep our kernel assigned address, unless the interface goes |
88 | <comment># Keep our kernel assigned address, unless the interface goes |
| 92 | # down so assign another via DHCP. If DHCP fails then add a |
89 | # down so assign another via DHCP. If DHCP fails then add a |
| 93 | # static address determined by APIPA</comment> |
90 | # static address determined by APIPA</comment> |
| 94 | config_eth0=( |
91 | config_eth0="noop |
| 95 | "noop" |
|
|
| 96 | "dhcp" |
92 | dhcp" |
| 97 | ) |
|
|
| 98 | fallback_eth0=( |
93 | fallback_eth0="null |
| 99 | "null" |
|
|
| 100 | "apipa" |
94 | apipa" |
| 101 | ) |
95 | ) |
| 102 | </pre> |
96 | </pre> |
| 103 | |
97 | |
| 104 | <note> |
98 | <note> |
| 105 | When using the <c>ifconfig</c> module and adding more than one address, |
99 | When using the <c>ifconfig</c> module and adding more than one address, |
| … | |
… | |
| 162 | <pre caption="net.br0 dependency in /etc/conf.d/net"> |
156 | <pre caption="net.br0 dependency in /etc/conf.d/net"> |
| 163 | rc_need_br0="net.eth0 net.eth1" |
157 | rc_need_br0="net.eth0 net.eth1" |
| 164 | </pre> |
158 | </pre> |
| 165 | |
159 | |
| 166 | <p> |
160 | <p> |
|
|
161 | That alone, however, is not sufficient. Gentoo's networking init scripts use a |
|
|
162 | virtual dependency called <e>net</e> to inform the system when networking is |
|
|
163 | available. Clearly, in the above case, networking should only be marked as |
|
|
164 | available when <path>net.br0</path> is up, not when the others are. So we need |
|
|
165 | to tell that in <path>/etc/conf.d/net</path> as well: |
|
|
166 | </p> |
|
|
167 | |
|
|
168 | <pre caption="Updating virtual dependencies and provisions for networking"> |
|
|
169 | rc_net_lo_provide="!net" |
|
|
170 | rc_net_eth0_provide="!net" |
|
|
171 | rc_net_eth1_provide="!net" |
|
|
172 | </pre> |
|
|
173 | |
|
|
174 | <p> |
| 167 | For a more detailed discussion about dependency, consult the section <uri |
175 | For a more detailed discussion about dependency, consult the section <uri |
| 168 | link="?part=2&chap=4#doc_chap4">Writing Init Scripts</uri> in the Gentoo |
176 | link="?part=2&chap=4#doc_chap4">Writing Init Scripts</uri> in the Gentoo |
| 169 | Handbook. More information about <path>/etc/rc.conf</path> is available as |
177 | Handbook. More information about <path>/etc/rc.conf</path> is available as |
| 170 | comments within that file. |
178 | comments within that file. |
| 171 | </p> |
179 | </p> |