1.\" $OpenBSD: trunk.4,v 1.25 2008/12/15 11:50:10 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.Dd $Mdocdate: December 15 2008 $ 18.Dt TRUNK 4 19.Os 20.Sh NAME 21.Nm trunk 22.Nd link aggregation and link failover interface 23.Sh SYNOPSIS 24.Cd "pseudo-device trunk" 25.Sh DESCRIPTION 26The 27.Nm 28interface allows aggregation of multiple network interfaces as one virtual 29.Nm 30interface. 31.Pp 32A 33.Nm 34interface can be created using the 35.Ic ifconfig trunk Ns Ar N Ic create 36command. 37It can use different link aggregation protocols specified 38using the 39.Ic trunkproto Ar proto 40option. 41Child interfaces can be added using the 42.Ic trunkport Ar child-iface 43option and removed using the 44.Ic -trunkport Ar child-iface 45option. 46.Pp 47The driver currently supports the trunk protocols 48.Ic broadcast , 49.Ic failover , 50.Ic lacp , 51.Ic loadbalance , 52.Ic none , 53and 54.Ic roundrobin 55(the default). 56The protocols determine which ports are used for outgoing traffic 57and whether a specific port accepts incoming traffic. 58The interface link state is used to validate if the port is active or 59not. 60.Bl -tag -width loadbalance 61.It Ic broadcast 62Sends frames to all ports of the trunk and receives frames on any 63port of the trunk. 64.It Ic failover 65Sends and receives traffic only through the master port. 66If the master port becomes unavailable, 67the next active port is used. 68The first interface added is the master port; 69any interfaces added after that are used as failover devices. 70.It Ic lacp 71Uses the IEEE 802.3ad Link Aggregation Control Protocol (LACP) 72and the Marker Protocol 73to increase link speed and provide redundancy. 74LACP trunk groups are composed of ports of the same speed, 75set to full-duplex operation. 76This protocol requires a switch which supports LACP. 77.It Ic loadbalance 78Distributes outgoing traffic through all active ports 79and accepts incoming traffic from any active port. 80A hash of the protocol header is used to maintain packet ordering. 81The hash includes the Ethernet source and destination address, and, if 82available, the VLAN tag, and the IP source and destination address. 83.It Ic none 84This protocol is intended to do nothing: it disables any traffic without 85disabling the 86.Nm 87interface itself. 88.It Ic roundrobin 89Distributes outgoing traffic through all active ports 90and accepts incoming traffic from any active port. 91A round-robin scheduler is used to aggregate the traffic. 92.El 93.Pp 94The configuration can be done at runtime or by setting up a 95.Xr hostname.if 5 96configuration file for 97.Xr netstart 8 . 98.Sh EXAMPLES 99Create a simple round robin trunk with two bge(4) Gigabit Ethernet 100interfaces: 101.Bd -literal -offset indent 102# ifconfig bge0 up 103# ifconfig bge1 up 104# ifconfig trunk0 trunkport bge0 trunkport bge1 \e 105 192.168.1.1 netmask 255.255.255.0 106.Ed 107.Pp 108The following example uses an active failover trunk to set up roaming 109between wired and wireless networks using two network devices. 110Whenever the wired master interface is unplugged, the wireless failover 111device will be used: 112.Bd -literal -offset indent 113# ifconfig em0 up 114# ifconfig ath0 nwid my_net up 115# ifconfig trunk0 trunkproto failover trunkport em0 trunkport ath0 \e 116 192.168.1.1 netmask 255.255.255.0 117.Ed 118.Sh SEE ALSO 119.Xr inet 4 , 120.Xr hostname.if 5 , 121.Xr ifconfig 8 , 122.Xr netstart 8 123.Sh HISTORY 124The 125.Nm 126device first appeared in 127.Ox 3.8 . 128.Sh AUTHORS 129The 130.Nm 131driver was written by 132.An Reyk Floeter Aq reyk@openbsd.org . 133.Sh CAVEATS 134The trunk protocols 135.Ic loadbalance 136and 137.Ic roundrobin 138require a switch which supports IEEE 802.3ad static link aggregation; 139otherwise protocols 140such as 141.Xr inet6 4 142duplicate address detection (DAD) 143cannot properly deal with duplicate packets. 144.Pp 145There is no way to configure LACP administrative variables, including 146system and port priorities. 147The current implementation always performs active-mode LACP and uses 1480x8000 as system and port priorities. 149