]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/ng_one2many.4
This commit was generated by cvs2svn to compensate for changes in r151208,
[FreeBSD/FreeBSD.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 November 23, 2004
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 only valid setting for
168 .Dv failAlg
169 is
170 .Dv NG_ONE2MANY_FAIL_MANUAL ;
171 this is also the default setting.
172 .It Dv NGM_ONE2MANY_GET_CONFIG
173 Returns the current node configuration in a
174 .Dv "struct ng_one2many_link_config" .
175 .It Dv NGM_ONE2MANY_GET_STATS
176 This command takes a 32 bit link number as an argument and
177 returns a
178 .Dv "struct ng_one2many_link_stats"
179 containing statistics for the corresponding
180 .Dv many
181 link, which may or may not be currently connected:
182 .Bd -literal
183 /* Statistics structure (one for each link) */
184 struct ng_one2many_link_stats {
185   u_int64_t   recvOctets;     /* total octets rec'd on link */
186   u_int64_t   recvPackets;    /* total pkts rec'd on link */
187   u_int64_t   xmitOctets;     /* total octets xmit'd on link */
188   u_int64_t   xmitPackets;    /* total pkts xmit'd on link */
189 };
190 .Ed
191 .Pp
192 To access statistics for the
193 .Dv one
194 link, use the link number
195 .Dv -1 .
196 .It Dv NGM_ONE2MANY_CLR_STATS
197 This command takes a 32 bit link number as an argument and
198 clears the statistics for that link.
199 .It Dv NGM_ONE2MANY_GETCLR_STATS
200 Same as
201 .Dv NGM_ONE2MANY_GET_STATS ,
202 but also atomically clears the statistics for the link as well.
203 .El
204 .Sh SHUTDOWN
205 This node shuts down upon receipt of a
206 .Dv NGM_SHUTDOWN
207 control message, or when all hooks have been disconnected.
208 .Sh EXAMPLES
209 The following commands will set up Ethernet interfaces
210 .Dv fxp0
211 to deliver packets alternating over the physical interfaces
212 corresponding to networking interfaces
213 .Dv fxp0
214 through
215 .Dv fxp3 :
216 .Bd -literal
217   # Plumb nodes together
218
219   ngctl mkpeer fxp0: one2many upper one
220   ngctl connect fxp0: fxp0:upper lower many0
221   ngctl connect fxp1: fxp0:upper lower many1
222   ngctl connect fxp2: fxp0:upper lower many2
223   ngctl connect fxp3: fxp0:upper lower many3
224
225   # Allow fxp1 through fxp3 to xmit/recv fxp0 frames
226
227   ngctl msg fxp1: setpromisc 1
228   ngctl msg fxp2: setpromisc 1
229   ngctl msg fxp3: setpromisc 1
230   ngctl msg fxp1: setautosrc 0
231   ngctl msg fxp2: setautosrc 0
232   ngctl msg fxp3: setautosrc 0
233
234   # Configure all four links as up
235
236   ngctl msg fxp0:upper \\
237     setconfig "{ xmitAlg=1 failAlg=1 enabledLinks=[ 1 1 1 1 ] }"
238
239   # Bring up interface
240
241   ifconfig fxp0 192.168.1.1 netmask 0xfffffffc
242 .Ed
243 .Pp
244 With a similar setup on a peer machine (using the address
245 192.168.1.2), a point-to-point
246 Ethernet connection with four times normal bandwidth is
247 achieved.
248 .Sh SEE ALSO
249 .Xr netgraph 4 ,
250 .Xr ng_bridge 4 ,
251 .Xr ng_ether 4 ,
252 .Xr ng_hub 4 ,
253 .Xr ifconfig 8 ,
254 .Xr ngctl 8
255 .Sh HISTORY
256 The
257 .Nm
258 node type was implemented in
259 .Fx 4.2 .
260 .Sh AUTHORS
261 .An -nosplit
262 The
263 .Nm one2many
264 netgraph node (with round-robin algorithm) was written by
265 .An Archie Cobbs
266 .Aq archie@FreeBSD.org .
267 The all algorithm was added by
268 .An Rogier R. Mulhuijzen
269 .Aq drwilco@drwilco.net .
270 .Sh BUGS
271 More transmit and link failure algorithms should be supported.
272 A good candidate is Cisco's Etherchannel.