On Mon, Jul 07, 2014 at 08:44:43PM +0200, Mxher wrote:
> Hello again,
> 
> I'm doing few more tests and now I'm wondering if this is possible to
> disallow CARP to have some resources on serverA and others on serverB?

Have you set the sysctl net.inet.carp.preempt=1?

> 
> Here is my tests (advbase=1 and advskew=0 for every interfaces on both
> servers):

advskew should be different on master from backkup. Try advskew=200 on
obsd2.

Please read man carp. The first example is exactly what you need.

> * Initial state
> root@obsd1:~# ifconfig HA |grep status
>         status: master
>         status: master
>         status: master
>         status: master
> root@obsd2:~# ifconfig HA |grep status
>         status: backup
>         status: backup
>         status: backup
>         status: backup
> 
> * I unplugged em2 and em3 on obsd2 and em1 on obsd1:
> root@obsd1:~# ifconfig HA |grep status
>         status: master
>         status: invalid
>         status: master
>         status: master
> root@obsd2:~# ifconfig HA |grep status
>         status: backup
>         status: master
>         status: invalid
>         status: invalid
> 
> 
> obsd2 became master for em1 while obsd1 is master for everything else.
> Is there any (proper and automatic) way to avoid that ?
> 
> I know that kind of situation will not happens often but...
> 
> 
> Thanks again!
> 
> 
> Le 06/07/2014 13:13, Mxher a écrit :
> > Le 06/07/2014 12:05, Otto Moerbeek a écrit :
> >> On Sun, Jul 06, 2014 at 10:59:16AM +0200, Janne Johansson wrote:
> >>
> >>> The sysctl for carp.preempt controls if they should all fail at the same
> >>> time.
> >>
> >> read carp(4). It contains answers to some questions asked.
> >>
> >>    -Otto
> >>
> > 
> >>> Den 6 jul 2014 10:12 skrev "Adam Thompson" <athom...@athompso.net>:
> >>>> I recall someone pointing out that interface groups of carp interfaces
> >>>> will all transition simultaneously.  I find ifconfig(8) inconclusive; run
> >>>> your own tests and if that works, you have a built-in solution for 
> >>>> keeping
> >>>> all the carp interfaces in sync.
> >>>> Then, use ifstated to manage the pppoe interfaces depending on ifstate of
> >>>> the relevant wan interface?  You could set up a carp interface with no IP
> >>>> address bound, set it into the common if group and it would go up/down 
> >>>> with
> >>>> the other carp ifs.
> >>>> Maybe.  I haven't tried anything like that myself.
> >>>> -Adam
> > 
> > I run some tests and this is working as expected!
> > 
> > Only thing I see is that there will be no group failback if this is a
> > virtual carp interface which goes down.
> > 
> > To be clear if the parent interface of carp2 goes down the whole group
> > will switch but not if carp2 goes down by itself (by an admin mistake
> > for example):
> > * initial states
> > root@obsd1:~# sysctl -a|grep preem
> > net.inet.carp.preempt=1
> > root@obsd1:~# ifconfig HA |grep status
> >         status: master
> >         status: master
> >         status: master
> >         status: master
> > 
> > root@obsd2:~# sysctl -a|grep preem
> > net.inet.carp.preempt=1
> > root@obsd2:~# ifconfig HA |grep status
> >         status: backup
> >         status: backup
> >         status: backup
> >         status: backup
> > 
> > 
> > * states with carp2 down on obsd1
> > root@obsd1:~# ifconfig carp2 down
> > root@obsd1:~# ifconfig HA |grep status
> >         status: master
> >         status: master
> >         status: invalid
> >         status: master
> > 
> > root@obsd2:~# ifconfig HA |grep status
> >         status: backup
> >         status: backup
> >         status: master
> >         status: backup
> > 
> > 
> > * also unfortunately when carp2 goes UP again on obsd1 it still remains
> > on obsd2:
> > root@obsd1:~# ifconfig carp2 up
> > root@obsd1:~# ifconfig HA |grep status
> >         status: master
> >         status: master
> >         status: backup
> >         status: master
> > 
> > root@obsd2:~# ifconfig HA |grep status
> >         status: backup
> >         status: backup
> >         status: master
> >         status: backup
> > 
> > 
> > Anyway I think this is an acceptable risk.
> > 
> > 
> > @Adam: I will now try to use ifstated to manage pppoe interfaces like
> > you suggest.
> > 
> > 
> > Thanks to everyone of you.

Reply via email to