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
|
<table class="head">
<tr>
<td class="head-ltitle">LAGG(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">LAGG(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">lagg</code> — <span class="Nd">link
aggregation and link failover interface</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp">To compile this driver into the kernel, place the following line
in your kernel configuration file:</p>
<div class="Bd Pp Bd-indent"><code class="Cd">device lagg</code></div>
<p class="Pp">Alternatively, to load the driver as a module at boot time, place
the following line in <a class="Xr">loader.conf(5)</a>:</p>
<div class="Bd Pp Bd-indent Li">
<pre>if_lagg_load="YES"</pre>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">lagg</code> interface allows aggregation of
multiple network interfaces as one virtual <code class="Nm">lagg</code>
interface for the purpose of providing fault-tolerance and high-speed
links.</p>
<p class="Pp">Each <code class="Nm">lagg</code> interface is created at runtime
using interface cloning. This is most easily done with the
<a class="Xr">ifconfig(8)</a> <code class="Cm">create</code> command or
using the <var class="Va">cloned_interfaces</var> variable in
<a class="Xr">rc.conf(5)</a>.</p>
<p class="Pp">A <code class="Nm">lagg</code> interface can be created using the
<code class="Ic">ifconfig lagg</code><var class="Ar">N</var>
<code class="Ic">create</code> command. It can use different link
aggregation protocols specified using the <code class="Ic">laggproto</code>
<var class="Ar">proto</var> option. Child interfaces can be added using the
<code class="Ic">laggport</code> <var class="Ar">child-iface</var> option
and removed using the <code class="Ic">-laggport</code>
<var class="Ar">child-iface</var> option.</p>
<p class="Pp">The driver currently supports the aggregation protocols
<code class="Ic">failover</code> (the default),
<code class="Ic">lacp</code>, <code class="Ic">loadbalance</code>,
<code class="Ic">roundrobin</code>, <code class="Ic">broadcast</code>, and
<code class="Ic">none</code>. 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.</p>
<dl class="Bl-tag">
<dt id="failover"><a class="permalink" href="#failover"><code class="Ic">failover</code></a></dt>
<dd>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.
<p class="Pp">By default, received traffic is only accepted when it is
received through the active port. This constraint can be relaxed by
setting the <var class="Va">net.link.lagg.failover_rx_all</var>
<a class="Xr">sysctl(8)</a> variable to a nonzero value, which is useful
for certain bridged network setups.</p>
</dd>
<dt id="lacp"><a class="permalink" href="#lacp"><code class="Ic">lacp</code></a></dt>
<dd>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.</dd>
<dt id="loadbalance"><a class="permalink" href="#loadbalance"><code class="Ic">loadbalance</code></a></dt>
<dd>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.</dd>
<dt id="roundrobin"><a class="permalink" href="#roundrobin"><code class="Ic">roundrobin</code></a></dt>
<dd>Distributes outgoing traffic using a round-robin scheduler through all
active ports and accepts incoming traffic from any active port. Using
<code class="Ic">roundrobin</code> mode can cause unordered packet arrival
at the client. Throughput might be limited as the client performs
CPU-intensive packet reordering.</dd>
<dt id="broadcast"><a class="permalink" href="#broadcast"><code class="Ic">broadcast</code></a></dt>
<dd>Sends frames to all ports of the LAG and receives frames on any port of
the LAG.</dd>
<dt id="none"><a class="permalink" href="#none"><code class="Ic">none</code></a></dt>
<dd>This protocol is intended to do nothing: it disables any traffic without
disabling the <code class="Nm">lagg</code> interface itself.</dd>
</dl>
<p class="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.</p>
<p class="Pp">The <code class="Ic">loadbalance</code> and
<code class="Ic">lacp</code> 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 <code class="Cm">-use_flowid</code> <a class="Xr">ifconfig(8)</a> flag.
The default for new interfaces is set via the
<var class="Va">net.link.lagg.default_use_flowid</var>
<a class="Xr">sysctl(8)</a>.</p>
<p class="Pp">When creating a <code class="Nm">lagg</code> interface, the
<code class="Ic">laggtype</code> can be specified as either
<code class="Cm">ethernet</code> or <code class="Cm">infiniband</code>. If
neither is specified then the default is
<code class="Cm">ethernet</code>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
<p class="Pp">Create a link aggregation using LACP with two
<a class="Xr">bge(4)</a> Gigabit Ethernet interfaces:</p>
<div class="Bd Pp Bd-indent Li">
<pre># ifconfig bge0 up
# ifconfig bge1 up
# ifconfig lagg0 create
# ifconfig lagg0 laggproto lacp laggport bge0 laggport bge1 \
192.168.1.1 netmask 255.255.255.0</pre>
</div>
<p class="Pp">Create a link aggregation using ROUNDROBIN with two
<a class="Xr">bge(4)</a> Gigabit Ethernet interfaces and set a stride of 500
packets per interface:</p>
<div class="Bd Pp Bd-indent Li">
<pre># ifconfig bge0 up
# ifconfig bge1 up
# ifconfig lagg0 create
# ifconfig lagg0 laggproto roundrobin laggport bge0 laggport bge1 \
192.168.1.1 netmask 255.255.255.0
# ifconfig lagg0 rr_limit 500</pre>
</div>
<p class="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:</p>
<div class="Bd Pp Bd-indent Li">
<pre># ifconfig em0 ether 00:11:22:33:44:55 up
# ifconfig wlan0 create wlandev ath0 ssid my_net up
# ifconfig lagg0 create
# ifconfig lagg0 laggproto failover laggport em0 laggport wlan0 \
192.168.1.1 netmask 255.255.255.0</pre>
</div>
<p class="Pp">(Note the MAC address of the wired device is forced to match that
of the wireless device, ‘00:11:22:33:44:55’ in this example,
as some common wireless devices will not allow MAC addresses to be
changed.)</p>
<p class="Pp">The following example shows how to create an infiniband failover
interface.</p>
<div class="Bd Pp Bd-indent Li">
<pre># ifconfig ib0 up
# ifconfig ib1 up
# ifconfig lagg0 create laggtype infiniband
# ifconfig lagg0 laggproto failover laggport ib0 laggport ib1 \
1.1.1.1 netmask 255.255.255.0</pre>
</div>
<p class="Pp">Configure two ethernets for failover with static IP in
<span class="Pa">/etc/rc.conf</span>:</p>
<div class="Bd Pp Bd-indent Li">
<pre>cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport bge0 laggport bge1 \
10.1.29.21/24"
ifconfig_bge0="up"
ifconfig_bge1="up"</pre>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">ng_one2many(4)</a>, <a class="Xr">rc.conf(5)</a>,
<a class="Xr">ifconfig(8)</a>, <a class="Xr">sysctl(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">lagg</code> device first appeared in
<span class="Ux">FreeBSD 6.3</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">The <code class="Nm">lagg</code> driver was written under the name
<code class="Nm">trunk</code> by <span class="An">Reyk Floeter</span>
<<a class="Mt" href="mailto:reyk@openbsd.org">reyk@openbsd.org</a>>.
The LACP implementation was written by <span class="An">YAMAMOTO
Takashi</span> for <span class="Ux">NetBSD</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
<p class="Pp">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.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">January 16, 2023</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|