[DRBD-user] IP 192.168.1.2 not found on this host.

Todd Denniston Todd.Denniston at ssa.crane.navy.mil
Tue Apr 27 16:02:54 CEST 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Eugene Crosser wrote:
> 
<SNIP>
> 
> As to the local IP, when I need it I get it with an ugly sed/awk script
> run against the output of /sbin/ifconfig.  Possibly a more elegant way
> exists...
> 
yes I thought for a while that `hostname -a` and `hostname -i` could help me,
but I found that they depend on the way your /etc/hosts file is setup and did
not return any of the data that described eth0:0 and eth1, so it was less than
useful for me.

Now I just go with tried and true ifconfig, some of my scripts need to know if
they are being ran on a machine that has direct (not NFS) access to the disk
for cvs work:
CVS_MACHINE=cvs
AmI_OnTheCVS_Machine()
{
  if tty >> /dev/null
  then
    PCOMMAND="echo \"yes\""
    NCOMMAND="echo \"Not $CVS_MACHINE\""
  else
    PCOMMAND="exit 0"
    NCOMMAND="exit 1"
  fi
  #if we are on a machine that does not support host, the following should 
  #fail.
  if which host >> /dev/null
  then
    if /sbin/ifconfig | grep -B1 \
     "`host $CVS_MACHINE | grep "has address"|awk '{print $4}'`" \
     >> /dev/null
    then 
      $PCOMMAND
    else 
      $NCOMMAND
    fi
  else
    $NCOMMAND
  fi
}
<SNIP>
-- 
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane) 
Harnessing the Power of Technology for the Warfighter



More information about the drbd-user mailing list