1.\" $OpenBSD: trunk.4,v 1.18 2006/06/09 13:53:34 jmc Exp $ 2.\" 3.\" Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.\" $FreeBSD$ 18.\" 19.Dd October 18, 2010 20.Dt LAGG 4 21.Os 22.Sh NAME 23.Nm lagg 24.Nd link aggregation and link failover interface 25.Sh SYNOPSIS 26To compile this driver into the kernel, 27place the following line in your 28kernel configuration file: 29.Bd -ragged -offset indent 30.Cd "device lagg" 31.Ed 32.Pp 33Alternatively, to load the driver as a 34module at boot time, place the following line in 35.Xr loader.conf 5 : 36.Bd -literal -offset indent 37if_lagg_load="YES" 38.Ed 39.Sh DESCRIPTION 40The 41.Nm 42interface allows aggregation of multiple network interfaces as one virtual 43.Nm 44interface for the purpose of providing fault-tolerance and high-speed links. 45.Pp 46A 47.Nm 48interface can be created using the 49.Ic ifconfig lagg Ns Ar N Ic create 50command. 51It can use different link aggregation protocols specified 52using the 53.Ic laggproto Ar proto 54option. 55Child interfaces can be added using the 56.Ic laggport Ar child-iface 57option and removed using the 58.Ic -laggport Ar child-iface 59option. 60.Pp 61The driver currently supports the aggregation protocols 62.Ic failover 63(the default), 64.Ic fec , 65.Ic lacp , 66.Ic loadbalance , 67.Ic roundrobin , 68and 69.Ic none . 70The protocols determine which ports are used for outgoing traffic 71and whether a specific port accepts incoming traffic. 72The interface link state is used to validate if the port is active or 73not. 74.Bl -tag -width loadbalance 75.It Ic failover 76Sends traffic only through the active port. 77If the master port becomes unavailable, 78the next active port is used. 79The first interface added is the master port; 80any interfaces added after that are used as failover devices. 81.Pp 82By default, received traffic is only accepted when they are received 83through the active port. 84This constraint can be relaxed by setting the 85.Va net.link.lagg.failover_rx_all 86.Xr sysctl 8 87variable to a nonzero value, 88which is useful for certain bridged network setups. 89.It Ic fec 90Supports Cisco EtherChannel. 91This is a static setup and does not negotiate aggregation with the peer or 92exchange frames to monitor the link. 93.It Ic lacp 94Supports the IEEE 802.3ad Link Aggregation Control Protocol (LACP) and the 95Marker Protocol. 96LACP will negotiate a set of aggregable links with the peer in to one or more 97Link Aggregated Groups. 98Each LAG is composed of ports of the same speed, set to full-duplex operation. 99The traffic will be balanced across the ports in the LAG with the greatest 100total speed, in most cases there will only be one LAG which contains all ports. 101In the event of changes in physical connectivity, Link Aggregation will quickly 102converge to a new configuration. 103.It Ic loadbalance 104Balances outgoing traffic across the active ports based on hashed 105protocol header information and accepts incoming traffic from 106any active port. 107This is a static setup and does not negotiate aggregation with the peer or 108exchange frames to monitor the link. 109The hash includes the Ethernet source and destination address, and, if 110available, the VLAN tag, and the IP source and destination address. 111.It Ic roundrobin 112Distributes outgoing traffic using a round-robin scheduler 113through all active ports and accepts incoming traffic from 114any active port. 115.It Ic none 116This protocol is intended to do nothing: it disables any traffic without 117disabling the 118.Nm 119interface itself. 120.El 121.Pp 122Each 123.Nm 124interface is created at runtime using interface cloning. 125This is 126most easily done with the 127.Xr ifconfig 8 128.Cm create 129command or using the 130.Va cloned_interfaces 131variable in 132.Xr rc.conf 5 . 133.Pp 134The MTU of the first interface to be added is used as the lagg MTU. 135All additional interfaces are required to have exactly the same value. 136.Sh EXAMPLES 137Create a 802.3ad link aggregation using LACP with two 138.Xr bge 4 139Gigabit Ethernet interfaces: 140.Bd -literal -offset indent 141# ifconfig bge0 up 142# ifconfig bge1 up 143# ifconfig lagg0 laggproto lacp laggport bge0 laggport bge1 \e 144 192.168.1.1 netmask 255.255.255.0 145.Ed 146.Pp 147The following example uses an active failover interface to set up roaming 148between wired and wireless networks using two network devices. 149Whenever the wired master interface is unplugged, the wireless failover 150device will be used: 151.Bd -literal -offset indent 152# ifconfig em0 up 153# ifconfig ath0 ether 00:11:22:33:44:55 154# ifconfig create wlan0 wlandev ath0 ssid my_net up 155# ifconfig lagg0 laggproto failover laggport em0 laggport wlan0 \e 156 192.168.1.1 netmask 255.255.255.0 157.Ed 158.Pp 159(Note the mac address of the wireless device is forced to match the wired 160device as a workaround.) 161.Sh SEE ALSO 162.Xr ng_fec 4 , 163.Xr ng_one2many 4 , 164.Xr sysctl 8 , 165.Xr ifconfig 8 166.Sh HISTORY 167The 168.Nm 169device first appeared in 170.Fx 6.3 . 171.Sh AUTHORS 172.An -nosplit 173The 174.Nm 175driver was written under the name 176.Nm trunk 177by 178.An Reyk Floeter Aq reyk@openbsd.org . 179The LACP implementation was written by 180.An YAMAMOTO Takashi 181for 182.Nx . 183.Sh BUGS 184There is no way to configure LACP administrative variables, including system 185and port priorities. 186The current implementation always performs active-mode LACP and uses 0x8000 as 187system and port priorities. 188