Binding the IP address for the virtual domain
All virtual hosts use an IP address just as regular physical interfaces. If we don't bind the IP address to the interface, our virtual hosts will not work.
To test our configuration temporarily, from your console type this:
[root@server2 named]# /sbin/ifconfig eth0:1 184.108.40.206
[root@server2 named]# /sbin/route –host 220.127.116.11 dev eth0:1
Obviously, no other computer in the network should be using the IP address 18.104.22.168
After executing the above command, you need to restart bind:
[root@server2 named]# service named restart
That command will restart the DNS server. Try the nslookup now; it should return the name server.
[root@server2 named]# nslookup www.onetraining.net
www.onetraining.net canonical name = onetraining.net
If you see this information returned, you are in business. Now the most logical step is to bind the IP address permanently; so if the system is restarted it will bind it automatically at boot time.
The easiest way to bind this at boot time is adding it to the rc.local script. This file is located in: /etc/rc.d/rc.local
Move to the rc.d directory and edit the rc.local and add the commands at the very bottom of the script, or create an executable script with all the virtual interfaces and add it in this file:
[root@server2 rc.d]# vi rc.local
/sbin/ifconfig eth0:1 22.214.171.124
/sbin/route add –host 126.96.36.199 dev eth0:1
Note. When you start adding virtual hosts, use a sequence number to bind IP address to the Interface card. For example in my first virtual host I used eth0:1, the next would be eth0:2, eth0:3, eth0:4 and so on…