do i need 127.0.0.1 guest in hosts file?

Discussion in 'HOWTO-Related Questions' started by adamjedgar, Apr 21, 2019.

  1. adamjedgar

    adamjedgar Member

    i notice a hosts file on one of my centos 7 systems on Vultr contains the following entry...

    127.0.0.1 guest
    ::1 guest

    this morning i got the following email
    lfd on server4.mydomain.com: Excessive resource usage: rpc (1462 (Parent PID:1462))

    To: <[email protected]>

    Time: Sat Apr 20 20:00:24 2019 +1000
    Account: rpc
    Resource: Process Time
    Exceeded: 116474 > 1800 (seconds)
    Executable: /usr/sbin/rpcbind
    Command Line: /sbin/rpcbind -w
    PID: 1462 (Parent PID:1462)
    Killed: No


    What does this mean?
    Should i remove the guest entry from my hosts file?

    my usual server hosts files contain manual entries i have put in myself...i havent ever added a 127.0.0.1 guest entry before. However this server has added it automatically

    Also, my hosts file has the following

    127.0.0.1 autoreply.server4.mydomain.com
    Do i need this?
     
    Last edited: Apr 21, 2019
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I do not know what a Vultr system is. If it is a container running on cloud service, it may be it is necessary to have that in the /hosts file. I would not edit files provided by the cloud vendor, unless I know it can be edited.
    My understanding is that /etc/hosts should have line for localhost, because some services use name localhost instead of IP-number, and the IP-number is looked up in that file.
    Code:
    127.0.0.1       localhost
    
    Are you sure it is
    Code:
    127.0.0.1 autoreply.server4.mydomain.com
    and not 127.0.1.1?
    It seems to me the problem is
    Code:
    Resource: Process Time
    Exceeded: 116474 > 1800 (seconds)
    Remote Procedure Call used too much time. Try to find why that happens.
     
  3. adamjedgar

    adamjedgar Member

    I am not sure taleman...

    However, i took a look at another one of my servers on Vultr...the hosts file on that server is as follows:

    127.0.0.1 localhost
    127.0.1.1 guest.guest guest

    # The following lines are desirable for IPv6 capable hosts
    ::1 localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters

    127.0.0.1 server1.<mydomain>.com.au
    ::1 server1.<mydomain>.com.au

    I dont understand why on either server, the hosts file does not have the usual entries for server external ip address?

    I am suspicious of the above, what is an example of a more standard hosts file that i should be using?
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    This latter hosts file looks OK. It is what I would expect, except it does not have the host IP-number.
    It is the operating system installer that creates the /etc/hosts file. How did you install the OS? I would expect the installer to ask what is IP of host, and write that to /etc/hosts.
    But you can replace on the server1 line the real IP of the host. And IPv6 address on the next line, if you have IPv6.
    This is from my server (Debian 9.x):
    Code:
    cat /etc/hosts
    127.0.0.1    localhost
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    
    I removed the IP-address FQDN hostname lines for my hosts.
     
  5. adamjedgar

    adamjedgar Member

    On the server where 127.0.0.1 resolves to my hostname.fqdn

    I also get a warning saying apache could not reliably determine server hostname...using server1.my domain.com

    I am assuming adding external IP into this file will fix that?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    This should not be the case. 127.0.0.1 shall resolve to localhost only, not to the server hostname. The server hostname should have a line that starts with the external IP.

    example:

    127.0.0.1 localhost
    100.1.2.50 server1.yourdomain.tld server1

    127.0.1.1 (not to mix up with 127.0.0.1) would be ok for the hostname too, but I would use the external IP.
     
  7. adamjedgar

    adamjedgar Member

    Hi Till,
    Thank you Taleman and Till for your input on this. The answers you have given confirm my suspicions that i had an incorrect configuration.

    @till, I added the external IP with my server1.<mydomain.com> server1 line into /etc/hosts
    What confuses me about this, even though that line was missing from my hosts file, typing hostname -f still returned the correct name as setup at the time i installed this instance.
    I use a VPS on the Vultr network...and the installer for Debian is run from one of their default VPS packages. In Vultr, i originally also labelled the instance as server1.<mydomain.com>.

    I find all this stuff about hostname and hosts file rather confusing, as it seems very hit and miss (ie sometimes the server seems to resolve

    Here is a copy of the default hosts file on another one of my vultr vps

    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

    127.0.0.1 server4.<mydomain>.com.au
    ::1 server4.<mydomain>.com.au
    127.0.0.1 server4.<mydomain>.com.au
    127.0.0.1 autoreply.server4.<mydomain>.com.au

    and hosts file on a third Vultr server below

    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

    127.0.0.1 guest
    ::1 guest

    127.0.0.1 server3.<mydomain>.com.au
    ::1 server3.<mydomain>.com.au
    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

    I do not understand the reason for these default hosts file entries at all? Why is Vultr insisting on using them with default O/S installs?

    (These last two servers are both Centos 7 machines. The server1 instance is Debian 9)

    I am running a variety of control panels...i have different CP's on different instances. could that be the reason for the unusual entries?

    I do not understand why there is not a single method of doing this that is stock standard across all instances and all control panels?





     
    Last edited: Apr 24, 2019
  8. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What hostname -f shows does not come from /etc/hosts file. See man hostaname. It uses also /etc/hostname and maybe other files. What is in your /etc/nsswitch.conf?
    The first example hosts in previous post looks like what I would expect, except it does not have the real IP-address and fqdn line. You have to ask Vultr why it is like this. If you install Debian using the normal Debian installer, that line is there.
    I would say there is. The Linux distributions using their own installers do the /etc/hosts file the same way. But cloud services make non-standard virtual hosts, probably for good techical reasons but I do not know what those reasons are.
     

Share This Page