1) Create the hostname.INTERFACE_NAME:NUMBER files for interface and inside, name the interface.
2) Edit /etc/hosts file to include the IP addresses for these virtual interfaces.
3) Reboot the system. It will come up with three IP addresses on one physical card (as shown in the following example).
(Note: If you are an advanced user/admin, step #3 can be replaced with ifconfig command with necessary arguments. Whenever you reboot next time, these settings will be retained.)
# ls -l /etc/hostname*
-rw-r--r-- 1 root root 8 Mar 28 2008 /etc/hostname.eri0
-rw-r--r-- 1 root other 16 Oct 23 2008 /etc/hostname.eri0:1
-rw-r--r-- 1 root other 17 Oct 23 2008 /etc/hostname.eri0:2
# cat /etc/hostname.eri0
unixgeekws
# cat /etc/hostname.eri0:1
unixgeekws-virtual
# cat /etc/hostname.eri0:2
unixgeekws-virtual1
# cat /etc/hosts
# Internet host table
127.0.0.1 localhost
10.20.30.145 unixgeekws loghost
10.20.30.146 unixgeekws-virtual
10.20.30.147 unixgeekws-virtual1
NOW Reboot the system. Check my special note if you are advanced user.
Upon reboot, it will show as below:
# ifconfig -a
lo0: flags=1000849mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
eri0: flags=1000843mtu 1500 index 2
inet 10.20.30.145 netmask ffffff00 broadcast 10.20.30.255
ether 0:3:ba:44:f4:17
eri0:1: flags=1000843mtu 1500 index 2
inet 10.20.30.146 netmask ffffff00 broadcast 10.20.30.255
eri0:2: flags=1000843mtu 1500 index 2
inet 10.20.30.147 netmask ffffff00 broadcast 10.20.30.255
No comments:
Post a Comment