# LACP + CARP behavior question



## thaungod (Jul 3, 2018)

Hello everyone,

I've succeeded in configuring Link Aggregation together with CARP. The type of aggregation I use is LACP. It makes load balancing between two interfaces combined into lagg interface:

```
em0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=98<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
em1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=98<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
lagg0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=98<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        inet 192.168.0.1 netmask 0xfffffff8 broadcast 192.168.0.7
        inet 192.168.0.3 netmask 0xfffffff8 broadcast 192.168.0.7 vhid 1
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        carp: MASTER vhid 1 advbase 1 advskew 100
        groups: lagg
        laggproto lacp lagghash l2,l3,l4
        laggport: em0 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
        laggport: em1 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
```

The issue is that when I plug a network cable off em1, the IP 192.168.0.1 remains accessible which is correct. However, the CARP IP 192.168.0.3 changes its state to BACKUP:

```
em1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=98<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
lagg0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=98<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        inet 192.168.0.1 netmask 0xfffffff8 broadcast 192.168.0.7
        inet 192.168.0.3 netmask 0xfffffff8 broadcast 192.168.0.7 vhid 1
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        carp: BACKUP vhid 1 advbase 1 advskew 100
        groups: lagg
        laggproto lacp lagghash l2,l3,l4
        laggport: em0 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
        laggport: em1 flags=0<>
```

I believe this is due to the following sysctl option:

```
net.inet.carp.demotion: 240
```

The question is how to keep the state MASTER if one interface in pair goes down?
And change it to BACKUP only if both em0 and em1 interfaces are down.


----------

