Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question about ip-based virtual hosts on Apache

Status
Not open for further replies.

joker3

IS-IT--Management
Jan 18, 2002
5
0
0
US
I am setting up Virtual Hosts on an Apache server on Redhat Linux. I know how to create Virtual Hosts and the difference between name-based and ip-based hosts. However, before I decide which to use, I have a question. One of the virtual hosts is from a different domain. So, if I use an ip-based virtual host and add the ip using ifconfig, then set up the virtual host in httpd.conf, do I need to ask the other domain to modify their DNS?

I know that I would have to do that for a name-based host. Since the domain belongs to someone else, I would have to ask them to modify their DNS to show that name resolving to an ip in our domain.

Here is a quote from the Apache page about virtual hosts:

"Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names. You must have the names in DNS, resolving to your IP address, or nobody else will be able to see your web site. You can put entries in your hosts file for local testing, but that will work only from the machine with those hosts entries."
 
Every VirtualHost (ip-based or name based) will require some DNS record in order to be accessed by name (which is what most users put into the browser's address bar). Ideally this would be an A record at the DNS server, but could also be CName or even possibly a wildcard. The DNS records that convey where users connect, are not neccessarily related to how your apache server is set to answer.

In short, yes, every VirtualHost or subdomain should have the appropriate DNS record to allow the client users to resolve the name.
 
In order to use ip based addressing you would want each ip to have its own interface (NIC). If that is not an option then the next way is to use ip aliasing. This is a way for one interface such as eth0 to have virtual ip addresses assigned to it in the eth0:1, eth0:2 and so on. If you will be assigning your own private ip addresses then the answer to your previous qustion is no, you don't have to change anybodies dns because they will all point to your public ip address. setting up this type of system would require setting up your own dns on your network which goes way beyond the scope of this forum. Unless you are planning on using ssl, I'd avoid using ip based addressing.

 
Joker3, both smah and RhythumAce have good points. But to your original question, if you can get the packets from the odd domain to one of your NICs, then you don't need to change the DNS, (either via a separate NIC or virtual ip). Usually, due to routing constraints or physical location this proves to be impossible and you must change DNS. Remember, DNS or ifconfig doesn't change the routing of packets.

But if it isn't, simply ifconfig or turn down the IP on you old server and turn it up on the new server. You must stop the old server first or you will get an IP clash.

eugene

 
Thanks, everyone, for replying. Your suggestions all make good sense. I have opted to use name based virtual hosts and to request the other domain server to change their DNS record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top