root/trunk/etcnet/docs/etcnet.8

Revision 1344, 14.9 kB (checked in by pilot, 1 year ago)

+ fix style

Line 
1 .TH "etcnet" "8" "0.9" "Denis Ovsienko <info@etcnet.org>" "Linux network configuration"
2 .SH "NAME"
3 /etc/net \- basic and advanced network configuration in Linux
4 .SH "SYNOPSIS"
5 .TP
6 ifup <interface>
7 .TP
8 ifdown <interface>
9 .TP
10 service network <start|stop|restart|reload...>
11 .SH "DESCRIPTION"
12 /etc/net is a network configuration system. It should be both simple
13 to use for a beginner and powerful for expert. First of all you have
14 to describe your network options and interfaces in a set of
15 configuration files. Once you are done, you should be able to control
16 state of your host with 3 scripts: ifup, ifdown, network.init.
17 .SH "SYSTEM CONFIGURATION"
18 /etc/net ships in default configuration, which is suitable for many cases. Linux distributions can customize default installation even further, but there are things that only you can configure. /etc/net keeps its configuration in files, most of which reside in /etc/net (literally) directory.
19 .IP "/etc/net/options.d"
20 This directory by default keeps 00\-default file. There can be other files here, they will be read in alphabet order.
21 .IP /etc/net/sysctl.conf
22 sysctl startup file
23 .IP "/etc/net/ipv4rule ???"
24 ip rules startup table ('ip \-4 rule add' args)
25 .IP /etc/net/vlantab
26 VLAN mass\-configuration table. If you need to configure lots of simple VLAN interfaces, this is the right place. See VLANTAB SYNTAX for details.
27 .IP /etc/net/iftab
28 Interface mappings table, optional, but strictly advised to have. This file is used by ifrename. iftab file format is described in iftab manpage. Please note that we don't use /etc/iftab, but keep our own /etc/net/iftab. This difference allows to keep /etc/net\-specific filenames with profile and host suffixes under a single directory without creating additional mess in /etc. Additionally it prevents the system from accidental interface name change after ifrename invocation.
29 .IP /etc/net/hosttab
30 This optional file can be used during MULTIHOST CONFIGURATION.
31 .IP /etc/net/ifup\-pre
32 If exists and is executable, is run before ANY interface is up, but after it is created.
33 .IP /etc/net/ifup\-post
34 If exists and is executable, is run after ANY interface is completely up and running.
35 .IP /etc/net/ifdown\-pre
36 If exists and is executable, is run before ANY interface is going to be shutdown.
37 .IP /etc/net/ifdown\-post
38 If exists and is executable, is run after ANY interface is completely gone.
39 .IP /etc/net/netup\-pre
40 If exists and is executable, is run before starting network.
41 .IP /etc/net/netup\-post
42 If exists and is executable, is run after starting network.
43 .IP /etc/net/netdown\-pre
44 If exists and is executable, is run before stopping network.
45 .IP /etc/net/netdown\-post
46 If exists and is executable, is run after stopping network.
47 .SH "INTERFACE CONFIGURATION"
48 To complete interface configuration one should perform the following steps for each
49 network interface found at Linux host:
50 .TP
51 Invent a descriptive name for the interface and place appropriate line
52 into /etc/net/iftab. Note that some restrictions apply:
53 PPP interfaces can only be named pppXXX, TEQL interfaces shouldn't be renamed due
54 to a bug in kernel code. Skystar DVB kernel code isn't stable at all.
55 .TP
56 Create interface configuration directory /etc/net/ifaces/<NAME>
57 .TP
58 Fill it with configuration files accordingly to INTERFACE DIRECTORY LAYOUT.
59 .SH "INTERFACE GROUPS"
60 There are 5 interface groups in /etc/net model:
61 .IP "virtual"
62 Self\-consistent interfaces, currently loopback and dummy. They very seldom require other interfaces and require no hardware, therefore chances are high to bring them up.
63 .IP "real physical"
64 Interfaces, corresponding to real hardware: pure Ethernet, PLIP, USB Ethernet adapters and DVB. You cannot bring them up, if there is no hardware present.
65 .IP "hosted physical"
66 Something between physical and logical type. This group includes: VLAN, bonding, bridges and traffic equalizers. These interfaces don't directly use hardware, but are built from one ore more 'host' real physical interfaces. If host interface is missing, hosted interfaces can't be brought up.
67 .IP "independent logical"
68 This group includes IP and IPSec tunnels. Tunnels are stateless, they are much like virtual group, but sometimes they depend on lower\-level interfaces indirectly.
69 .IP "dependent logical"
70 This group currently consists of PPP interfaces, including PPPoE/PPtP ones. Their well known property is to disconnect on timeouts, so this group has the most chances to fail.
71 .LP
72 When network is being started, /etc/net puts interfaces in appropriate group and processes groups from virtual to dependent logical. When network is being stopped, groups are processed in reverse order. This order results in less failures, than simple processing from A to Z. You don't have to specify interface group anywhere, it is computed from interface type.
73 .SH "INTERFACE DIRECTORY LAYOUT"
74 Unless explicitly stated, each configuration file contains 1 item per line (options, addresses, routes etc.). You have to create files for each feature you want to use. If file is missing, the feature will not be configured.
75 .IP options
76 Main options file. This file is required. See etcnet\-options manpage for list of options available.
77 .IP iplink
78 List of 'ip link' commands. If you need to change interface MTU or PROMISC flag, this is the right place to do it. If you want to to have a specific MAC address on the board, you can place "address xx:xx:xx:xx:xx:xx" into this file. This file is not required.
79 .IP ipneigh
80 List of 'ip ne' commands, can be used to control ARP table, e.g. add static ARP entries. This file is not required.
81 .IP ipv4address
82 List of IPv4 addresses for current interface. This file is not required, but often used.
83 .IP ipv4route
84 List of IPv4 routes for current interface. This file is not required, but often used.
85 .IP ipv4rule
86 List of IPv4 routing rules for current interface. You will need this file only if you install routes into multiple routing tables. This file is not required.
87 .IP ipv6address
88 List of IPv6 addresses for current interface. This file is not required.
89 .IP ipv6route
90 List of IPv6 routes for current interface. This file is not required.
91 .IP iwconfig
92 List of iwconfig commands. This file is only required for WiFi WEP.
93 .IP wpa_supplicant.conf
94 wpa_supplicant configuration file. This file is only required for WiFi WPA.
95 .IP brctl
96 List of brctl commands. This file is only used by bridges and is not required.
97 .IP ethtool
98 List of ethtool commands. This file is only useful for Ethernet interfaces and is not required.
99 .IP ipx_interface
100 List of 'ipx_interface add' arguments. This file is required for IPX interfaces.
101 .IP sysctl.conf
102 List of sysctl options, which will be processed after interface is up. Lookup SMART SYSCTL SUPPORT. This file is optional.
103 .IP resolv.conf
104 Resolver configuration. This file will be copied to /etc/resolv.conf after interface is up. This file is optional.
105 .IP ifup\-pre
106 If exists and is executable, is run before CURRENT interface is up, but after it is created.
107 .IP ifup\-post
108 If exists and is executable, is run after CURRENT interface is completely up and running.
109 .IP ifdown\-pre
110 If exists and is executable, is run before CURRENT interface is going to be shutdown.
111 .IP ifdown\-post
112 If exists and is executable, is run after CURRENT interface is completely gone.
113 .IP pppoptions
114 This optional file contains additional pppd options for PPP interfaces.
115 .IP pppinit
116 This optional file contains chat (not shell) script for modem initialization.
117 .IP pppconnect
118 This optional file contains chat (not shell) script to connect to remote node (e.g. dial a number).
119 .IP pppdisconnect
120 This optional file contains chat (not shell) script to disconnect from remote node (e.g. hang up).
121
122 .LP
123 The interface directory can contain 2 special directories: 'fw' and 'qos'. They are used for
124 firewall and QoS configuration respectively. For QoS configuration manual see etcnet\-qos(8).
125 .SH "SPECIAL INTERFACES"
126 /etc/net is shipped with 3 existing interfaces:
127 .IP lo
128 This is a must for a Linux host. Loopback interface comes in configuration, suitable for most cases.
129 .IP default
130 This is really not an interface, but interface template. 'default' interface forms initial set of options for all interfaces and it doesn't belong to any interface group. This interface allows placing an additional options file into configuration directory: options\-<TYPE>. This optional file has effect ONLY for 'default' interface, it allows to override default options with type\-specific options.
131 It is not recommended to change options for 'default' interface. Each interface can add extra options or override existing options, if needed.
132 .IP unknown
133 This is a special interface, which is used each time /etc/net can't find a suitable configuration, but is requested to do. This interface's purpose is to help configure hotplug interfaces, which don't yet have a configuration.
134 .SH "SMART SYSCTL SUPPORT"
135 /etc/net handles several sysctl.conf files:
136 .IP  /etc/net/sysctl.conf
137 Processed at startup, no autoprefix.
138 .IP  /etc/net/ifaces/default/sysctl.conf
139 Processed at ifup, no autoprefix.
140 .IP  /etc/net/ifaces/default/sysctl.conf\-$TYPE
141 Processed at ifup, with autoprefix.
142 .IP  /etc/net/ifaces/XXXXXX/sysctl.conf
143 Processed at ifup, with autoprefix.
144 .LP
145 Autoprefix means that if fully specified variables (like in a traditional /etc/sysctl.conf file)
146 is met, it will be processed as is, but for single word variables like rp_filter or forwarding
147 appropriate prefix will be tried to find. Autoprefix works only for interface sysctl.conf and
148 type\-specific sysctl.conf.
149 .SH "RECURSION AND DEPENDENCIES"
150 Some interfaces require other interfaces to be up for proper initialization. Some
151 dependencies are calculated automaticaly, but some need to be configured manually.
152 If interface A has REQUIRES=B in it's options file, A is the child, B is the parent.
153 There are 6 options to control dependencies resolution:
154 .IP HOST=<interface>
155 .IP REQUIRES='<interface>\ [<interface>\ [<interface>...]]'
156 .IP IFUP_PARENTS=<boolean>
157 .IP IFDOWN_PARENTS=<boolean>
158 .IP IFUP_CHILDREN=<boolean>
159 .IP IFDOWN_CHILDREN=<boolean>
160 .LP
161 Those options are described in etcnet\-options(5) manpage.
162 NOTE:
163 Interfaces from vlantab bypass traditional logic,
164 they can't cause parent/child interface to become up/down. If parent interface
165 is down at the moment of vlantab processing (ONBOOT=no or misconfiguration), all
166 child VLAN interfaces will be just skipped.
167 .LP
168 In most cases (if ever) the task will be done by proper REQUIRES option.
169 .SH "VLANTAB SYNTAX"
170 vlantab provides a way to bulk\-configure VLAN interfaces with only IPv4 address
171 at each interface. For each VLAN interface you have to place a line:
172 .IP "<host interface> <VLAN ID>"
173 Create VLAN interface and automatically name it according to VLAN_NAMETYPE option value.
174 .IP "<host interface> <VLAN ID> <VLAN interface name>"
175 Create VLAN interface with specified name.
176 .IP "<host interface> <VLAN ID> <VLAN interface name> <'ip address' arguments>"
177 Create VLAN interface with specified name and run 'ip address' with specified arguments.
178 .SH "HOSTTAB SYNTAX"
179 This file holds aliases for hostnames. If your hostname is long or unconvinient, you can define an alias here. This alias can be used for tagging files. One hostname should be referenced by one alias only. File format:
180 .nf
181 <hostname1><space><alias1>
182 <hostname2><space><alias2>
183 <hostname3><space><alias3>
184 <hostname4><space><alias4>
185 <hostname5><space><alias5>
186 .SH "FILENAMES (FIXME)"
187 /etc/net scripts implement support for separate namespaces in a single configuration
188 tree. This is achieved though special suffixes, which are used depending on current values
189 of network profile and network host.
190 .SH "CONFIGURATION PROFILES"
191 A profile is a configuration superset. E.g. when a notebook boots up in
192 several different networks, it's desirable to select current configuration
193 by just one parameter. Current profile name can be set via:
194 .TP
195 1. environment variable NETPROFILE (not a good idea I guess)
196 .TP
197 2. file /etc/net/profile (file should contain just one word, e.g. "office" w/o quotes)
198 .TP
199 3. kernel boot parameter "netprofile", e.g. "LILO: linux netprofile=home"
200 .LP
201 Specifying a profile does nothing by default. But if etcnet scripts know the
202 current profile name (e.g. "home") and look for a configuration file (e.g. "options")
203 and "options#home" exists, then "options#home" will be used instead of "options".
204 The same for ipv4address, ipv4route, ipv4rule, ipv6address, iplink and so on).
205
206 Now if you want to boot the same host in two different networks, you will most
207 probably have to create additional ipv4address#yourprofilename for another address
208 and ipv4route#yourprofilename for another default route. Same for resolv.conf,
209 I guess.
210
211 Next example: booting two different hosts from the same HDD (root fs). The same as
212 previous, but additional options#yourprofilename and iftab#yourprofilename for the
213 different network card.
214
215 To switch between configurations without editing /etc/net/profile one can use:
216 .TP
217 # service etcnet startwith office
218 .TP
219 # service etcnet restartwith home
220 .LP
221 If 'selectprofile' executable script exists in iface directory, it will be run with a
222 single argument, which defines current stage of (de)configuration sequence. If you
223 want to override current profile name during runtime, you should perform required
224 actions in this script and print profile name to stdout. Since this script will be run
225 several times and runtime detection can take certain time to complete, it is advised
226 that the script should perform actions only at certain stages. 'selectprofile' will
227 always get calling script name as the first parameter, so you can skip trying to
228 detect wireless AP before the kernel module is even loaded, for example. See
229 /etc/net/ifaces/default/selectprofile for sample implementation.
230
231 As of /etc/net\-0.5.3 init_netprofile is called only from {ifup,ifdown}.*,
232 {setup,shutdown}\-.* and network.init scripts.
233 .SH "MULTIHOST CONFIGURATION (FIXME)"
234 You can create a single configuration tree and distribute it across multiple hosts. If you mark
235 .SH "ENVIRONMENT"
236 .IP NETHOST
237 This variable can hold host ID in multi\-host configuration, which should be used instead of automatically detected.
238 .IP NETPROFILE
239 This variable can hold configuration profile name, which should be used instead of automatically detected.
240 .SH "BUGS"
241 .TP
242 Some kernels have problems with many VLAN interfaces.
243 .TP
244 teql interfaces can't be safely renamed.
245 .TP
246 VLAN interfaces sometimes are initialized into wrong state.
247 .TP
248 Some network drivers have race condition in interface init code, so 'mac' iftab match does not work.
249 .TP
250 ppp interfaces can only be named ppp%d.
251 .TP
252 SkyStar DVB interfaces can only be named dvb*.
253 .TP
254 DHCP does not work for bonding.
255 .TP
256 ppp option 'demand' can hang /etc/net startup forever
257 .TP
258 CONFIG_IPV6 must be on to configure 6\-to\-4 (TYPE=iptun, TUNTYPE=sit) tunnels correctly
259 .TP
260 If you configure dummy interfaces, 'dummy0' interface name must be always unused.
261 .TP
262 Bonding interface name can't be same as another kernel module name.
263 .SH "SEE ALSO"
264 .BR ip(8),
265 .BR tc(8),
266 .BR etcnet\-options(5),
267 .BR etcnet\-qos(8),
268 .BR etcnet\-fw(8),
269 .BR ifrename(8),
270 .BR iftab(5)
Note: See TracBrowser for help on using the browser.