hosts file ipaddress

Discussion in 'Installation/Configuration' started by adamjedgar, Sep 24, 2017.

  1. adamjedgar

    adamjedgar Member

    Hi guys,
    1. which ip address should i be using in my hosts file...my servers external one or it internal one?

    All the tutorials talk about server ip addresses but i cant seem to work out which one its meant to be when on google cloud.

    2. Also, the perfect server setup hosts file is different to mine on the very first line. Do i add the exact words "localhost.localdomain" or should it be "localhost.mydomain" or do i leave mine the way it is on a production webserver that will host multiple websites with unique domain names?

    Here is the perfect server hosts file...
    127.0.0.1 localhost.localdomain localhost
    192.168.1.100 server1.example.com server1
    # The following lines are desirable for IPv6 capable hosts
    ::1 localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    Below is my current hosts file
    127.0.0.1 localhost
    35.189.x.x server3.<mydomain>.com.au server3
    # The following lines are desirable for IPv6 capable hosts
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts
    169.254.169.254 metadata.google.internal metadata
    3.What issues would i experience if i left my current hosts files as is?
     
    Last edited: Sep 27, 2017
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    It does not really matter as it will probably work in both cases, but I would recommend using the server (local) IP as it avoids a roundtrip for the data to the router. When you install a server that is located in a datacenter and has already an IP so you access it over SSH, then it's network configuration is probably already correct and there are no changes required for the further configuration, no matter if you install ISPConfig or any other software.
     
  3. adamjedgar

    adamjedgar Member

    First may i just say, due to the really good support you give Till, I cannot reccommend this product enough. Thank you.

    ok so if i change it to the following...
    127.0.0.1 localhost
    10.152.0.2 server3.<mydomain>.com.au server3
    # The following lines are desirable for IPv6 capable hosts
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts
    169.254.169.254 metadata.google.internal metadata

    may i ask, what is the difference between the following...

    127.0.0.1 localhost

    127.0.0.1 localhost.localdomain localhost

    If i am using my registered FQDN would not this conflict with the localhost.localdomain localhost part on line one?

    I am keen to follow exactly what you have done on perfect server setup, are you happy with me changing my hosts file to match yours exactly considering im on google cloud? (substituting my internal ip-address below)

    127.0.0.1 localhost.localdomain localhost
    10.152.0.2 server3.<mydomain>.com.au server3
    # The following lines are desirable for IPv6 capable hosts
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts
    169.254.169.254 metadata.google.internal metadata
     
  4. adamjedgar

    adamjedgar Member

    WTF, my hosts file has changed without me doing anything to it. Below is what it was as i illustrated above...

    I log in today and this is what is looks like now...I havent even touched it.

    127.0.0.1 localhost
    ::1 localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters

    10.152.0.3 server1.c.myprojectname-1.internal server1 # Added by Google
    169.254.169.254 metadata.google.internal # Added by Google

    I dont know what to do...should i leave this and move on??? How does my domain name get linked with this server if it is not in the hosts file? (google has inserted my google cloud project name instead)​
     
  5. HSorgYves

    HSorgYves Active Member

    Your domain name gets linked to your server through open DNS Servers and not through the hosts file. I think you should start reading a basic Linux Server manual.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Welcome to the cloud ;) That's what happens when you use a cloud server, you give away full control. Google is controlling this now, not you or ISPConfig.

    Yes.

    Domain names are setup in DNS. The hosts file is just a way to locally override DNS.
     
  7. adamjedgar

    adamjedgar Member

    Im sorry i am probably going offtopic here...and a little outside of the purpose of this forum...

    So what happens if we dont set hosts file records at all?

    Isnt the hosts file in my case a bit like an internal dns? Without it, wouldnt websites for example, essentially be inaccessible?

    Wouldnt that also mean if my own hosts file is wrong, my virtual server, which is part of a google cloud internal virtual network cant be resolved to the outside world?

    So i guess what i am asking is...
    Dns is external (wan)
    Hosts is internal network (lan)

    I realise we can use hosts or dns for both but hosts file tends to be utilised in a smaller resource group and are static text files yes?
     
    Last edited: Sep 28, 2017
  8. HSorgYves

    HSorgYves Active Member

    hosts allows you to cache and/or overwrite DNS entries for faster retrieval, that's it
     
    adamjedgar likes this.

Share This Page