150b1e235SMarkus Pfeiffer.\" $OpenBSD: trunk.4,v 1.18 2006/06/09 13:53:34 jmc Exp $ 250b1e235SMarkus Pfeiffer.\" 350b1e235SMarkus Pfeiffer.\" Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org> 450b1e235SMarkus Pfeiffer.\" 550b1e235SMarkus Pfeiffer.\" Permission to use, copy, modify, and distribute this software for any 650b1e235SMarkus Pfeiffer.\" purpose with or without fee is hereby granted, provided that the above 750b1e235SMarkus Pfeiffer.\" copyright notice and this permission notice appear in all copies. 850b1e235SMarkus Pfeiffer.\" 950b1e235SMarkus Pfeiffer.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1050b1e235SMarkus Pfeiffer.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1150b1e235SMarkus Pfeiffer.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1250b1e235SMarkus Pfeiffer.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1350b1e235SMarkus Pfeiffer.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1450b1e235SMarkus Pfeiffer.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1550b1e235SMarkus Pfeiffer.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1650b1e235SMarkus Pfeiffer.\" 17a7de061cSMarkus Pfeiffer.\" $FreeBSD: head/share/man/man4/lagg.4 243091 2012-11-15 16:54:14Z joel $ 1850b1e235SMarkus Pfeiffer.\" 1950b1e235SMarkus Pfeiffer.Dd February 23, 2012 2050b1e235SMarkus Pfeiffer.Dt LAGG 4 2150b1e235SMarkus Pfeiffer.Os 2250b1e235SMarkus Pfeiffer.Sh NAME 2350b1e235SMarkus Pfeiffer.Nm lagg 2450b1e235SMarkus Pfeiffer.Nd link aggregation and link failover interface 2550b1e235SMarkus Pfeiffer.Sh SYNOPSIS 2650b1e235SMarkus PfeifferTo compile this driver into the kernel, 2750b1e235SMarkus Pfeifferplace the following line in your 2850b1e235SMarkus Pfeifferkernel configuration file: 2950b1e235SMarkus Pfeiffer.Bd -ragged -offset indent 3050b1e235SMarkus Pfeiffer.Cd "device lagg" 3150b1e235SMarkus Pfeiffer.Ed 3250b1e235SMarkus Pfeiffer.Pp 3350b1e235SMarkus PfeifferAlternatively, to load the driver as a 3450b1e235SMarkus Pfeiffermodule at boot time, place the following line in 3550b1e235SMarkus Pfeiffer.Xr loader.conf 5 : 3650b1e235SMarkus Pfeiffer.Bd -literal -offset indent 3750b1e235SMarkus Pfeifferif_lagg_load="YES" 3850b1e235SMarkus Pfeiffer.Ed 3950b1e235SMarkus Pfeiffer.Sh DESCRIPTION 4050b1e235SMarkus PfeifferThe 4150b1e235SMarkus Pfeiffer.Nm 4250b1e235SMarkus Pfeifferinterface allows aggregation of multiple network interfaces as one virtual 4350b1e235SMarkus Pfeiffer.Nm 4450b1e235SMarkus Pfeifferinterface for the purpose of providing fault-tolerance and high-speed links. 4550b1e235SMarkus Pfeiffer.Pp 4650b1e235SMarkus PfeifferA 4750b1e235SMarkus Pfeiffer.Nm 4850b1e235SMarkus Pfeifferinterface can be created using the 4950b1e235SMarkus Pfeiffer.Ic ifconfig lagg Ns Ar N Ic create 5050b1e235SMarkus Pfeiffercommand. 5150b1e235SMarkus PfeifferIt can use different link aggregation protocols specified 5250b1e235SMarkus Pfeifferusing the 5350b1e235SMarkus Pfeiffer.Ic laggproto Ar proto 5450b1e235SMarkus Pfeifferoption. 5550b1e235SMarkus PfeifferChild interfaces can be added using the 5650b1e235SMarkus Pfeiffer.Ic laggport Ar child-iface 5750b1e235SMarkus Pfeifferoption and removed using the 5850b1e235SMarkus Pfeiffer.Ic -laggport Ar child-iface 5950b1e235SMarkus Pfeifferoption. 6050b1e235SMarkus Pfeiffer.Pp 6150b1e235SMarkus PfeifferThe driver currently supports the aggregation protocols 6250b1e235SMarkus Pfeiffer.Ic failover 6350b1e235SMarkus Pfeiffer(the default), 6450b1e235SMarkus Pfeiffer.Ic fec , 6550b1e235SMarkus Pfeiffer.Ic lacp , 6650b1e235SMarkus Pfeiffer.Ic loadbalance , 6750b1e235SMarkus Pfeiffer.Ic roundrobin , 6850b1e235SMarkus Pfeifferand 6950b1e235SMarkus Pfeiffer.Ic none . 7050b1e235SMarkus PfeifferThe protocols determine which ports are used for outgoing traffic 7150b1e235SMarkus Pfeifferand whether a specific port accepts incoming traffic. 7250b1e235SMarkus PfeifferThe interface link state is used to validate if the port is active or 7350b1e235SMarkus Pfeiffernot. 7450b1e235SMarkus Pfeiffer.Bl -tag -width loadbalance 7550b1e235SMarkus Pfeiffer.It Ic failover 7650b1e235SMarkus PfeifferSends traffic only through the active port. 7750b1e235SMarkus PfeifferIf the master port becomes unavailable, 7850b1e235SMarkus Pfeifferthe next active port is used. 7950b1e235SMarkus PfeifferThe first interface added is the master port; 8050b1e235SMarkus Pfeifferany interfaces added after that are used as failover devices. 8150b1e235SMarkus Pfeiffer.Pp 8250b1e235SMarkus PfeifferBy default, received traffic is only accepted when they are received 8350b1e235SMarkus Pfeifferthrough the active port. 8450b1e235SMarkus PfeifferThis constraint can be relaxed by setting the 8550b1e235SMarkus Pfeiffer.Va net.link.lagg.failover_rx_all 8650b1e235SMarkus Pfeiffer.Xr sysctl 8 8750b1e235SMarkus Pfeiffervariable to a nonzero value, 8850b1e235SMarkus Pfeifferwhich is useful for certain bridged network setups. 8950b1e235SMarkus Pfeiffer.It Ic fec 9050b1e235SMarkus PfeifferSupports Cisco EtherChannel. 9150b1e235SMarkus PfeifferThis is an alias for 9250b1e235SMarkus Pfeiffer.Ic loadbalance 9350b1e235SMarkus Pfeiffermode. 9450b1e235SMarkus Pfeiffer.It Ic lacp 9550b1e235SMarkus PfeifferSupports the IEEE 802.1AX (formerly 802.3ad) Link Aggregation Control Protocol 9650b1e235SMarkus Pfeiffer(LACP) and the Marker Protocol. 9750b1e235SMarkus PfeifferLACP will negotiate a set of aggregable links with the peer in to one or more 9850b1e235SMarkus PfeifferLink Aggregated Groups. 9950b1e235SMarkus PfeifferEach LAG is composed of ports of the same speed, set to full-duplex operation. 10050b1e235SMarkus PfeifferThe traffic will be balanced across the ports in the LAG with the greatest 10150b1e235SMarkus Pfeiffertotal speed, in most cases there will only be one LAG which contains all ports. 10250b1e235SMarkus PfeifferIn the event of changes in physical connectivity, Link Aggregation will quickly 10350b1e235SMarkus Pfeifferconverge to a new configuration. 10450b1e235SMarkus Pfeiffer.It Ic loadbalance 10550b1e235SMarkus PfeifferBalances outgoing traffic across the active ports based on hashed 10650b1e235SMarkus Pfeifferprotocol header information and accepts incoming traffic from 10750b1e235SMarkus Pfeifferany active port. 10850b1e235SMarkus PfeifferThis is a static setup and does not negotiate aggregation with the peer or 10950b1e235SMarkus Pfeifferexchange frames to monitor the link. 11050b1e235SMarkus PfeifferThe hash includes the Ethernet source and destination address, and, if 11150b1e235SMarkus Pfeifferavailable, the VLAN tag, and the IP source and destination address. 11250b1e235SMarkus Pfeiffer.It Ic roundrobin 11350b1e235SMarkus PfeifferDistributes outgoing traffic using a round-robin scheduler 11450b1e235SMarkus Pfeifferthrough all active ports and accepts incoming traffic from 11550b1e235SMarkus Pfeifferany active port. 11650b1e235SMarkus Pfeiffer.It Ic none 11750b1e235SMarkus PfeifferThis protocol is intended to do nothing: it disables any traffic without 11850b1e235SMarkus Pfeifferdisabling the 11950b1e235SMarkus Pfeiffer.Nm 12050b1e235SMarkus Pfeifferinterface itself. 12150b1e235SMarkus Pfeiffer.El 12250b1e235SMarkus Pfeiffer.Pp 12350b1e235SMarkus PfeifferEach 12450b1e235SMarkus Pfeiffer.Nm 12550b1e235SMarkus Pfeifferinterface is created at runtime using interface cloning. 12650b1e235SMarkus PfeifferThis is 12750b1e235SMarkus Pfeiffermost easily done with the 12850b1e235SMarkus Pfeiffer.Xr ifconfig 8 12950b1e235SMarkus Pfeiffer.Cm create 13050b1e235SMarkus Pfeiffercommand or using the 13150b1e235SMarkus Pfeiffer.Va cloned_interfaces 13250b1e235SMarkus Pfeiffervariable in 13350b1e235SMarkus Pfeiffer.Xr rc.conf 5 . 13450b1e235SMarkus Pfeiffer.Pp 13550b1e235SMarkus PfeifferThe MTU of the first interface to be added is used as the lagg MTU. 13650b1e235SMarkus PfeifferAll additional interfaces are required to have exactly the same value. 13750b1e235SMarkus Pfeiffer.Pp 13850b1e235SMarkus PfeifferThe 13950b1e235SMarkus Pfeiffer.Ic loadbalance 14050b1e235SMarkus Pfeifferand 14150b1e235SMarkus Pfeiffer.Ic lacp 14250b1e235SMarkus Pfeiffermodes will use the RSS hash from the network card if available to avoid 14350b1e235SMarkus Pfeiffercomputing one, this may give poor traffic distribution if the hash is invalid 14450b1e235SMarkus Pfeifferor uses less of the protocol header information. 14550b1e235SMarkus PfeifferLocal hash computation can be forced per interface by setting the 14650b1e235SMarkus Pfeiffer.Va net.link.lagg.X.use_flowid 14750b1e235SMarkus Pfeiffer.Xr sysctl 8 14850b1e235SMarkus Pfeiffervariable to zero where X is the interface number. 14950b1e235SMarkus PfeifferThe default for new interfaces is set via the 15050b1e235SMarkus Pfeiffer.Va net.link.lagg.default_use_flowid 15150b1e235SMarkus Pfeiffer.Xr sysctl 8 . 15250b1e235SMarkus Pfeiffer.Sh EXAMPLES 15350b1e235SMarkus PfeifferCreate a link aggregation using LACP with two 15450b1e235SMarkus Pfeiffer.Xr bge 4 15550b1e235SMarkus PfeifferGigabit Ethernet interfaces: 15650b1e235SMarkus Pfeiffer.Bd -literal -offset indent 15750b1e235SMarkus Pfeiffer# ifconfig bge0 up 15850b1e235SMarkus Pfeiffer# ifconfig bge1 up 15950b1e235SMarkus Pfeiffer# ifconfig lagg0 laggproto lacp laggport bge0 laggport bge1 \e 16050b1e235SMarkus Pfeiffer 192.168.1.1 netmask 255.255.255.0 16150b1e235SMarkus Pfeiffer.Ed 16250b1e235SMarkus Pfeiffer.Pp 16350b1e235SMarkus PfeifferThe following example uses an active failover interface to set up roaming 16450b1e235SMarkus Pfeifferbetween wired and wireless networks using two network devices. 16550b1e235SMarkus PfeifferWhenever the wired master interface is unplugged, the wireless failover 16650b1e235SMarkus Pfeifferdevice will be used: 16750b1e235SMarkus Pfeiffer.Bd -literal -offset indent 16850b1e235SMarkus Pfeiffer# ifconfig em0 up 16950b1e235SMarkus Pfeiffer# ifconfig ath0 ether 00:11:22:33:44:55 17050b1e235SMarkus Pfeiffer# ifconfig create wlan0 wlandev ath0 ssid my_net up 17150b1e235SMarkus Pfeiffer# ifconfig lagg0 laggproto failover laggport em0 laggport wlan0 \e 17250b1e235SMarkus Pfeiffer 192.168.1.1 netmask 255.255.255.0 17350b1e235SMarkus Pfeiffer.Ed 17450b1e235SMarkus Pfeiffer.Pp 17550b1e235SMarkus Pfeiffer(Note the mac address of the wireless device is forced to match the wired 17650b1e235SMarkus Pfeifferdevice as a workaround.) 17750b1e235SMarkus Pfeiffer.Sh SEE ALSO 1785362713fSMarkus Pfeiffer.Xr ifmedia 4 , 17950b1e235SMarkus Pfeiffer.Xr ng_one2many 4 , 1805362713fSMarkus Pfeiffer.Xr ifconfig 8 , 1815362713fSMarkus Pfeiffer.Xr sysctl 8 18250b1e235SMarkus Pfeiffer.Sh HISTORY 18350b1e235SMarkus PfeifferThe 18450b1e235SMarkus Pfeiffer.Nm 18550b1e235SMarkus Pfeifferdevice first appeared in 186a7de061cSMarkus Pfeiffer.Dx 3.9 18750b1e235SMarkus Pfeiffer.Sh AUTHORS 18850b1e235SMarkus Pfeiffer.An -nosplit 18950b1e235SMarkus PfeifferThe 19050b1e235SMarkus Pfeiffer.Nm 19150b1e235SMarkus Pfeifferdriver was written under the name 19250b1e235SMarkus Pfeiffer.Nm trunk 19350b1e235SMarkus Pfeifferby 194*95c256b6SSascha Wildner.An Reyk Floeter Aq Mt reyk@openbsd.org . 19550b1e235SMarkus PfeifferThe LACP implementation was written by 19650b1e235SMarkus Pfeiffer.An YAMAMOTO Takashi 19750b1e235SMarkus Pfeifferfor 19850b1e235SMarkus Pfeiffer.Nx . 199a7de061cSMarkus PfeifferThe 200a7de061cSMarkus Pfeiffer.Fx 201a7de061cSMarkus Pfeifferversion was ported to 202a7de061cSMarkus Pfeiffer.Dx 3.9 203a7de061cSMarkus Pfeifferby 204*95c256b6SSascha Wildner.An Markus Pfeiffer Aq Mt profmakx@dragonflybsd.org . 20550b1e235SMarkus Pfeiffer.Sh BUGS 20650b1e235SMarkus PfeifferThere is no way to configure LACP administrative variables, including system 20750b1e235SMarkus Pfeifferand port priorities. 20850b1e235SMarkus PfeifferThe current implementation always performs active-mode LACP and uses 0x8000 as 20950b1e235SMarkus Pfeiffersystem and port priorities. 210