FreeNAS™ uses FreeBSD's lagg(4) interface to provide link aggregation and link failover. The lagg interface allows aggregation of multiple network interfaces into a single virtual lagg interface, providing fault-tolerance and high-speed multi-link throughput. The aggregation protocols supported by lagg determine which ports are used for outgoing traffic and whether a specific port accepts incoming traffic. Lagg's interface link state is used to validate if the port is active or not.
Aggregation works best on switches supporting LACP, which distributes traffic bi-directionally while responding to failure of individual links. FreeNAS™ also supports active/passive failover between pairs of links.
Important notice regarding aggregation performance: the LACP, FEC and load-balance modes select the output interface using a hash that includes the Ethernet source and destination address, VLAN tag (if available), IP source and destination address, and flow label (IPv6 only). The benefit can only be observed when multiple clients are transfering files from your NAS. The flow entering into your NAS depends on the Ethernet switch load-balance algorithm.
NOTE: LACP and other forms of link aggregation generally do not work well with virtualization solutions. In a virtualized environment, consider the use of iSCSI MPIO through the creation of an iSCSI Portal. This allows an iSCSI initiator to recognize multiple links to a target, utilizing them for increased bandwidth or redundancy. This how-to contains instructions for configuring MPIO on ESXi.
The lagg driver currently supports the following aggregation protocols:
Failover: the default protocol. 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. By default, received traffic is only accepted when received through the active port. This constraint can be relaxed by setting the net.link.lagg.failover_rx_all sysctl(8) variable to a non-zero value, which is useful for certain bridged network setups.
FEC: supports Cisco EtherChannel. This is a static setup and does not negotiate aggregation with the peer or exchange frames to monitor the link. It's an alias to the "Load Balance" mode.
LACP: supports the IEEE 802.3ad Link Aggregation Control Protocol (LACP) and the Marker Protocol. LACP will negotiate a set of aggregable links with the peer into one or more link aggregated groups (LAG). 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. LACP must be configured on the switch as well.
Load Balance: 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.
Round Robin: distributes outgoing traffic using a round-robin scheduler through all active ports and accepts incoming traffic from any active port. Note that this mode can cause "un-ordoned" packet arrival to your client, having a second side effect of limiting the throughtput (because re-ordoning packets can be CPU intensive on the client).
None: this protocol is intended to do nothing: it disables any traffic without disabling the lagg interface itself.
NOTE: The FreeNAS™ system must be rebooted after configuring the lagg device and TCP access will be lost during reboot. The interfaces used in the lagg device should not be configured before creating the lagg device.
Figure 5.3a shows the configuration options when adding a lagg interface using Network -> Link Aggregations -> Create Link Aggregation.
Figure 5.3a: Creating a lagg Interface
NOTE: if interfaces are installed but do not appear in the Physical NICs in the LAGG list, check that a FreeBSD driver for the interface exists here.
Select the desired aggregation protocol, highlight the interface(s) to associate with the lagg device, and click the OK button.
Once the lagg device has been created, it will be listed in the tree under an entry which indicates the type of protocol. As seen in Figure 5.3b, it will also appear in View Link Aggregations.
Figure 5.3b: Viewing Link Aggregations
Each link aggregation entry provides buttons to edit the LAGG interface, edit its member interfaces, or to delete the link aggregation.
Figure 5.3c shows the Edit Interface configuration screen and Table 5.3a describes the options in this screen.
Figure 5.3c: Edit LAGG Interface
Table 5.3a: Configurable Options for a lagg Interface
|NIC||string||read-only as automatically assigned next available numeric ID|
|Interface Name||string||by default same as device (NIC) name, can be changed to a more descriptive value|
|DHCP||checkbox||check if the lagg device gets its IP address info from DHCP server|
|IPv4 Address||string||mandatory if DHCP is left unchecked|
|IPv4 Netmask||drop-down menu||mandatory if DHCP is left unchecked|
|Auto configure IPv6||checkbox||check only if DHCP server available to provide IPv6 address info|
|IPv6 Prefix Length||drop-down menu||required if input IPv6 address|
|Options||string||additional ifconfig(8) options|
This screen also allows you to configure an alias for the lagg interface. If you wish to set multiple aliases, click the "Add extra alias" link for each alias you wish to configure.
If you click an entry's Edit Members button, the interfaces within the link aggregation will be listed. Each interface entry will have an Edit and a Delete button. Figure 5.3d shows the configuration screen that appears when you click the Edit button of a member interface. The configurable options are summarized in Table 5.3b.
Figure 5.3d: Editing a Member Interface
Table 5.3b: Configuring a Member Interface
|LAGG Interface group||drop-down menu||select the member interface to configure|
|LAGG Priority Number||integer||order of selected interface within the lagg; configure a failover to set the master interface to 0, other interfaces are set 1, 2, etc.|
|Physical NIC||drop-down menu||physical interface of the selected member|
|Options||string||additional parameters from ifconfig(8)|
NOTE: you can set options such as the MTU (to enable jumbo frames) at either the edit interface level or at the edit members level. You do not have to set the option at both levels as each level will automatically inherit its options from the other. However, it makes sense to set it at the edit interface level (Figure 5.3c) as each interface member will inherit from the lagg. If you set it at the members level (Figure 5.3d), you will have to repeat the configuration for each member within the lagg. It is important to not set differing options at the interface and the members level as this will confuse the lagg device. Also, do not set jumbo frames if the attached switch does not support jumbo frames.