• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

Binding IP addres to NIC card.

Were running solaris 2.5 and need to know how to add virtual domains to our box. I know how to add it to apache.
Need to be able to add ip without rebooting server.

0
simlab
Asked:
simlab
1 Solution
 
blowfishCommented:
The ifconfig command will dynamically add a virtual interface to listen to a specific IP address (assuming 192.168.100.5)

First, determine if your system is using le0, or hme0 like so;

# ifconfig -au

lo0: flags=849<UP,LOOPBACK,RUNNING,MULTICAST> mtu 8232
        inet 127.0.0.1 netmask ff000000
hme0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
        inet 192.168.100.3 netmask ffffff00 broadcast 192.168.100.255


Next, add the virtual interface (assuming 192.168.100.5) like so;

#  ifconfig hme0:5 inet 192.168.100.5 up -trailers

In the previous command, the interface name is hme0:5, you can use any digit(s) after the colon, by convention I use the trailing digit(s) of the IP address.  

You can display the newly created interface, using ifconfig -au, and should see the following;

hme0:5: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
        inet 192.168.100.5 netmask ffffff00 broadcast 192.168.100.255

You can check that the interace is properly configured and running using ping, first from the local workstation, then from a different workstation.  

Note that the ifconfig command adds the interface dynamically.  You must still edit configuration files in /etc if you want the interface to exist after a system reboot.  For each virtual interface, create a file in /etc named in the following form;  /etc/hostname.hme0:5, where the digit(s) following the colon are the trailing digit(s) from the IP address.  The contents of each file will be the actual IP address assigned to the virtual interface by the ifconfig command at boot time.  (NOTE, you could define a hostname and IP address in /etc/hosts and use the hostname rather than the IP address in the files that you are creating).  

Here's an example;

#  cat /etc/hostname.hme0:231
192.168.100.231

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now