Subject: Re: [vserver] Automatic gratuitous ARP on startup
From: Thomas Gebhardt <gebhardt@hrz.uni-marburg.de>
Date: Mon, 22 Aug 2011 09:58:53 +0200

Hello,

> Anyways, I would love to issue a gratuitous ARP (arping) when a vserver
> comes up, using the normal vserver-util framework. My hope is to find
> something akin to the "up do-stuff" ability of /etc/network/interfaces
> control file for ifup/ifdown. 

we've got the following script in
/etc/vservers/.defaults/scripts/pre-start.d

Cheers, Thomas

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SCRIPT=`basename $0`
VCFG=/etc/vservers/$2

[ -d $VCFG ] || { echo "$SCRIPT - $VCFG: No such directory" >&2; exit 1 ;}

for ipf in `ls $VCFG/interfaces/*/ip`; do

  [ -f $ipf ] || { echo "$SCRIPT - $ipf: No such file" >&2; exit 1 ;}

  IP=`head -n 1 $ipf`
  echo "arping -S $IP -B"
  timeout -15 2 arping -S $IP -B -q  2>&1 | grep -e "Timeout: aborting
command \`\`arping'' with signal 15" -q \
    || { echo "$SCRIPT - timeout command failed" >&2; exit 1 ;}
  echo "done"

done