[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: IFCONFIG - help!



On Fri, 18 Jul 1997, Bruno O. M. Simoes wrote:

> How can I configure several IP addresses in just one network interface? Is
> there some parameter on ifconfig?

Here's the script I use for virtual hosts.  Make sure your kernel either
supports ip_alias, or you have built ip_alias.o.  I wrote it, and hereby
give whoever feels like using it, permission to do so.

#!/bin/bash

names="host1 host2 host3 host4"

count=0

if [ "$1" = "stop" ]; then
  for addr in $names
  do
	/sbin/route del $addr
	/sbin/ifconfig eth0:$count- $addr
	let count=$count+1
  done
elif [ "$1" = "start" -o "$1" = "" ]; then
  for addr in $names
  do
	/sbin/ifconfig eth0:$count $addr
	/sbin/route add -host $addr dev eth0:$count
	let count=$count+1
  done
else
  echo 'Usage: '$0' [start|stop]'
fi


Jason Costomiris                 | Finger for PGP 2.6.2 Public Key
jcostom@sjis.com                 | "There is a fine line between idiocy
My employers like me, but not	 | and genius.  We aim to erase that line"
enough to let me speak for them. |			--Unknown

	        	http://www.jasons.org/~jcostom


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: