]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - share/man/man4/ng_one2many.4
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / share / man / man4 / ng_one2many.4
1 .\" Copyright (c) 2000 Whistle Communications, Inc.
2 .\" All rights reserved.
3 .\"
4 .\" Subject to the following obligations and disclaimer of warranty, use and
5 .\" redistribution of this software, in source or object code forms, with or
6 .\" without modifications are expressly permitted by Whistle Communications;
7 .\" provided, however, that:
8 .\" 1. Any and all reproductions of the source or object code must include the
9 .\"    copyright notice above and the following disclaimer of warranties; and
10 .\" 2. No rights are granted, in any manner or form, to use Whistle
11 .\"    Communications, Inc. trademarks, including the mark "WHISTLE
12 .\"    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
13 .\"    such appears in the above copyright notice or in the software.
14 .\"
15 .\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
16 .\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
17 .\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
18 .\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
19 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
20 .\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
21 .\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
22 .\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
23 .\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
24 .\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
25 .\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26 .\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
27 .\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
28 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 .\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
31 .\" OF SUCH DAMAGE.
32 .\"
33 .\" Author: Archie Cobbs <archie@FreeBSD.org>
34 .\"
35 .\" $FreeBSD$
36 .\"
37 .Dd February 19, 2006
38 .Dt NG_ONE2MANY 4
39 .Os
40 .Sh NAME
41 .Nm ng_one2many
42 .Nd packet multiplexing netgraph node type
43 .Sh SYNOPSIS
44 .In sys/types.h
45 .In netgraph/ng_one2many.h
46 .Sh DESCRIPTION
47 The
48 .Nm one2many
49 provides a simple mechanism for routing packets over several links
50 in a one-to-many (and in the reverse direction, many-to-one) fashion.
51 There is a single hook named
52 .Dv one ,
53 and multiple hooks named
54 .Dv many0 ,
55 .Dv many1 ,
56 etc.
57 Packets received on any of the
58 .Dv many
59 hooks are forwarded out the
60 .Dv one
61 hook.
62 Packets received on the
63 .Dv one
64 hook are forwarded out one or more of the
65 .Dv many
66 hooks; which hook(s) is determined by the node's configured
67 transmit algorithm.
68 Packets are not altered in any way.
69 .Pp
70 Each of the connected many links may be considered to be up or down.
71 Packets are never delivered out a many hook that is down.
72 How a link is determined to be up or down depends on the node's
73 configured link failure detection algorithm.
74 .Pp
75 Before an interface or link can be plumbed into a group, its status
76 must be marked as being
77 .Dq up .
78 This is normally setup during the initial boot stages by
79 .Xr rc.conf 5 .
80 It is also possible to change an interface's status to
81 .Dq up
82 by using the
83 .Xr ifconfig 8
84 utility.
85 .Sh TRANSMIT ALGORITHMS
86 .Bl -tag -width foo
87 .It Dv NG_ONE2MANY_XMIT_ROUNDROBIN
88 Packets are delivered out the many hooks in sequential order.
89 Each packet goes out on a different
90 .Dv many
91 hook.
92 .It Dv NG_ONE2MANY_XMIT_ALL
93 Packets are delivered out all the
94 .Dv many
95 hooks.
96 Each packet goes out each
97 .Dv many
98 hook.
99 .El
100 .Pp
101 In the future other algorithms may be added as well.
102 .Sh LINK FAILURE DETECTION
103 The node distinguishes between active and failed links.
104 Data is sent only to active links.
105 The following link failure detection algorithms are available:
106 .Bl -tag -width indent
107 .It Dv NG_ONE2MANY_FAIL_MANUAL
108 The node is explicitly told which of the links are up via the
109 .Dv NGM_ONE2MANY_SET_CONFIG
110 control message (see below).
111 Newly connected links are down until configured otherwise.
112 .It Dv NG_ONE2MANY_FAIL_NOTIFY
113 The node listens to flow control message from
114 .Va many
115 hooks, and considers link failed if
116 .Dv NGM_LINK_IS_DOWN
117 is received.
118 If the
119 .Dv NGM_LINK_IS_UP
120 message is received, node considers link active.
121 .El
122 .Pp
123 In the future other algorithms may be added as well.
124 .Pp
125 When all links are considered failed, node sends the
126 .Dv NGM_LINK_IS_DOWN
127 message towards the
128 .Va one
129 hook.
130 When at least one link comes up, node sends the
131 .Dv NGM_LINK_IS_UP
132 message towards the
133 .Va one
134 hook.
135 .Sh HOOKS
136 This node type supports up to
137 .Dv NG_ONE2MANY_MAX_LINKS
138 hooks named
139 .Dv many0 ,
140 .Dv many1 ,
141 etc.,
142 plus a single hook named
143 .Dv one .
144 .Sh CONTROL MESSAGES
145 This node type supports the generic control messages, plus the
146 following:
147 .Bl -tag -width foo
148 .It Dv NGM_ONE2MANY_SET_CONFIG
149 Sets the node configuration using a
150 .Dv "struct ng_one2many_link_config"
151 as the control message argument:
152 .Bd -literal
153 /* Node configuration structure */
154 struct ng_one2many_config {
155   u_int32_t   xmitAlg;        /* how to distribute packets */
156   u_int32_t   failAlg;        /* how to detect link failure */
157   u_char      enabledLinks[NG_ONE2MANY_MAX_LINKS];
158 };
159 .Ed
160 .Pp
161 Currently, the valid settings for the
162 .Dv xmitAlg
163 field are
164 .Dv NG_ONE2MANY_XMIT_ROUNDROBIN
165 (default) or
166 .Dv NG_ONE2MANY_XMIT_ALL .
167 The valid settings for
168 .Dv failAlg
169 are
170 .Dv NG_ONE2MANY_FAIL_MANUAL
171 (default) or
172 .Dv NG_ONE2MANY_FAIL_NOTIFY .
173 .It Dv NGM_ONE2MANY_GET_CONFIG
174 Returns the current node configuration in a
175 .Dv "struct ng_one2many_link_config" .
176 .It Dv NGM_ONE2MANY_GET_STATS
177 This command takes a 32 bit link number as an argument and
178 returns a
179 .Dv "struct ng_one2many_link_stats"
180 containing statistics for the corresponding
181 .Dv many
182 link, which may or may not be currently connected:
183 .Bd -literal
184 /* Statistics structure (one for each link) */
185 struct ng_one2many_link_stats {
186   u_int64_t   recvOctets;     /* total octets rec'd on link */
187   u_int64_t   recvPackets;    /* total pkts rec'd on link */
188   u_int64_t   xmitOctets;     /* total octets xmit'd on link */
189   u_int64_t   xmitPackets;    /* total pkts xmit'd on link */
190 };
191 .Ed
192 .Pp
193 To access statistics for the
194 .Dv one
195 link, use the link number
196 .Dv -1 .
197 .It Dv NGM_ONE2MANY_CLR_STATS
198 This command takes a 32 bit link number as an argument and
199 clears the statistics for that link.
200 .It Dv NGM_ONE2MANY_GETCLR_STATS
201 Same as
202 .Dv NGM_ONE2MANY_GET_STATS ,
203 but also atomically clears the statistics for the link as well.
204 .El
205 .Sh SHUTDOWN
206 This node shuts down upon receipt of a
207 .Dv NGM_SHUTDOWN
208 control message, or when all hooks have been disconnected.
209 .Sh EXAMPLES
210 The following commands will set up Ethernet interfaces
211 .Dv fxp0
212 to deliver packets alternating over the physical interfaces
213 corresponding to networking interfaces
214 .Dv fxp0
215 through
216 .Dv fxp3 :
217 .Bd -literal
218   # Plumb nodes together
219
220   ngctl mkpeer fxp0: one2many upper one
221   ngctl connect fxp0: fxp0:upper lower many0
222   ngctl connect fxp1: fxp0:upper lower many1
223   ngctl connect fxp2: fxp0:upper lower many2
224   ngctl connect fxp3: fxp0:upper lower many3
225
226   # Allow fxp1 through fxp3 to xmit/recv fxp0 frames
227
228   ngctl msg fxp1: setpromisc 1
229   ngctl msg fxp2: setpromisc 1
230   ngctl msg fxp3: setpromisc 1
231   ngctl msg fxp1: setautosrc 0
232   ngctl msg fxp2: setautosrc 0
233   ngctl msg fxp3: setautosrc 0
234
235   # Configure all four links as up
236
237   ngctl msg fxp0:upper \\
238     setconfig "{ xmitAlg=1 failAlg=1 enabledLinks=[ 1 1 1 1 ] }"
239
240   # Bring up interface
241
242   ifconfig fxp0 192.168.1.1 netmask 0xfffffffc
243 .Ed
244 .Pp
245 With a similar setup on a peer machine (using the address
246 192.168.1.2), a point-to-point
247 Ethernet connection with four times normal bandwidth is
248 achieved.
249 .Sh SEE ALSO
250 .Xr netgraph 4 ,
251 .Xr ng_bridge 4 ,
252 .Xr ng_ether 4 ,
253 .Xr ng_hub 4 ,
254 .Xr ifconfig 8 ,
255 .Xr ngctl 8
256 .Sh HISTORY
257 The
258 .Nm
259 node type was implemented in
260 .Fx 4.2 .
261 .Sh AUTHORS
262 .An -nosplit
263 The
264 .Nm one2many
265 netgraph node (with round-robin algorithm) was written by
266 .An Archie Cobbs
267 .Aq archie@FreeBSD.org .
268 The all algorithm was added by
269 .An Rogier R. Mulhuijzen
270 .Aq drwilco@drwilco.net .
271 .Sh BUGS
272 More transmit and link failure algorithms should be supported.
273 A good candidate is Cisco's Etherchannel.