1 2.\" $NetBSD: lagg.4,v 1.1 2021/05/17 04:07:42 yamaguchi Exp $ 3.\" 4.\" Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org> 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.\" 19.\" Copyright (C) 2021 Internet Initiative Japan Inc. 20.\" All rights reserved. 21.\" 22.\" Redistribution and use in source and binary forms, with or without 23.\" modification, are permitted provided that the following conditions 24.\" are met: 25.\" 1. Redistributions of source code must retain the above copyright 26.\" notice, this list of conditions and the following disclaimer. 27.\" 2. Redistributions in binary form must reproduce the above copyright 28.\" notice, this list of conditions and the following disclaimer in the 29.\" documentation and/or other materials provided with the distribution. 30.\" 3. Neither the name of the project nor the names of its contributors 31.\" may be used to endorse or promote products derived from this software 32.\" without specific prior written permission. 33.\" 34.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 35.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 37.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 38.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 40.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 41.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 42.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 43.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 44.\" SUCH DAMAGE. 45.\" 46.Dd April 2, 2020 47.Dt LAGG 4 48.Os 49.Sh NAME 50.Nm lagg 51.Nd link aggregation and link failover interface 52.Sh SYNOPSIS 53.Cd "pseudo-device lagg" 54.Sh DESCRIPTION 55The 56.Nm 57interface allows aggregation of multiple network interfaces as one virtual 58.Nm 59interface for the purpose of providing fault-tolerance and high-speed links. 60.Pp 61A 62.Nm 63interface can be created using the 64.Ic ifconfig lagg Ns Ar N Ic create 65command. 66It can use different link aggregation protocols specified 67using the 68.Ic laggproto Ar proto 69option. 70Child interfaces can be added using the 71.Ic laggport Ar child-iface 72option and removed using the 73.Ic -laggport Ar child-iface 74option. 75A priority of each child interface can be configured using the 76.Ic laggport Ar child-iface pri Ar N 77or 78.Ic laggportpri Ar child-iface Ar N 79option. 80The interface preferentially uses the child interface that is 81the smallest numeric in the priority. 82.Pp 83The driver currently supports the aggregation protocols 84.Ic failover, 85.Ic loadbalance , 86.Ic lacp , 87and 88.Ic none 89(the default). 90The protocols determine which ports are used for outgoing traffic 91and whether a specific port accepts incoming traffic. 92The interface link state is used to validate if the port is active or 93not. 94.Bl -tag -width loadbalance 95.It Ic failover 96Sends traffic only through the active port that is the highest priority. 97When the same priority is configured, 98The first interface added is used for sending traffic. 99If the link-state of the sending port becomes down, 100The next priority port is used. 101.Pp 102Received traffic is accepted through all active port 103if 104.Ic laggfailover Nm rx-all 105option is enabled. 106The option is enabled by default, and it can be 107disabled by 108.Ic laggfailover Nm -rx-all 109option. 110If the option is disabled, received traffic is only accepted 111through the sending port. 112.It Ic loadbalance 113Balances outgoing traffic across the active ports based on hashed 114protocol header information and accepts incoming traffic from 115any active port. 116This is a static setup and does not negotiate aggregation with the peer or 117exchange frames to monitor the link. 118The hash includes the Ethernet source and destination address, and, if 119available, the VLAN tag, and the IP source and destination address. 120.It Ic lacp 121Supports the IEEE 802.1AX (formerly 802.3ad) Link Aggregation Control Protocol 122(LACP) and the Marker Protocol. 123LACP will nagotiate a set of aggregable links wit the peer in to a Link 124Aggregated Group. 125The LAG is composed of ports of the diffrent speed, set to full-duplex operation, 126if 127.Ic lagglacp Nm multi-speed 128option is configured. 129The function can be disabled by 130.Ic lagglacp Nm \-multi-speed 131option. 132Outgoing traffic across the distributing ports based on hashed 133protocol header information and accepts incoming traffic from 134any collecting port. 135The maximum number of active ports in a LAG can be configured by 136.Ic lagglacp Nm maxports Ar N 137option. 138.It Ic none 139THis protocol is intended to do nothing: it disables any traffic without 140disabling the 141.Nm 142interface itself. 143.El 144.Pp 145Each 146.Nm 147interface is created at runtime using interface cloing. 148This is 149most easily done with the 150.Xr ifconfig 8 151.Cm create 152command. 153.Pp 154The MTU of the first interface to be added is used as the lagg MTU. 155All additional interfaces are required to have exactly the same value. 156.Pp 157.Sh EXAMPLES 158Create a link aggregation using LACP with two 159.Xr wm 4 160Gigabit Ethernet interfaces: 161.Bd -literal -offset indent 162# ifconfig wm0 up 163# ifconfig wm1 up 164# ifconfig lagg0 create 165# ifconfig lagg0 laggproto lacp laggport wm0 laggport wm1 \e 166 192.168.1.1 netmask 255.255.255.0 167.Ed 168.Pp 169Create a link aggregation using FAILOVER with two 170.Xr wm 4 171Gigabit Ethernet interfaces and set each priority: 172.Bd -literal -offset indent 173# ifconfig wm0 up 174# ifconfig wm1 up 175# ifconfig lagg0 create 176# ifconfig lagg0 laggproto failover \e 177 laggport wm0 pri 1000 laggport wm1 pri 2000 \e 178 192.168.1.1 netmask 255.255.255.0 179.Ed 180.Pp 181.Sh SEE ALSO 182.Xr ifconfig 8 183.Sh HISTORY 184The 185.Nm 186device first appeared in 187.Nx 10.0 . 188.Sh AUTHORS 189.An -nosplit 190The 191.Nm 192driver was written under the name 193.Nm trunk 194by 195.An Reyk Floeter Aq Mt reyk@openbsd.org . 196.Sh BUGS 197There is no way to configure LACP administrative variables, including system 198priority. 199The current implementation always performs active-mode LACP and uses 0x8000 as 200system priority. 201