Solved

Binding IP addres to NIC card.

Posted on 1998-08-07
1
189 Views
Last Modified: 2013-12-16
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
Comment
Question by:simlab
1 Comment
 
LVL 2

Accepted Solution

by:
blowfish earned 50 total points
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now