Thursday, May 21, 2009

Configuring Virtual IP Address in Solaris

Follow the three simple steps that will help you to configure virtual IP address :

  1. Edit the /etc/hosts file and add additional IP addresses, along with the associated hostname. For example : To add 192.168.0.1 (web1) and 192.168.0.2 (web2) to the system, enter in the following manner.

192.168.0.1 web1
192.168.0.2 web2

The system needs to be configured for the newly added IP addresses.

  1. Create the startup files so that the system will automatically add the new IP addresses upon bootup.

    a. Create new files in the /etc directory. The file names should follow the following convention according to the new ip address added.

    hostname.hme0:1
    hostname.hme0:2

    b. The contents of these files will be a single line with the respective hostname entered. For example:

      File Name

      Contents

      hostname.hme0:1

      hostname.hme0:2

      web1

      web2

The file "hostname.hme0:1" will contain "web1" and "hostname.hme0:2" will contain "web2".

If you look in the "/etc" directory, you will find a file named "hostname.hme0" (which is the real interface, the :n represents the virtual interface). In this file, you will find the name of your system. If you look in the "/etc/hosts" file, you will find your IP address.

Now you have configured virtual IP address for two new interfaces that you have added ( .hme0:1 and .hme0:2 .

  1. To activate this virtual IP address, you have to provide the following commands :

# ifconfig hme0:1 plumb

# ifconfig hme0:2 plumb

The system startup in Solaris searches the "/etc" directory for files named "hostname.*". When it finds one or more of these files, it reads the hostname from them, looks up the hostname in the "/etc/hosts" file for a match, and if found, configures the interface with the IP address of the match.

Please re-boot your system for the virtual IP address to be configured in your system.

(OR)

To configure the interface without re-starting the system, use the "ifconfig" command. To add the two IP addresses, type:

# ifconfig hme0:1 192.168.0.1 up

# ifconfig hme0:2 192.168.0.2 up

After having issued these two commands, the system would recognize the new IP addresses immediately, without re-booting the system.

No comments:

Post a Comment

masukkan nama anda

Popular Posts