[buug] [Solaris-8] Multiple hostnames on aliased IPs?

Bill Schoolcraft bill at wiliweld.com
Thu Dec 20 22:30:10 PST 2001


Hello Guru's

I've setup a machine that has 3 aliases to the one 
NIC and of course three seperate hostname entries 
in /etc/hosts, which all work fine.

I've been asked to make it so when you login to foo, 
foo1, foo2, or foo3 you could execute the command:

echo $HOSTNAME

and receive a unique hostname based on the particular 
interface you logged into, which would in essence make 
the entries in:

/etc/hostname.iprb0   <------ foo 	loghost
/etc/hostname.iprb0:1 <------ foo1
/etc/hostname.iprb0:2 <------ foo2
/etc/hostname.iprb0:3 <------ foo3

be the hostname when you "echo $HOSTNAME"

/etc/hosts

10.1.0.100	foo	loghost
10.1.0.101	foo1
10.1.0.102	foo2
10.1.0.103	foo3


I'm thinking that maybe in ~/.login I could maybe setup 
some script to querey the login's origin, compare to /etc/hosts 
and set 

export HOSTNAME=`$(information_acquiring_script)`

I'm a little lost on the mechanics of how the login would reverse 
map the originating IP requested to enter the machine then look into 
/etc/hosts to grab the hostname. 

Any pointers would be appreciated. Thanks  





More information about the buug mailing list