From owner-freebsd-questions@FreeBSD.ORG Tue Feb 21 07:43:48 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E54FD106564A for ; Tue, 21 Feb 2012 07:43:48 +0000 (UTC) (envelope-from ml@my.gd) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 64E7E8FC13 for ; Tue, 21 Feb 2012 07:43:47 +0000 (UTC) Received: by werm13 with SMTP id m13so5821393wer.13 for ; Mon, 20 Feb 2012 23:43:47 -0800 (PST) Received-SPF: pass (google.com: domain of ml@my.gd designates 10.216.135.76 as permitted sender) client-ip=10.216.135.76; Authentication-Results: mr.google.com; spf=pass (google.com: domain of ml@my.gd designates 10.216.135.76 as permitted sender) smtp.mail=ml@my.gd Received: from mr.google.com ([10.216.135.76]) by 10.216.135.76 with SMTP id t54mr6092018wei.14.1329810227371 (num_hops = 1); Mon, 20 Feb 2012 23:43:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=gamma; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to :x-gm-message-state; bh=GTyXNN5BSx2F20QFZGZatO6SnTjN+CoH0/antcHKjHU=; b=z0qY8bpWIuQZl1Y5NRvOM4TwWAluDtiknBZ0PAcYyN7jfhySHPwvHuA54gGLMReE3+ sqDM55OElHbNWVr1cMUw0+09kPSvBZugzSvixErGJM10B6nK7gJHlfR/g5nGTNjeSqtA yGsxUcriUsaiAwDPDo+vBa2N56I9gouiN4KMo= Received: by 10.216.135.76 with SMTP id t54mr5076972wei.14.1329810227263; Mon, 20 Feb 2012 23:43:47 -0800 (PST) Received: from [192.168.0.12] (did75-17-88-165-130-96.fbx.proxad.net. [88.165.130.96]) by mx.google.com with ESMTPS id df3sm7811987wib.1.2012.02.20.23.43.45 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Feb 2012 23:43:46 -0800 (PST) References: <4F314AFB.8080901@my.gd> <4F3BEA73.9060005@my.gd> <4F3CC11D.1080105@my.gd> In-Reply-To: Mime-Version: 1.0 (iPhone Mail 8J2) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: X-Mailer: iPhone Mail (8J2) From: Damien Fleuriot Date: Tue, 21 Feb 2012 08:43:04 +0100 To: peter knezel X-Gm-Message-State: ALoCoQkJPq/LTErbo+BUqmdRzjMu7NHAnswtHgXliGtuGdspHKRRTjvHVVfJgc/tP0LU2sD6lZOc Cc: "freebsd-questions@freebsd.org" Subject: Re: From analysis of a simple ifstated.conf to more compex example X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 07:43:49 -0000 To be honest, I'm not sure it's a good idea to use different *interfaces*. Why don't you set multiple IPs on a single carp interface instead ? On 21 Feb 2012, at 08:29, peter knezel wrote: > Hello Damien, >=20 > preemption is set on both systems, so when master server goes down or > any CARP interface on master > goes down, slave becomes master (but only on the CARP interface if > only that went down). >=20 > Can you have a look at my previous question??: > if the different carp interfaces > are used for different purpose (ftp, tftp, scp), is it a good idea to > put down all of them, if they are able to serve their purpose? >=20 >=20 > Thanks and kind regards, >=20 > Peter >=20 > On 16/02/2012, Damien Fleuriot wrote: >> Preemption is used to ensure that, if a CARP interface goes down on host >> A, host B will then assume mastership for all interfaces. >>=20 >> It prevents the nasty situation where you'd have, for example: >>=20 >> Public IP: master on host A >> Private IP: master on host B >>=20 >> servers behind firewalls hosts A and B: >> - traffic arrives on host A which creates a PF state >> - servers reply via their default gateway, the CARP IP now master on host= B >>=20 >> Host B doesn't have a state for the traffic, drops it. >>=20 >>=20 >> To enable preemption you need to run sysctl net.inet.carp.preempt=3D1 and= >> add the corresponding line to your sysctls file in etc. >>=20 >>=20 >> On 2/15/12 7:04 PM, peter knezel wrote: >>> Well, >>>=20 >>> I am not fully familiar with CARP, but if the different carp interfaces >>> are used for different purpose (ftp, tftp, scp), is it a good idea to >>> put down all of them, if they are able to serve their purpose? >>>=20 >>> BTW, what is CARP preemption and how is it possible to enable it? >>>=20 >>> Kind regards, >>>=20 >>> Peter >>>=20 >>> On 15 February 2012 18:25, Damien Fleuriot > >>> wrote: >>>=20 >>> Sorry about the late reply, didn't see yours. >>>=20 >>> What about enabling CARP preemption to ensure that when a carp >>> interface >>> goes down, the whole set does ? >>>=20 >>>=20 >>> On 2/7/12 9:13 PM, peter knezel wrote: >>>> Hello Damien, >>>>=20 >>>> I did read your example but cannot get idea from it. >>>> For three interfaces you have much more possibilities. >>>>=20 >>>> Imagine you start the server from uuu state which is equal to >>>> net =3D '( "ifconfig -a -u |grep carp0 > /dev/null" every 3 && >>> "ifconfig -a -u >>>> |grep carp1 > /dev/null" every 3 && "ifconfig -a -u |grep carp2 > >>> /dev/null" >>>> every 3)' >>>>=20 >>>> Now you put down one carp interface - so system is in state : >>>> *state one:* >>>> (duu) || (udu) || (uud) <----which is same as !$net >>>> run script1.sh >>>> go to twoff >>>>=20 >>>> now imagine, you put down any other carp interface: >>>> *state twoff: * >>>> (dud) || (ddu) || (udd) >>>> run script2.sh >>>> go to two >>>>=20 >>>> *state two: * >>>> put all interfaces up >>>> run script3.sh >>>> go to state one >>>>=20 >>>> it means, this is one of the possibilities system can behave (this >>>> situation does not describe all possible states - I have taken this >>>> special example.) >>>>=20 >>>> Now if you want to put up after putting down one carp interface, you >>>> fail since it is in state twoff. >>>> Only of you put down second carp interface it goes to state two and >>> if >>>> you put both up, it will go to state one. >>>>=20 >>>> This is where my ifstated.conf fails to work. >>>>=20 >>>> Kind regards, >>>>=20 >>>> Peter Knezel >>>>=20 >>>>=20 >>>> On 7 February 2012 17:02, Damien Fleuriot >> >> >>>> wrote: >>>>=20 >>>> On 2/7/12 3:36 PM, peter knezel wrote: >>>>> Hello all, >>>>>=20 >>>>> I would like to ask somebody to explain me how the ifstated >>> works >>>> according to >>>>> the following configuration file. >>>>> I have three virtual carp interfaces carp0,carp1 and carp2. >>>>>=20 >>>>> I try to understand the following setting: >>>>> The server is in state one (all carp interfaces are up) and >>> if there >>>>> is carp down of any: >>>>> one (carp0 or carp1 or carp2), >>>>> two ([carp0 and carp1] or [carp0 and carp2] or [carp1 and >>> carp2]), >>>>> three interfaces (carp 0 and carp1 and carp2), server >>>>> runs the script testdown.sh and put the server into state two. >>>>> If all carp interfaces are up, the server runs the testup.sh >>> and set >>>>> the state to one. >>>>>=20 >>>>=20 >>>> That is my understanding. >>>>=20 >>>>=20 >>>>> Is it the way the system works? >>>>> Or am I wrong? >>>>>=20 >>>>> =3D=3D=3D >>>>> init-state one >>>>>=20 >>>>> net =3D '( "ifconfig -a -u |grep carp0 > /dev/null" every 3 && >>>> "ifconfig -a -u >>>>> |grep carp1 > /dev/null" every 3 && "ifconfig -a -u |grep >>> carp2 > >>>> /dev/null" >>>>> every 3)' >>>>>=20 >>>>> state one { >>>>> if ( ! $net ) { >>>>> run "/usr/local/testdown.sh" >>>>> set-state two >>>>> } >>>>> } >>>>>=20 >>>>> state two { >>>>> if ( $net ) { >>>>> run "/usr/local/testup.sh" >>>>> set-state one >>>>> } >>>>> } >>>>> =3D=3D=3D >>>>>=20 >>>>> Is there any possibility to define and set ifstated.conf that >>>> reacts when: >>>>>=20 >>>>> any one of the carp interfaces is down - followed by >>> another any >>>>> other carp interface down >>>>>=20 >>>>>=20 >>>>> I tried to define states: >>>>>=20 >>>>> duu =3D"!carp0.link.up && carp1.link.up && carp2.link.up" >>>>> udu =3D"carp0.link.up && !carp1.link.up && carp2.link.up" >>>>> uud =3D"carp0.link.up && carp1.link.up && !carp2.link.up" >>>>> ddu =3D"!carp0.link.up && !carp1.link.up" >>>>> dud =3D"!carp0.link.up && !carp2.link.up" >>>>> udd =3D"!carp1.link.up && !carp2.link.up" >>>>>=20 >>>>> and used them but somehow I cannot incorporate all state >>> changes and >>>>> include it in ifstated.conf. >>>>>=20 >>>>=20 >>>>=20 >>>> Works fine here, did you not have any luck with the file I >>> posted >>>> earlier ? >>>> _______________________________________________ >>>> freebsd-questions@freebsd.org >>> >>> >> > >>>> mailing list >>>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>>> To unsubscribe, send any mail to >>>> "freebsd-questions-unsubscribe@freebsd.org >>> >>>> >> >" >>>>=20 >>>>=20 >>>=20 >>>=20 >>=20