Previous Page | Next Page

  1. Agustin's Linux Manual
  2. Networks & Servers
  3. About the Author
  4. Table of Contents
  5. IP Addresses Networks and Subnets
  6. Network Classes
  7. IP Address in Decimal Notation
  8. Sub-netting
  9. Designing Subnets
  10. Allocating Subnets
  11. Defining Host Addresses
  12. Variable Length Subnet Mask
  13. Routing Protocols
  14. Classless Internet Domain Routing
  15. Servers - Chapter 9
  16. Apache Web Server
  17. Configuring Apache
  18. Uploading Web Pages
  19. Apache Overview
  20. MIMEMagic
  21. DNS Servers
  22. Welcome to Webmin
  23. Creating the Master Domain
  24. Adding the Reverse Zone
  25. Querying the DNS server
  26. Adding Virtual Domain to DNS Server
  27. Reverse Zone for Virtual Zone
  28. Binding IP Address for Virtual Domain
  29. Virtual Web Hosting
  30. DNS Security Options
  31. FTP Server
  32. Securing the FTP Server
  33. Email Server
  34. Postfix Configuration
  35. Dealing with Identical Users
  36. Configuring Email Clients
  37. Configuring Outlook
  38. Samba Server
  39. Configuring SAMBA Server
  40. The smb.conf File
  41. smb.conf Analysis
  42. Adding Users to Samba

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 168.34.26.59

[root@server2 named]# /sbin/route –host 168.34.26.59 dev eth0:1

Obviously, no other computer in the network should be using the IP address 168.34.26.59
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
Name: onetraining.net
Address: 168.34.26.59

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 168.34.26.59 /sbin/route add –host 168.34.26.59 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…