1

My hosting provider set up an Ubuntu-based virtual private server for me with three public IPs. I want to assign hostnames to those IPs as follows (I'm be using Dyn as my DNS):

  • example.com -> IP_1
  • www.example.com -> IP_1
  • test.example.com -> IP_2
  • admin.example.com -> IP_3

www.example.com will be the production site. test.example.com will be the bleeding edge version of the site, used for testing, and admin.example.com will expose a number of site administration services (e.g. SSH, rsyncd). Both www and test will be locked down to port 80. Both test and admin will only accept traffic from certain IPs.

I'm a little confused about the difference between the hostnames DNS deals with, and the server's hostname (as seen when running `hostname' on the server's command line). Where does the server's hostname come into play?

My guess is that Apache 2 doesn't care what the hostname utility returns, because I can specify listening IP:PORT per VirtualHost. But, are they other services (or limitations) I should be aware of when connecting to my server via "foo.mydomain.com" if the machine's hostname is "randomname"?

1
  • Why are you trying to separate the different names to different IPs? You've started your question with a proposed solution without telling us what problem you're trying to solve. You won't get good answers that way. Dec 11, 2011 at 2:33

3 Answers 3

3

Hostnames make it easy distinguish between servers. See RFC-1178 Choosing a Name for Your Computer for more details. For what you are doing the server's hostname doesn't really matter. In your case your host will be hosting serveral FQDN (Fully Qualified Domain Names) to enable services. You could add more using addtional DNS CNAME or A records.

As you have a small site ALL of these domains refer to a single host. Larger services like google.com have multiple IP addresses backed by multiple servers. In some cases the IP addresses may belong to load balancers in front of multiple servers.

For an Apache server you should use IP based virtual hosting. You can use Apache ACLs and/or a firewall to restrict access. I use both when I can.

If you add a mail server there are additional rules which should be applied. The FQDN for the mail server should be the same as the name the Server announces. In addition, the IP address should have a PTR record returning that FQDN.

0

server hostname does not matter.. for apache.. your browser will for a http packet and put a http host header in the packet that will have the hostname you are hitting. Apache will then get the packet and check the host header and figure out which virtual host to send the request to based on the

servername or serveralias 

For other things generally it just makes a straight IP connection so whatever your hostname resolves to it just makes a connection to that IP on that port.

0

If you run any outgoing mail server, your smtp helo greeting and fqdn hostname should match, to avoid spam filters.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .