*BSD News Article 82405


Return to BSD News archive

#! rnews 1716 bsd
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!newsfeed.internetmci.com!info.ucla.edu!psgrain!news.rain.net!199.227.219.134
From: Christopher Darrell <qj@wlci.com>
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: Virtual Domain help please
Date: Wed, 06 Nov 1996 08:56:39 -0500
Organization: Weblink Communications
Lines: 39
Message-ID: <32809916.41C67EA6@wlci.com>
References: <E02tr9.FAM@eskimo.com>
NNTP-Posting-Host: atheria.europa.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; I; BSD/OS 2.0 i386)

Mark Dreyer wrote:
> 
>   I have begun setting up to host virtual domains and have found all
> information necessary (I believe) with the exception of how to get my
> ethernet card to respond to two ip addresses.  Can anyone help me with this?


You do this with the ifconfig command.. here is a small perl script I
use to handle this: (this example expects perl5 to be in /usr/local/bin)




#!/usr/local/bin/perl
open(INPUT,"/usr/local/etc/ipstohost.txt") || die("Cannot open
ipstohost.txt");
my $counter;
while(<INPUT>){
  chomp;
  system("ifconfig","ne0","inet","alias",
$_,"up","netmask","255.255.255.255");
  $counter++;
}
print " $counter ip's aliased\n";



Just put that script in /usr/local/etc/iphost.pl
Then make a text file called /usr/local/etc/ipstohost.txt containing
one ip address per line that you want hosted (do not include your main
IP address, only virtual ip's)
and then add the following to your /etc/rc.local

echo -n " setting up IP hosting:"; /usr/local/etc/iphost.pl



That works fine for me.. :)
-QJ