Results 1 to 10 of 11

Thread: /etc/hosts and /etc/hostname

Threaded View

  1. #1
    Join Date
    Jan 2011
    Beans
    143

    /etc/hosts and /etc/hostname

    Okay I am totally confused about this getting so many different answers from around the net. I believe this is what is giving me grief with ldap on the server. If my fqdn for my server is server1.elrancho.net than how should this be set in both of these files. I am a newbie at this so be patient with me please.

    After doing some research I have changed the entries in the files to this:
    I have this currently in my /etc/hostname file
    server1.elrancho.net

    I have this in my /etc/hosts file:
    127.0.0.1 server1.elrancho.net elrancho

    I do not currently have a line of:
    127.0.0.1 localhost or xxx.xxx.xxx.xxx server1.elrancho.net or 127.0.1.1 elrancho.

    I got out of the post on setting up the ldap server that, if I understand him should be
    127.0.0.1 server1.elrancho.net elrancho. Sorry but like I said I am completely confused on this. I am alos running a dns server on the same box for resolving entries www.elrancho.net, ns.elrancho.net etc.

    I also think something is not quite right since according to the docs on the hostname command "hostname" and "hostname -f" should not both return server1.elrancho.net.
    I will continue to work with it myself to see if I can stumble on the right combo between the two. I am still researching on understanding the relationship between the two files.

    I wonder if I should be using this in the /etc/hosts file:
    127.0.0.1 server1.elrancho.net server1
    127.0.1.1 server1

    Hmm, according to the Ubuntu manual for hostname it states:
    /etc/hostname This file should only contain the hostname and not the
    full FQDN.

    Then maybe this would be the proper setup.

    /etc/hosts:
    127.0.0.1 server1.elrancho.net server1
    127.0.1.1 server1

    /etc/hostname:
    server1

    Despite what the man page states - hostname with no arguments and hostname -f return the same string. I think I will change the value in /etc/hostname back to server1.elrancho.net. The docs I believe are confusing and seem to me to be misleading unless I am misunderstanding them.
    Last edited by ranger12; May 22nd, 2012 at 10:59 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •