From owner-freebsd-questions@FreeBSD.ORG Thu Feb 2 10:49:05 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 9F859106564A for ; Thu, 2 Feb 2012 10:49:05 +0000 (UTC) (envelope-from peter.knezel@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1A0A98FC0A for ; Thu, 2 Feb 2012 10:49:04 +0000 (UTC) Received: by lagz14 with SMTP id z14so1554601lag.13 for ; Thu, 02 Feb 2012 02:49:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Owqw5UGlXzQu2THL3ARGwmeaI8+BcouSvgtjGPMojyg=; b=V/3XC+Zj5Unwunbfm8/EwtocGDzucmEDB9vEu3jPE51tAKi1DT5Xdo0O8zKtMxb0Qq TO+Qv0q7Kw6LrNxH21ArXmLtPJrBFtPsrgCBn0NCMBxn4pOabog5hNy6ei/pWFUjE5LA BaDGssnG+cMUH38rjfbOPII0hwM8JyvG5NY6k= MIME-Version: 1.0 Received: by 10.112.47.225 with SMTP id g1mr613293lbn.52.1328179742935; Thu, 02 Feb 2012 02:49:02 -0800 (PST) Received: by 10.152.43.71 with HTTP; Thu, 2 Feb 2012 02:49:02 -0800 (PST) In-Reply-To: References: <4F292596.2090000@my.gd> Date: Thu, 2 Feb 2012 11:49:02 +0100 Message-ID: From: peter knezel To: Damien Fleuriot Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@freebsd.org Subject: Re: carp+devd+ifstated on master problem 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: Thu, 02 Feb 2012 10:49:05 -0000 I have looked a bit into the ifstated.conf file and realized, that it does not behave as I want. So currently the setting is the following: cat /usr/local/etc/ifstated.conf init-state one net = '( "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)' state one { if ( ! $net ) { run "/sbin/ifconfig_carp0 vhid 1 pass newpass 192.xx.xx.1/24" run "/sbin/ifconfig carp1 vhid 2 pass newpass 192.xx.xx.2/24" run "/sbin/ifconfig carp2 vhid 3 pass newpass 192.xx.xx.3/24" run "/usr/local/testup.sh" set-state two } } state two { if ( $net ) { run "/usr/local/testup.sh" set-state one } } When I do ifconfig carp0 down/up script run testdown.sh/testup.sh but not valid for carp1,carp2. It immediately brings up carp1/carp2 and runs testup.sh after executing testdown.sh if triggered with ifconfig carp1 down (or ifconfig carp2 down). Peter On 02/02/2012, peter knezel wrote: > Hello Damien, > > of course, the tnewpass was my copy error - newpass is OK and is in > config files everywhere. > And the carp interfaces' advskew, vhid and > pass are already in /etc/rc.conf.local. > > What I simply would like to try is run scripts if carp interfaces change. > Actually my real aim is to synchronize file from slave server to > master if master reboots or slave becomes master due to carp problems > on the master. > Regards, > Peter > > > On 01/02/2012, Damien Fleuriot wrote: >> >> >> On 2/1/12 12:12 PM, peter knezel wrote: >>> Hello all, >>> >>> I have configured devd and ifstated on a master FreeBSD server (slave >>> not changed so far) on which carp was configured with three >>> carp0,carp1 and carp2 virtual addresses. >>> >>> When I as root do ifconfig carp0 down and up, the corresponding >>> testdown.sh and testup.sh >>> scripts are run (defined in ifstated.conf). >>> The status of carp0 interface changes to INIT then to MASTER (after >>> ifconfig carp0 up). >>> >>> However this is not valid when doing the same with carp1 or carp2. >>> It goes to INIT+testdown.sh executed but then immediately afterwards >>> it goes to MASTER+testup.sh executed. >>> >>> What can be the problem? >>> >>> cd /usr/local/etc >>> cat ifstated.conf >>> init-state one >>> >>> net = '( "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)' >>> >>> state one { >>> if ( ! $net ) { >>> run "/sbin/ifconfig_carp0 vhid 1 pass newpass >>> 192.xx.xx.1/24" >>> run "/sbin/ifconfig carp1 vhid 2 pass newpass >>> 192.xx.xx.2/24" >>> run "/sbin/ifconfig carp2 vhid 3 pass newpass >>> 192.xx.xx.3/24" >>> run "/usr/local/testdown.sh" >>> set-state two >>> } >>> } >>> >>> state two { >>> if ( $net ) { >>> run "/sbin/ifconfig carp0 vhid 1 advskew 100 pass >>> tnewpass 192.xx.xx.1/24" >>> run "/sbin/ifconfig carp1 vhid 2 advskew 100 pass >>> newpass 192.xx.xx.2/24" >>> run "/sbin/ifconfig carp2 vhid 3 advskew 100 pass >>> newpass 192.xx.xx.3/24" >>> run "/usr/local/testup.sh" >>> set-state one >>> } >>> } >>> >>> In addition I had to configure devd.conf to have ifdown.sh and ifup.sh >>> scripts executed when reboot is done on the master. >>> >>> notify 30 { >>> match "system" "IFNET"; >>> match "subsystem" "carp0"; >>> match "type" "LINK_UP"; >>> action "/usr/local/etc/rc.d/ifdown.sh"; >>> }; >>> >>> notify 30 { >>> match "system" "IFNET"; >>> match "subsystem" "carp0"; >>> match "type" "LINK_DOWN"; >>> action "/usr/local/etc/rc.d/ifup.sh"; >>> >>> Thanks for any suggestion in advance. >>> >>> Ardi >> >> I'm not sure I get what you're trying to do here. >> >> Is there a reason you do not set your carp interfaces' advskew, vhid and >> pass in /etc/rc.conf ? >> >> Also, I notice in state 2 your password for carp0 is tnewpass, while the >> other ones are newpass. >> >> _______________________________________________ >> 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" >> >