Assigning two hostname to single server

Hi All,

Is there any option where in I can assign the two hostname to single system.

Thanks

Add the hostname to the /etc/hosts file to the existing IP. Let's say your host's IP is 192.168.1.1 and your hostname is "myserv". You should already have:

192.168.1.1            myserv

Just append the new hostname, say "serv2" to this line:

192.168.1.1            myserv  serv2

Thanks Otheus

What will I get if I issue the command

I will be having different ip for different hostname !

What "hostname" returns actually depends on a number of things. I think in Solaris it depends on what is the name of the first hostname of the first interface given at boot time in
/etc/hostname.XXXX, where XXXX is the name of an ethernet interface. Hopefully a Sun expert can elaborate on this.

In fact, you will get the SAME ip for different hostnames. Do you WANT different IPs??

Not sure as if system is going to take the hostname from /etc/hostname.xxx as per my understanding to make it persistence across the system boot we place the entry into the file /etc/nodename . not sure as in case of two name how and where entries need to be place.

Will appreciate expert�s views and ideas

A server only has one hostname. Unless your server has domains, zones etc

Kumarmani is correct: In solaris 9, it was definitely /etc/nodename. I forgot about that (more than once).

The point is, your host can respond to multiple hostnames just by assigning to one of the existing IPs a new hostname in /etc/hosts. The official name returned by the command "hostname", however, will not change until you change /etc/nodename and reboot.