> For the complete documentation index, see [llms.txt](https://jncia-workbook.gitbook.io/workbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jncia-workbook.gitbook.io/workbook/junos-switching/3-lacp.md).

# 3) LACP

### Pre-Work

Load the config called **lab3.cfg** using the **load\_config\_on\_nodes.py** script.

```
python3 load_config_on_nodes.py --lab_dir switched-lan --config_filename lab3.cfg
```

### Lab

<figure><img src="/files/OJb5GDNdZIT0krR0ADjV" alt=""><figcaption></figcaption></figure>

Lab 1 and 2 are already pre-configured. Our goal is to add R1 to this LAN. First we'll setup an LACP LAG/bundle between R1 and SW1. Do so with the following parameters:

* On both R1 and SW1, `ge-0/0/0` and `ge-0/0/1` should belong to `ae1`.
* Use LACP active mode on both sides.
* Both devices should send slow LACP PDUs (every 30 seconds).
* If any one link goes down, the entire bundle should go down.
* On SW1, `ae1` should be a trunk carrying both the PROD and DEV VLANs.
  * We will configure the R1 side in the next lab.

### Answer

<details>

<summary>Expand to reveal</summary>

```
# Both R1 and SW1
set chassis aggregated-devices ethernet device-count 2
set interfaces ge-0/0/0 gigether-options 802.3ad ae1
set interfaces ge-0/0/1 gigether-options 802.3ad ae1
set interfaces ae1 aggregated-ether-options lacp active
set interfaces ae1 aggregated-ether-options lacp periodic slow
set interfaces ae1 aggregated-ether-options minimum-links 2
set interfaces ae1 unit 0

# SW1
set interfaces ae1.0 family ethernet-switching interface-mode trunk
set interfaces ae1.0 family ethernet-switching vlan members [ PROD DEV ] 
```

\
Note that without a `unit` under `ae1`, LACP will not attempt to come up.

</details>

### Explanation

<details>

<summary>Expand to reveal</summary>

First, when using aggregate-ethernet interfaces, we must use the below command:

```
set chassis aggregated-devices ethernet device-count <num>
```

\
This will allow us to configure up to `<num>` aggregate-ethernet interfaces, starting at number `0`. So if we use `device-cout 10`, then we can configure `ae0` through `ae9`. Since we are asked to use `ae1` in this lab, the minimum acceptable number is `2`.

\
We can use the following show command to see LACP information:

```
admin@R1> show lacp interfaces 
Aggregated interface: ae1
    LACP state:           Role   Exp   Def  Dist  Col  Syn  Aggr  Timeout  Activity
      ge-0/0/0           Actor    No    No   Yes  Yes  Yes   Yes     Slow    Active
      ge-0/0/0         Partner    No    No   Yes  Yes  Yes   Yes     Slow    Active
      ge-0/0/1           Actor    No    No   Yes  Yes  Yes   Yes     Slow    Active
      ge-0/0/1         Partner    No    No   Yes  Yes  Yes   Yes     Slow    Active
    LACP protocol:        Receive State  Transmit State          Mux State 
      ge-0/0/0                  Current   Slow periodic Collecting distributing
      ge-0/0/1                  Current   Slow periodic Collecting distributing

```

\
We can also see LACP PDU tx/rx counts per interface:

```
admin@R1> show lacp statistics interfaces ge-0/0/0 
Aggregated interface: ae1
    LACP Statistics:       LACP Rx     LACP Tx   Unknown Rx   Illegal Rx
      ge-0/0/0                   6          21            0            0
```

\
More detail can be seen with the `show interfaces` command as well, including the system IDs and port priorities.

```
admin@R1> show interfaces ae1.0 detail  
  Logical interface ae1.0 (Index 345) (SNMP ifIndex 554) (Generation 164)
    Flags: Up SNMP-Traps 0x4004000 Encapsulation: ENET2
    Statistics        Packets        pps         Bytes          bps
    Bundle:
        Input :            21          0           962          144
        Output:             0          0             0            0
    Adaptive Statistics:
        Adaptive Adjusts:          0
        Adaptive Scans  :          0
        Adaptive Updates:          0
    Link:
      ge-0/0/0.0
        Input :            17          0           726          144
        Output:             0          0             0            0
      ge-0/0/1.0
        Input :             4          0           236            0
        Output:             0          0             0            0


    Aggregate member links: 2

    LACP info:        Role     System             System       Port     Port    Port 
                             priority         identifier   priority   number     key 
      ge-0/0/0.0     Actor        127  2c:6b:f5:b6:1d:c0        127        1       2
      ge-0/0/0.0   Partner        127  2c:6b:f5:90:01:c0        127        1       2
      ge-0/0/1.0     Actor        127  2c:6b:f5:b6:1d:c0        127        2       2
      ge-0/0/1.0   Partner        127  2c:6b:f5:90:01:c0        127        2       2
    LACP Statistics:       LACP Rx     LACP Tx   Unknown Rx   Illegal Rx
      ge-0/0/0.0                 5          21            0            0
      ge-0/0/1.0                 5          21            0            0
    Marker Statistics:   Marker Rx     Resp Tx      Lacp Rx      Lacp Tx   Unknown Rx   Illegal Rx
      ge-0/0/0.0                 0           0            5           21            0            0
      ge-0/0/1.0                 0           0            5           21            0            0
    Protocol multiservice, MTU: Unlimited, Generation: 169, Route table: 0
      Flags: Is-Primary, 0x0
      Policer: Input: __default_arp_policer__

```

\
Note that by default, Junos uses LACP fast periodic PDUs. These are sent once per second. This lab asks us to use slow PDUs, sent once every 30 seconds:

```
set interfaces ae1 aggregated-ether-options lacp periodic slow
```

\
Be aware that both sides do not have to have matching LACP PDU timers. One side can use `slow` and one side can use `fast` and the ae interface will still come up. Each side will send at a rate that the *other* side has configured. For example, if R1 is configured for `fast` and R2 is configured for `slow`, R1 will send at once per 30 seconds and R2 will send at once per second. (This is not a Juniper-specific thing, it is how LACP works in general).

\
We can use the `minimum-links` configuration knob to require the bundle to have a minimum number of links to stay up. If the number of links up falls below the minimum, the ae interface will go down.

```
set interfaces ae1 aggregated-ether-options minimum-links 2 
```

\
For example, if `ge-0/0/0` goes down, `ae1` will go down too:

```
[edit]
admin@R1# set interfaces ge-0/0/0 disable 

[edit]
admin@R1# commit 
commit complete

[edit]
admin@R1# run show interfaces ae1 terse 
Interface               Admin Link Proto    Local                 Remote
ae1                     up    down
ae1.0                   up    down multiservice
```

</details>

### Further Reading

<https://www.networkcuriosity.com/junos-aggregated-ethernet-example/>

<https://www.juniper.net/documentation/us/en/software/junos/interfaces-security-devices/topics/topic-map/security-interface-config-lacp.html>
