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 188.8.131.52
[root@server2 named]# /sbin/route –host 184.108.40.206 dev eth0:1
Obviously, no other computer in the network should be using the IP address 220.127.116.11
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 18.104.22.168
/sbin/route add –host 22.214.171.124 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…