Should i use my local ip address or in /etc/hosts

Discussion in 'Installation/Configuration' started by adamjedgar, Oct 8, 2017.

  1. adamjedgar

    adamjedgar Member

    Should i use my local ip address (eg or in /etc/hosts when setting up a webserver?

    For example, in Section 10.4 of the Debian Reference Manual

    Some software (e.g., GNOME) expects the system hostname to be resolvable to an IP address with a canonical fully qualified domain name. This is really improper because system hostnames and domain names are two very different things; but there you have it. In order to support that software, it is necessary to ensure that the system hostname can be resolved. Most often this is done by putting a line in /etc/hosts containing some IP address and the system hostname. If your system has a permanent IP address then use that; otherwise use the address

    My google cloud instance does not have a static internal ip address at this stage (due to it being a trial i can only use 1 static ip, which i have set to the external ip).

    Does this mean that in my current /etc/hosts file localhost
    ::1 localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters server3
    # server3.c.myprojectID-1.internal server3 # Added by Google # Added by Google

    1. So does this information from the Debian quote above, and the fact i am not using a static internal ip address mean that i should change the line in my /etc/hosts file commencing with current internal ip address"" to ""?

    2. If the Debian standard was to use, why is google automatically adding by default along with the projectID in its own default entries?

    3. I hope this makes sense...i am keen to understand this in far more detail...I realise that in a web server environment it seems like i "should" also have a static internal ip address, however with regard to my original configuration shown above, is it important to have one over the other ip address in /etc/hosts?
  2. ISPConfig Developer ISPConfig Developer

    depends on many various things. For example you're sending internal mails to your own server "[email protected]" and you have someplace.tld in your hosts system knows where to deliver it without the need to query external DNS which might not even be aware of your internal hostname.
    You can either use the external IP which google maps to the internal IP or just the internal IP, basically doesn't matter much, however if your system is not aware that the external IP is acutally its own, it might send stuff over the wire without needing it.
    Also ISPConfig may determine which IP initially to setup according to the hosts file, it'll configure your websites to listen to that IP for example when you aswell wanted to use the external IP => then put the external IP to the hosts-file.
    If your external IP changes however, stay with the entry google set for you, it's an internal IP which is not routed and you could setup @home aswell. Just pretend your server is in a DMZ with changing external IPs.

    Hope it helps, it's 7am and didn't have my tea yet :)

Share This Page