*BSD News Article 53725


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.uwa.edu.au!classic.iinet.com.au!swing.iinet.net.au!news.uoregon.edu!news.emf.net!overload.lbl.gov!lll-winken.llnl.gov!uwm.edu!chi-news.cic.net!io.org!nobody
From: taob@ionews.io.org (Brian Tao)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: Weird ifconfig problem
Date: 25 Oct 1995 10:45:43 -0400
Organization: Internex Online (io.org) Data: 416-363-4151  Voice: 416-363-8676
Lines: 42
Message-ID: <46liin$6bo@ionews.io.org>
References: <davidp-2410951156090001@michaelangelo.leonardo.net> <46klot$edu@shellx.best.com>
NNTP-Posting-Host: flinch.io.org

In article <46klot$edu@shellx.best.com>, Wilson Roberto Afonso <wilson@shellx.best.com> wrote:
>
>Well, I get the error message at the first (and only) time I
>run "ifconfig xxx alias ...", *but* it sort of works.  I mean,
>other hosts can contact the virtual host, but the host that the
>command was ran on cannot (no answer to ping).

    I imagine this has something to do with the netmask setting of the
aliased IP addresses.  Under FreeBSD 2.0.5 and later, applying a
netmask of 255.255.255.255 allows the host to ping itself on the
alias.  This doesn't seem to work for me under BSD/OS 2.0.

    I find this works well enough for me (this is on one of our Web
servers that handles our virtual domain customers):


#!/bin/sh
#
#  This file sets up the ifconfig aliases for virtual hosting to work.
#  Please consult /usr/apache/conf/httpd.conf for a list of servers
#  configured to run on this machine.

if_name="we0"

for alias in  \
198.133.36.90 \
198.133.36.91 \
198.133.36.92 \
198.133.36.93 \
198.133.36.94 \
198.133.36.95 \
198.133.36.96 \
198.133.36.97
do
	/sbin/route add $alias localhost
	/sbin/ifconfig $if_name inet $alias netmask 0xfffffffe alias
done

-- 
Brian Tao (BT300, taob@io.org)
Systems Administrator, Internex Online Inc.
"Though this be madness, yet there is method in't"