xref: /openbsd/share/man/man4/trunk.4 (revision 73471bf0)
1.\"	$OpenBSD: trunk.4,v 1.31 2020/08/24 07:34:00 kn 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 24 2020 $
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.
37.Pp
38The driver currently supports the trunk protocols
39.Ic broadcast ,
40.Ic failover ,
41.Ic lacp ,
42.Ic loadbalance ,
43.Ic none ,
44and
45.Ic roundrobin
46(the default).
47The protocols determine which ports are used for outgoing traffic
48and whether a specific port accepts incoming traffic.
49The interface link state is used to validate if the port is active or
50not.
51.Bl -tag -width loadbalance
52.It Ic broadcast
53Sends frames to all ports of the trunk and receives frames on any
54port of the trunk.
55.It Ic failover
56Sends and receives traffic only through the master port.
57If the master port becomes unavailable,
58the next active port is used.
59The first interface added is the master port;
60any interfaces added after that are used as failover devices.
61.It Ic lacp
62Uses the IEEE 802.3ad (renamed to 802.1AX in 2014)
63Link Aggregation Control Protocol (LACP)
64and the Marker Protocol
65to increase link speed and provide redundancy.
66LACP trunk groups are composed of ports of the same speed,
67set to full-duplex operation.
68This protocol requires a switch which supports LACP.
69By default, the LACP implementation uses active-mode LACP,
70slow timeout, and 0x8000 (medium) priority as system and port
71priorities.
72.It Ic loadbalance
73Distributes outgoing traffic through all active ports
74and accepts incoming traffic from any active port.
75A hash of the protocol header is used to maintain packet ordering.
76The hash includes the Ethernet source and destination address and, if
77available, the VLAN tag, and the IP source and destination address.
78.It Ic none
79This protocol is intended to do nothing: it disables any traffic without
80disabling the
81.Nm
82interface itself.
83.It Ic roundrobin
84Distributes outgoing traffic through all active ports
85and accepts incoming traffic from any active port.
86A round-robin scheduler is used to aggregate the traffic.
87.El
88.Pp
89The configuration can be done at runtime or by setting up a
90.Xr hostname.if 5
91configuration file for
92.Xr netstart 8 .
93.Sh EXAMPLES
94Create a simple round robin trunk with two
95.Xr bge 4
96Gigabit Ethernet
97interfaces:
98.Bd -literal -offset indent
99# ifconfig bge0 up
100# ifconfig bge1 up
101# ifconfig trunk0 trunkport bge0 trunkport bge1 \e
102	192.168.1.1 netmask 255.255.255.0
103.Ed
104.Pp
105The following example uses an active failover trunk to set up roaming
106between wired and wireless networks using two network devices.
107Whenever the wired master interface is unplugged, the wireless failover
108device will be used:
109.Bd -literal -offset indent
110# ifconfig em0 up
111# ifconfig ath0 nwid my_net up
112# ifconfig trunk0 trunkproto failover trunkport em0 trunkport ath0 \e
113	192.168.1.1 netmask 255.255.255.0
114.Ed
115.Sh SEE ALSO
116.Xr inet 4 ,
117.Xr hostname.if 5 ,
118.Xr ifconfig 8 ,
119.Xr netstart 8
120.Sh HISTORY
121The
122.Nm
123device first appeared in
124.Ox 3.8 .
125.Sh AUTHORS
126The
127.Nm
128driver was written by
129.An Reyk Floeter Aq Mt reyk@openbsd.org .
130.Sh CAVEATS
131The trunk protocols
132.Ic loadbalance
133and
134.Ic roundrobin
135require a switch which supports IEEE 802.3ad static link aggregation;
136otherwise protocols
137such as
138.Xr inet6 4
139duplicate address detection (DAD)
140cannot properly deal with duplicate packets.
141.Pp
142The
143.Nm
144interface takes its MTU from the first
145.Ic trunkport .
146To avoid mismatches, adding a child interface with a different
147MTU is not permitted.
148