Link aggregation is logical grouping of multiple physical interfaces to get :
1. Increased Bandwidth
2. Automatic failover/failback and redundancy
3. load balancing
Pre-Requisites for aggregation
There are 2 major requirements to configure a link aggregation :
1. All the interfaces in an aggregation must run at same speed and in full-duplex mode.
2. All the interfaces must have an unique mac address. (this can be done by setting local-mac-address? parameter to true in eeprom command )
Load balancing policies
Below are the possible load balancing policies to determine which interface to be used for outgoing traffic.
Policy | Outgoing link decided by |
---|---|
L2 | hashing MAC (L2) header of each packet |
L3 | hashing IP (L3) header of each packet |
L4 (default policy) | hashing TCP, UDP, or other ULP (L4) header of each packet |
To modify the aggregation policy :
# dladm modify-aggr -P [L2|L3|L4] [aggr]
Aggregation Modes
When the aggregation is done through switch, we must ensure that switch supports link aggregation control protocol (LACP). Depending on the way LACP packets (LACPDUs) are generated, LACP can operate in 3 modes :
Mode | Description |
---|---|
Off mode (default mode) | LACPDUs are not generated |
Active mode | LACPDUs are generated by system at regular interval defined by user |
Passive mode | system generates an LACPDU only when it receives an LACPDU from switch |
To modify aggregation mode :
# dladm modify-aggr -L [LACP-mode] -T [timer-value] aggr timer-value --> long|short LACP-mode --> active|passive|off
Example Configuration
In the example below I have used 4 physical interfaces (net0 through net3) to configure link aggregation aggr0.
1. To list the network interfaces currently configured in the system :
# dladm show-link LINK CLASS MTU STATE OVER net0 phys 1500 unknown -- net1 phys 1500 unknown -- net2 phys 1500 unknown -- net3 phys 1500 unknown --
2. Create the link aggregation named aggr0 consisting of the interfaces net0, net1, net2 and net3.
# dladm create-aggr -l net0 -l net1 -l net2 -l net3 aggr0
3. Verify the aggregation status of aggr0. As you can see below the default load balancing policy is set to L4, which can be set to other value anytime later.
# dladm show-aggr LINK MODE POLICY ADDRPOLICY LACPACTIVITY LACPTIMER aggr0 trunk L4 auto off short
4. If you check the interfaces status, you’ll find a new interfaces being shown called aggr0.
# dladm show-link LINK CLASS MTU STATE OVER net0 phys 1500 up -- net1 phys 1500 up -- net2 phys 1500 up -- net3 phys 1500 up -- aggr0 aggr 1500 up net0 net1 net2 net3
5. Create an IP interfaces for the data link aggr0 we just created and verify the results:
# ipadm create-ip aggr0
# ipadm show-if IFNAME CLASS STATE ACTIVE OVER lo0 loopback ok yes -- aggr0 ip down no --
6. Run the ipadm command to create a static IPv4 address on the aggr0 interface and verify the results :
# ipadm create-addr -T static -a 192.168.1.120/24 aggr0/v4
# ipadm show-addr ADDROBJ TYPE STATE ADDR lo0/v4 static ok 127.0.0.1/8 aggr0/v4 static ok 192.168.1.120/24 lo0/v6 static ok ::1/128
Add/Remove interface(s) to/from Aggregation
To remove interface net3 from aggregation:
# dladm remove-aggr -l net3 aggr0
To add the interface net3 back into the aggregation:
# dladm add-aggr -l net3 aggr0
Removing the Link Aggregation
1. Use the ipadm command to delete the aggr0 Ip interface first.
# ipadm delete-ip aggr0
# ipadm show-addr ADDROBJ TYPE STATE ADDR lo0/v4 static ok 127.0.0.1/8 lo0/v6 static ok ::1/128
2. Now delete the aggregation using the dladm command.
# dladm delete-aggr aggr0
# dladm show-link LINK CLASS MTU STATE OVER net0 phys 1500 unknown -- net1 phys 1500 unknown -- net2 phys 1500 unknown -- net3 phys 1500 unknown --
verify if the aggregation is completely removed :
# ipadm show-if IFNAME CLASS STATE ACTIVE OVER lo0 loopback ok yes --