First pass at link aggregation chapter. Another nit-pickier commit to follow.

Sponsored by: iXsystems
This commit is contained in:
Dru Lavigne 2014-02-13 19:04:33 +00:00
parent 6f215d481c
commit c255a8b214
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=43901

View file

@ -3397,68 +3397,60 @@ BEGEMOT-BRIDGE-MIB::begemotBridgeDefaultBridgeIf.0 s bridge2</screen>
<indexterm><primary>loadbalance</primary></indexterm> <indexterm><primary>loadbalance</primary></indexterm>
<indexterm><primary>roundrobin</primary></indexterm> <indexterm><primary>roundrobin</primary></indexterm>
<sect2> <para>&os; provides the &man.lagg.4; interface which can be used
<title>Introduction</title> to aggregate multiple
network interfaces into one virtual interface for the purpose of
providing fault tolerance and link aggregation. Link
aggregation works best on switches which support
<acronym>LACP</acronym>, as this protocol distributes traffic
bi-directionally while responding to the failure of individual
links.</para>
<para>The &man.lagg.4; interface allows aggregation of multiple <para>The operating modes supported by the lagg interface
network interfaces as one virtual interface for the purpose of determine which ports are used for outgoing traffic and
providing fault-tolerance and high-speed links.</para> whether or not a specific port accepts incoming
</sect2> traffic. The following operating modes are supported by
<sect2>
<title>Operating Modes</title>
<para>The following operating modes are supported by
&man.lagg.4;:</para> &man.lagg.4;:</para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>Failover</term> <term>failover</term>
<listitem> <listitem>
<para>Sends and receives traffic only through the master <para>This mode sends and receives traffic only through the master
port. If the master port becomes unavailable, the next port. If the master port becomes unavailable, the next
active port is used. The first interface added is the active port is used. The first interface added to the virtual interface is the
master port and any interfaces added after that are used master port and all subsequently added interfaces are used
as failover devices. If failover to a non-master port as failover devices. If failover to a non-master port
occurs, the original port will become master when it occurs, the original port becomes master once it
becomes available again.</para> becomes available again.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>&cisco; Fast &etherchannel;</term> <term>fec / loadbalance</term>
<listitem> <listitem>
<para>&cisco; Fast &etherchannel; (<acronym>FEC</acronym>) <para>&cisco; Fast &etherchannel; (<acronym>FEC</acronym>)
is a static setup and does not negotiate aggregation is found on older &cisco; switches. It provides a
static setup and does not negotiate aggregation
with the peer or exchange frames to monitor the link. with the peer or exchange frames to monitor the link.
If the switch supports <acronym>LACP</acronym>, that If the switch supports <acronym>LACP</acronym>, that
should be used instead.</para> should be used instead.</para>
<para><acronym>FEC</acronym> balances outgoing traffic
across the active ports based on hashed protocol header
information and accepts incoming traffic from any active
port. The hash includes the Ethernet source and
destination address and, if available, the
<acronym>VLAN</acronym> tag, and the
<acronym>IPv4</acronym> or <acronym>IPv6</acronym>
source and destination address.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><acronym>LACP</acronym></term> <term><acronym>lacp</acronym></term>
<listitem> <listitem>
<para>The &ieee; 802.3ad Link Aggregation Control Protocol <para>The &ieee; 802.3ad Link Aggregation Control Protocol
(<acronym>LACP</acronym>) and the Marker Protocol. (<acronym>LACP</acronym>) negotiates a set of
<acronym>LACP</acronym> will negotiate a set of
aggregable links with the peer in to one or more Link aggregable links with the peer in to one or more Link
Aggregated Groups (<acronym>LAG</acronym>s). Each Aggregated Groups (<acronym>LAG</acronym>s). Each
<acronym>LAG</acronym> is composed of ports of the <acronym>LAG</acronym> is composed of ports of the
same speed, set to full-duplex operation. The traffic same speed, set to full-duplex operation, and traffic
will be balanced across the ports in the is balanced across the ports in the
<acronym>LAG</acronym> with the greatest total speed. <acronym>LAG</acronym> with the greatest total speed.
In most cases, there will only be one Typically, there is only one
<acronym>LAG</acronym> which contains all ports. In <acronym>LAG</acronym> which contains all the ports. In
the event of changes in physical connectivity, the event of changes in physical connectivity,
<acronym>LACP</acronym> will quickly converge to a new <acronym>LACP</acronym> will quickly converge to a new
configuration.</para> configuration.</para>
@ -3468,24 +3460,16 @@ BEGEMOT-BRIDGE-MIB::begemotBridgeDefaultBridgeIf.0 s bridge2</screen>
information and accepts incoming traffic from any active information and accepts incoming traffic from any active
port. The hash includes the Ethernet source and port. The hash includes the Ethernet source and
destination address and, if available, the destination address and, if available, the
<acronym>VLAN</acronym> tag, and the IPv4 or <acronym>VLAN</acronym> tag, and the <acronym>IPv4</acronym> or
<acronym>IPv6</acronym> source and destination <acronym>IPv6</acronym> source and destination
address.</para> address.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>Loadbalance</term> <term>roundrobin</term>
<listitem> <listitem>
<para>This is an alias of <emphasis>FEC</emphasis> <para>This mode distributes outgoing traffic using a round-robin
mode.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Round-robin</term>
<listitem>
<para>Distributes outgoing traffic using a round-robin
scheduler through all active ports and accepts incoming scheduler through all active ports and accepts incoming
traffic from any active port. This mode violates traffic from any active port. This mode violates
Ethernet frame ordering and should be used with Ethernet frame ordering and should be used with
@ -3493,10 +3477,16 @@ BEGEMOT-BRIDGE-MIB::begemotBridgeDefaultBridgeIf.0 s bridge2</screen>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</sect2>
<sect2> <sect2>
<title>Examples</title> <title>Configuration Examples</title>
<para>This section demonstrates how to configure a &cisco;
switch and a &os; system for <acronym>LACP</acronym> load
balancing. It then shows how to configure two Ethernet
interfaces in failover mode as well as how to configure
failover mode between an Ethernet and a wireless
interface.</para>
<example xml:id="networking-lacp-aggregation-cisco"> <example xml:id="networking-lacp-aggregation-cisco">
<title><acronym>LACP</acronym> Aggregation with a &cisco; <title><acronym>LACP</acronym> Aggregation with a &cisco;
@ -3526,10 +3516,10 @@ BEGEMOT-BRIDGE-MIB::begemotBridgeDefaultBridgeIf.0 s bridge2</screen>
channel-group 1 mode active channel-group 1 mode active
channel-protocol lacp</userinput></screen> channel-protocol lacp</userinput></screen>
<para>Create the &man.lagg.4; interface using <para>On the &os; system, create the &man.lagg.4; interface using
<replaceable>fxp0</replaceable> and the physical interfaces <replaceable>fxp0</replaceable> and
<replaceable>fxp1</replaceable>, and bring the interfaces up <replaceable>fxp1</replaceable>, and bring the interfaces up
with the <acronym>IP</acronym> address of with an <acronym>IP</acronym> address of
<replaceable>10.0.0.3/24</replaceable>:</para> <replaceable>10.0.0.3/24</replaceable>:</para>
<screen>&prompt.root; <userinput>ifconfig fxp0 up</userinput> <screen>&prompt.root; <userinput>ifconfig fxp0 up</userinput>
@ -3537,18 +3527,16 @@ BEGEMOT-BRIDGE-MIB::begemotBridgeDefaultBridgeIf.0 s bridge2</screen>
&prompt.root; <userinput>ifconfig lagg0 create </userinput> &prompt.root; <userinput>ifconfig lagg0 create </userinput>
&prompt.root; <userinput>ifconfig lagg0 up laggproto lacp laggport fxp0 laggport fxp1 10.0.0.3/24</userinput></screen> &prompt.root; <userinput>ifconfig lagg0 up laggproto lacp laggport fxp0 laggport fxp1 10.0.0.3/24</userinput></screen>
<para>View the interface status by running:</para> <para>Next, verify the status of the virtual interface. Ports
marked as <literal>ACTIVE</literal> are part of
<screen>&prompt.root; <userinput>ifconfig lagg0</userinput></screen>
<para>Ports marked as <emphasis>ACTIVE</emphasis> are part of
the active aggregation group that has been negotiated with the active aggregation group that has been negotiated with
the remote switch. Traffic will be transmitted and the remote switch. Traffic will be transmitted and
received through active ports. Use the verbose output of received through active ports. Use the verbose output of
&man.ifconfig.8; to view the <acronym>LAG</acronym> &man.ifconfig.8; to view the <acronym>LAG</acronym>
identifiers.</para> identifiers.</para>
<screen>lagg0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500 <screen>&prompt.root; <userinput>ifconfig lagg0</userinput>
lagg0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500
options=8&lt;VLAN_MTU&gt; options=8&lt;VLAN_MTU&gt;
ether 00:05:5d:71:8d:b8 ether 00:05:5d:71:8d:b8
media: Ethernet autoselect media: Ethernet autoselect
@ -3557,10 +3545,9 @@ BEGEMOT-BRIDGE-MIB::begemotBridgeDefaultBridgeIf.0 s bridge2</screen>
laggport: fxp1 flags=1c&lt;ACTIVE,COLLECTING,DISTRIBUTING&gt; laggport: fxp1 flags=1c&lt;ACTIVE,COLLECTING,DISTRIBUTING&gt;
laggport: fxp0 flags=1c&lt;ACTIVE,COLLECTING,DISTRIBUTING&gt;</screen> laggport: fxp0 flags=1c&lt;ACTIVE,COLLECTING,DISTRIBUTING&gt;</screen>
<para>To see the port status on the &cisco; switch, use <para>To see the port status on the &cisco; switch:</para>
<userinput>show lacp neighbor</userinput>:</para>
<screen>switch# show lacp neighbor <screen>switch# <userinput>show lacp neighbor</userinput>
Flags: S - Device is requesting Slow LACPDUs Flags: S - Device is requesting Slow LACPDUs
F - Device is requesting Fast LACPDUs F - Device is requesting Fast LACPDUs
A - Device is in Active mode P - Device is in Passive mode A - Device is in Active mode P - Device is in Passive mode
@ -3577,9 +3564,9 @@ Fa0/2 SA 32768 0005.5d71.8db8 29s 0x146 0x4 0x3D</screen
<para>For more detail, type <userinput>show lacp neighbor <para>For more detail, type <userinput>show lacp neighbor
detail</userinput>.</para> detail</userinput>.</para>
<para>To retain this configuration across reboots, the <para>To retain this configuration across reboots, add the
following entries can be added to following entries to
<filename>/etc/rc.conf</filename>:</para> <filename>/etc/rc.conf</filename> on the &os; system:</para>
<programlisting>ifconfig_<replaceable>fxp0</replaceable>="up" <programlisting>ifconfig_<replaceable>fxp0</replaceable>="up"
ifconfig_<replaceable>fxp1</replaceable>="up" ifconfig_<replaceable>fxp1</replaceable>="up"
@ -3592,11 +3579,11 @@ ifconfig_<literal>lagg0</literal>="laggproto lacp laggport <replaceable>fxp0</re
<para>Failover mode can be used to switch over to a secondary <para>Failover mode can be used to switch over to a secondary
interface if the link is lost on the master interface. interface if the link is lost on the master interface.
To configure failover mode, first bring the underlying To configure failover mode, make sure that the underlying
physical interfaces up. Then, create the &man.lagg.4; physical interfaces are up, then create the &man.lagg.4;
interface, using <replaceable>fxp0</replaceable> as the interface. In this example, <replaceable>fxp0</replaceable> is the
master interface and <replaceable>fxp1</replaceable> as master interface, <replaceable>fxp1</replaceable> is
the secondary interface, and assign an <acronym>IP</acronym> the secondary interface, and the virtual interface is assigned an <acronym>IP</acronym>
address of address of
<replaceable>10.0.0.15/24</replaceable>:</para> <replaceable>10.0.0.15/24</replaceable>:</para>
@ -3605,7 +3592,7 @@ ifconfig_<literal>lagg0</literal>="laggproto lacp laggport <replaceable>fxp0</re
&prompt.root; <userinput>ifconfig lagg0 create</userinput> &prompt.root; <userinput>ifconfig lagg0 create</userinput>
&prompt.root; <userinput>ifconfig lagg0 up laggproto failover laggport fxp0 laggport fxp1 10.0.0.15/24</userinput></screen> &prompt.root; <userinput>ifconfig lagg0 up laggproto failover laggport fxp0 laggport fxp1 10.0.0.15/24</userinput></screen>
<para>The interface should now look something like <para>The virtual interface should look something like
this:</para> this:</para>
<screen>&prompt.root; <userinput>ifconfig lagg0</userinput> <screen>&prompt.root; <userinput>ifconfig lagg0</userinput>
@ -3626,8 +3613,8 @@ lagg0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 150
If the link is restored on the master interface, it will If the link is restored on the master interface, it will
once again become the active link.</para> once again become the active link.</para>
<para>To retain this configuration across reboots, the <para>To retain this configuration across reboots, add the
following entries can be added to following entries to
<filename>/etc/rc.conf</filename>:</para> <filename>/etc/rc.conf</filename>:</para>
<programlisting>ifconfig_<replaceable>fxp0</replaceable>="up" <programlisting>ifconfig_<replaceable>fxp0</replaceable>="up"
@ -3641,30 +3628,30 @@ ifconfig_<literal>lagg0</literal>="laggproto failover laggport <replaceable>fxp0
Interfaces</title> Interfaces</title>
<para>For laptop users, it is usually desirable to configure <para>For laptop users, it is usually desirable to configure
the wireless device as a secondary interface, which is used the wireless device as a secondary which is only used
when the wired connection is not available. With when the Ethernet connection is not available. With
&man.lagg.4;, it is possible to use one &man.lagg.4;, it is possible to configure a failover which
<acronym>IP</acronym> address, prefer the wired connection prefers the Ethernet connection
for both performance and security reasons, while for both performance and security reasons, while
maintaining the ability to transfer data over the wireless maintaining the ability to transfer data over the wireless
connection.</para> connection.</para>
<para>In this setup, override the underlying wireless <para>This is achieved by overriding the underlying wireless
interface's <acronym>MAC</acronym> address to match that interface's <acronym>MAC</acronym> address with that
of the &man.lagg.4;, which is inherited from the wired of the Ethernet
interface.</para> interface.</para>
<para>In this example, the wired interface, <para>In this example, the Ethernet interface,
<replaceable>bge0</replaceable>, is the master, and the <replaceable>bge0</replaceable>, is the master and the
wireless interface, <replaceable>wlan0</replaceable>, is wireless interface, <replaceable>wlan0</replaceable>, is
the failover interface. The the failover. The
<replaceable>wlan0</replaceable> device was created from <replaceable>wlan0</replaceable> device was created from
<replaceable>iwn0</replaceable>, which will be configured <replaceable>iwn0</replaceable> wireless interface, which will be configured
with the wired connection's <acronym>MAC</acronym> address. with the <acronym>MAC</acronym> address of the Ethernet interface.
The first step is to determine the <acronym>MAC</acronym> First, determine the <acronym>MAC</acronym>
address of the wired interface:</para> address of the Ethernet interface:</para>
<screen>&prompt.root; <userinput>ifconfig bge0</userinput> <screen>&prompt.root; <userinput>ifconfig <replaceable>bge0</replaceable></userinput>
bge0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500 bge0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500
options=19b&lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4&gt; options=19b&lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4&gt;
ether 00:21:70:da:ae:37 ether 00:21:70:da:ae:37
@ -3674,9 +3661,9 @@ bge0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500
status: active</screen> status: active</screen>
<para>Replace <replaceable>bge0</replaceable> to match the <para>Replace <replaceable>bge0</replaceable> to match the
system's interface name. The <literal>ether</literal> system's Ethernet interface name. The <literal>ether</literal>
line will contain the <acronym>MAC</acronym> address of line will contain the <acronym>MAC</acronym> address of
the wired interface. Now, change the the specified interface. Now, change the
<acronym>MAC</acronym> address of the underlying wireless <acronym>MAC</acronym> address of the underlying wireless
interface:</para> interface:</para>
@ -3687,16 +3674,16 @@ bge0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500
<screen>&prompt.root; <userinput>ifconfig wlan0 create wlandev iwn0 ssid my_router up</userinput></screen> <screen>&prompt.root; <userinput>ifconfig wlan0 create wlandev iwn0 ssid my_router up</userinput></screen>
<para>Bring the <replaceable>bge0</replaceable> interface up. <para>Make sure the <replaceable>bge0</replaceable> interface is up, then
Create the &man.lagg.4; interface with create the &man.lagg.4; interface with
<replaceable>bge0</replaceable> as master, and failover to <replaceable>bge0</replaceable> as master with failover to
<replaceable>wlan0</replaceable>:</para> <replaceable>wlan0</replaceable>:</para>
<screen>&prompt.root; <userinput>ifconfig bge0 up</userinput> <screen>&prompt.root; <userinput>ifconfig bge0 up</userinput>
&prompt.root; <userinput>ifconfig lagg0 create</userinput> &prompt.root; <userinput>ifconfig lagg0 create</userinput>
&prompt.root; <userinput>ifconfig lagg0 up laggproto failover laggport bge0 laggport wlan0</userinput></screen> &prompt.root; <userinput>ifconfig lagg0 up laggproto failover laggport bge0 laggport wlan0</userinput></screen>
<para>The interface will now look something like this:</para> <para>The virtual interface should look something like this:</para>
<screen>&prompt.root; <userinput>ifconfig lagg0</userinput> <screen>&prompt.root; <userinput>ifconfig lagg0</userinput>
lagg0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500 lagg0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500
@ -3713,8 +3700,8 @@ lagg0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 150
<screen>&prompt.root; <userinput>dhclient lagg0</userinput></screen> <screen>&prompt.root; <userinput>dhclient lagg0</userinput></screen>
<para>To retain this configuration across reboots, the <para>To retain this configuration across reboots, add the
following entries can be added to following entries to
<filename>/etc/rc.conf</filename>:</para> <filename>/etc/rc.conf</filename>:</para>
<programlisting>ifconfig_bge0="up" <programlisting>ifconfig_bge0="up"