xref: /openbsd/share/man/man4/trunk.4 (revision 274d7c50)
1.\"	$OpenBSD: trunk.4,v 1.30 2018/08/12 23:50:31 ccardenas 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: August 12 2018 $
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 (renamed to 802.1AX in 2014)
72Link Aggregation Control Protocol (LACP)
73and the Marker Protocol
74to increase link speed and provide redundancy.
75LACP trunk groups are composed of ports of the same speed,
76set to full-duplex operation.
77This protocol requires a switch which supports LACP.
78By default, the LACP implementation uses active-mode LACP,
79slow timeout, and 0x8000 (medium) priority as system and port
80priorities.
81.It Ic loadbalance
82Distributes outgoing traffic through all active ports
83and accepts incoming traffic from any active port.
84A hash of the protocol header is used to maintain packet ordering.
85The hash includes the Ethernet source and destination address and, if
86available, the VLAN tag, and the IP source and destination address.
87.It Ic none
88This protocol is intended to do nothing: it disables any traffic without
89disabling the
90.Nm
91interface itself.
92.It Ic roundrobin
93Distributes outgoing traffic through all active ports
94and accepts incoming traffic from any active port.
95A round-robin scheduler is used to aggregate the traffic.
96.El
97.Pp
98The configuration can be done at runtime or by setting up a
99.Xr hostname.if 5
100configuration file for
101.Xr netstart 8 .
102.Sh EXAMPLES
103Create a simple round robin trunk with two
104.Xr bge 4
105Gigabit Ethernet
106interfaces:
107.Bd -literal -offset indent
108# ifconfig bge0 up
109# ifconfig bge1 up
110# ifconfig trunk0 trunkport bge0 trunkport bge1 \e
111	192.168.1.1 netmask 255.255.255.0
112.Ed
113.Pp
114The following example uses an active failover trunk to set up roaming
115between wired and wireless networks using two network devices.
116Whenever the wired master interface is unplugged, the wireless failover
117device will be used:
118.Bd -literal -offset indent
119# ifconfig em0 up
120# ifconfig ath0 nwid my_net up
121# ifconfig trunk0 trunkproto failover trunkport em0 trunkport ath0 \e
122	192.168.1.1 netmask 255.255.255.0
123.Ed
124.Sh SEE ALSO
125.Xr inet 4 ,
126.Xr hostname.if 5 ,
127.Xr ifconfig 8 ,
128.Xr netstart 8
129.Sh HISTORY
130The
131.Nm
132device first appeared in
133.Ox 3.8 .
134.Sh AUTHORS
135The
136.Nm
137driver was written by
138.An Reyk Floeter Aq Mt reyk@openbsd.org .
139.Sh CAVEATS
140The trunk protocols
141.Ic loadbalance
142and
143.Ic roundrobin
144require a switch which supports IEEE 802.3ad static link aggregation;
145otherwise protocols
146such as
147.Xr inet6 4
148duplicate address detection (DAD)
149cannot properly deal with duplicate packets.
150.Pp
151The
152.Nm
153interface takes its MTU from the first
154.Ic trunkport .
155To avoid mismatches, adding a child interface with a different
156MTU is not permitted.
157