Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I just bought a new VPS hosting plan and i have a few questions.

Hope someone here can clear the doubts for me.

1) Is it necessary to have a real domain for a vps hostname? I suppose i can just use a non-real domain like anydomain.com and something like 'server' for the computer name.

Therefore i'll end up with something like server.anydomain.com as the vps's hostname.

I want to do this for the sake of putting in a hostname to configure the vps to get it going .

So, since this non-real domain name does not need to be publicly accessible i don't need to register or own it and instead access the server by the ip address. Is that correct?

But i suppose that this also depends upon if my web host allows that?

2)I would also like to run some real sites with real domain names on this vps, so can i just configure the zone file on the primary nameserver and make entries for these domains and point an A record at the Vps's IP to make them publicly accessible over the internet?

For example for my 1st domain i could make an entry like this:

$TTL 86400
mydomain1.com.          IN     SOA    ns1.mywebhost.com. \
                                admin.mydomain1.com. (
               2004011522     ; Serial no., based on date
                    21600     ; Refresh after 6 hours
                     3600     ; Retry after 1 hour
                   604800     ; Expire after 7 days
                     3600     ; Minimum TTL of 1 hour
                  )

server                IN     A       200._._._
ns1.mywebhost.com.      IN     A       216._._._
ns2.mywebhost.com.      IN     A       205._._._
@                     IN     NS      ns1.mywebhost.com.
@                     IN     NS     ns2.mywebhost.com.
@                     IN     MX      10 server
www                   IN     CNAME   server

server                IN     CNAME   @               (so this particular line tells the nameserver to point the url mydomain1.com to server.anydomain.com at the particular ip addresss in the A record.... is that right?)

Similarly for my 2nd domain i could have a similar entry :

$TTL 86400
mydomain2.com.          IN     SOA    ns1.mywebhost.com. \
                                admin.mydomain2.com. (.....

                   ............................so on........
                   .........................................
                   .........................................
                   .........................................
                   .........................................
                   .........................................

Is that correct?

3) Suppose for my vps hostname, i ignorantly chose a domain that someone else alreadys owns , however i think that it won't affect the public accessibility of the real domain or website since only the real owner of the domain has the rights to provide for the nameservers addresses in the TLD registeries through his Domian Registerar? Is that correct?

4)Can i change my vps's hostname later? Would this create any complications?

share|improve this question

2 Answers 2

  1. Yes, you can give any hostname in /etc/hosts - this name will be known only to hosts and you.
  2. Yes, you can configure this way and have sites with unrelated to hostname names - most shared hosting do the same thing
  3. It doesn't affect nobody except outgoing mail from your VPS to this "intercepted" hostname (it it'll happen) - instead of sending to external Net it will be routed locally
  4. Yes, you can. Edit /etc/hosts and service network restart do all magic
share|improve this answer

Whatever you choose for the hostname of your VPS will not effect its ability to operate. You can also change this whenever you like without any side effects. The one exception would be if you start to use this hostname in configuration files. By default nothing is going to be setup to use the hostname so unless you start to put it into configuration files yourself you should be OK to change it.

It does not mater if the hostname is a real valid hostname or not. You could potentially setup a hostname called server.mysite.superadmin. Obviously superadmin is not a valid TLD but that does not mater you can put it into your /etc/hosts file and reference your machine by that name. Additionally you could setup a private DNS server for the domain mysite.superadmin and setup A records for your server and it would work just as well if you pointed your client machines at that DNS.

The only thing that would not work is if someone who knows nothing about the mysite.superadmin domain wanted to view your website and they went to their DNS servers and asked for the IP address of server.mysite.superadmin. The first thing their server would do is ask the root DNS servers for the authorative dns servers for .superadmin at which point the root servers would respond with an error since .superadmin is not a valid TLD.

You can also choose an existing domain name that is owned by someone else and setup your hosts file and your own DNS to thing its authoritative for that domain and use it. If you put www.microsoft.com in your hosts file and pointed at your IP address you could reference yourself using www.microsoft.com. Your hosts file is referenced before any DNS servers are checked. Additionally you could setup your own DNS server and tell it that it is authoritative for www.microsoft.com and if you point your client computers at that DNS server it will work. Just like in the previous example though the root DNS servers will not ever return your DNS server as the authoritative DNS server for microsoft.com in a recursive lookup by third parties. It would only work if you explicitly told your machine to use your DNS server.

For your site to host real websites all you need to do is setup the A records for those websites to point at your VPS's public IP address. You must do this in the authoritative DNS server for the domain. If you own the domain you can setup your own DNS server on your VPS and make that the authoritative DNS server by updating the record with the registrar. You could also use the registrar's DNS or other third party DNS providers. I normally like using third party DNS providers who provide multiple DNS servers in different geographical locations and data centers. DNS services are really dirt cheap and can be difficult to provide on your own. Not that setting up BIND is difficult but having the redundancy that a third party service can provide you is.

share|improve this answer
    
Hi, I put the same question to the support at the vps and they say that i must have a valid domain for a hostname otherwise there could be mail and ip issues. They say "The hostname should resolve to server's main shared IP Address and vice versa(rDNS should setup for the main IP)so that email systems work correctly, otherwise remote email server will not identify your email server as valid and the emails from your server may drop in their spambox." Now i do understand that i would need an ip address for a mail system to work but is there anything i'm missing here? –  user481913 Oct 12 '11 at 20:44
    
The real thing that i want answered or i'd like to do at my vps is run some real websiters with valid domains that has a unreal non valid domain for a hostname. And as it looks from your replies as well that you agree with me that it shouldn't make a difference if i have a non real domain name for a hostname in case the host's name is not being used to run any website (not even a site private to me) and there are no email addresses that are ever needed to work off this domain or hostname. –  user481913 Oct 12 '11 at 20:44
    
In such a scenario can i just not point the A record for this non real hostname to the vps's ip address and in turn make the CNAME entry for all the real websites that i intend to run on this vps to point to thiS Hostname.? –  user481913 Oct 12 '11 at 20:45
    
And the email address for each website, say myemail@mydomain1.com and myemail@mydomain2.com have their MX entries point to the hostname which in turn has it's A record point to the vps's ip address? –  user481913 Oct 12 '11 at 20:54
    
I have several VPS's that host email for many domains. Obviously the reverse DNS can only point at one domain name. I have never had problems with receiving email servers blocking based purely on reverse DNS not resolving. I have seen them block based on the IP being in a range of IP addresses used by an ISP for its customers though meaning you could not host email from your home connection. If you send email from the command line using mailx or any other tool like that it will come from username@hostname. If you use PHP or a actual SMTP server it will come whoever you claim to be. –  digitaladdictions Oct 13 '11 at 4:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.