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