# Adding an alias while using CARP with multiple IP aliases



## MrLudo (Feb 5, 2018)

I am currently using exactly the same approach with CARP as described in a prior posting to the stable mailing list, https://groups.google.com/forum/#!topic/mailing.freebsd.stable/-NiHmBWMulY .

I have noticed in my router lab that the MASTER goes into BACKUP mode briefly whenever a new alias participating in the CARP is added or removed.

This happens irrespective of whether the second host of the CARPed pair is down.

Is there a way to avoid this bump or am I stuck with a brief break in service while adding or removing aliases ?

To put this question another way...  what is the smoothest way to introduce a new alias into a multi-address vhid group ?


----------



## phoenix (Feb 5, 2018)

As the author of that thread, I can say that I have never run into the issue you mention.    However, we rarely ever added new aliases to the CARP config.  And, on the occasions that we did, it entailed adding a new firewall script to setup IPFW (including NAT), and reloading the firewall rules (to make sure everything was in place).  Eventually, I figured out how to use IPFW rulesets to do atomic reloading of firewall rules for this, but prior to that, everything would go down for however long it took to load the firewall rules.  Thus, we would never notice any downtime due to CARP as the downtime due to IPFW would mask it.

How are you adding the aliases to the CARP group?  And are you adding them to both the MASTER and the SLAVE at the same time (if the IP lists in the vhid get out-of-sync between the hosts, a CARP election and/or fail-over takes place)?

Note:  we no longer use FreeBSD for the firewalls/routers, so I no longer have any CARP setups in place.


----------



## MrLudo (Feb 5, 2018)

In my lab I have been using the following setup:

lab3 & lab4 are a functioning CARP pair with pre-emption enabled.

lab4 is down during this test.

`lab3# ifconfig vlan12

vlan12: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: lab_private_core
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:00:24:d1:67:ba
        inet 10.168.1.126 netmask 0xffffff00 broadcast 10.168.1.255
        inet 10.168.1.249 netmask 0xffffffff broadcast 10.168.1.249 vhid 249
        inet 10.168.1.128 netmask 0xffffffff broadcast 10.168.1.128 vhid 249
        inet 10.168.1.228 netmask 0xffffffff broadcast 10.168.1.228 vhid 249
        inet 10.168.1.229 netmask 0xffffffff broadcast 10.168.1.229 vhid 249
        inet 10.168.1.230 netmask 0xffffffff broadcast 10.168.1.230 vhid 249
        inet 10.168.1.231 netmask 0xffffffff broadcast 10.168.1.231 vhid 249
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        vlan: 12 parent interface: lagg1
        carp: MASTER vhid 249 advbase 1 advskew 80`

i have then added an alias with

`lab3# ifconfig vlan12 inet 10.168.1.232 netmask 0xffffffff vhid 249 alias`

and then removed it:

`lab3# ifconfig vlan12 inet 10.168.1.232 netmask 0xffffffff vhid 249 -alias`

When I add the alias, lab3 goes into BACKUP mode then switches back to MASTER mode.

Regarding "if the IP lists in the vhid get out-of-sync between the hosts, a CARP election and/or fail-over takes place" ... I have seen both lab3 & lab4 go into MASTER mode when the alias is added to lab3 only so it would appear that both members elect themselves when the CARP group is out of sync and both members are up.


----------

