how to properly edit hosts, hostname and resolf.conf?












1















I have been searching the Internet for a real nop tutorial on the subject but could not found any direct info. on how to edit these files the proper way.



I have a Debian Internet server that I use to host some personal domains and runs Squid and rTorrent. The server is up and running with no problems. However, I am confused about a few things.



Lets say that I named my server (foo), my domain is (example.com) and my public IP is 95.211.133.200 now:





  1. should /etc/hostname contains:



    tango.example.com


    or



    tango <----- just the server name



  2. should /etc/hosts contain:



    127.0.0.1       localhost.localdomain   localhost
    95.211.133.200 foo.example.com foo



  3. should /etc/resolf.conf contain (along with the name servers) both:



    domain example.com
    search example.com


    or just the first one.



    Are there any other files that I should edit in order to make things right?




  4. last thing, the command:



    domainname

    returns: (none)


    I believe it should return (example.com). What should I do to correct that?












share|improve this question















migrated from serverfault.com Apr 2 '12 at 22:23


This question came from our site for system and network administrators.



















  • Your shift key appears to be broken.

    – Chris S
    Apr 2 '12 at 22:21






  • 1





    This sounds suspiciously like a homework assignment I once had. Anyway, all of these questions can be answered in man pages: resolv.conf(5), hostname(1) and hosts(5)

    – AdmiralNemo
    Apr 2 '12 at 23:09
















1















I have been searching the Internet for a real nop tutorial on the subject but could not found any direct info. on how to edit these files the proper way.



I have a Debian Internet server that I use to host some personal domains and runs Squid and rTorrent. The server is up and running with no problems. However, I am confused about a few things.



Lets say that I named my server (foo), my domain is (example.com) and my public IP is 95.211.133.200 now:





  1. should /etc/hostname contains:



    tango.example.com


    or



    tango <----- just the server name



  2. should /etc/hosts contain:



    127.0.0.1       localhost.localdomain   localhost
    95.211.133.200 foo.example.com foo



  3. should /etc/resolf.conf contain (along with the name servers) both:



    domain example.com
    search example.com


    or just the first one.



    Are there any other files that I should edit in order to make things right?




  4. last thing, the command:



    domainname

    returns: (none)


    I believe it should return (example.com). What should I do to correct that?












share|improve this question















migrated from serverfault.com Apr 2 '12 at 22:23


This question came from our site for system and network administrators.



















  • Your shift key appears to be broken.

    – Chris S
    Apr 2 '12 at 22:21






  • 1





    This sounds suspiciously like a homework assignment I once had. Anyway, all of these questions can be answered in man pages: resolv.conf(5), hostname(1) and hosts(5)

    – AdmiralNemo
    Apr 2 '12 at 23:09














1












1








1








I have been searching the Internet for a real nop tutorial on the subject but could not found any direct info. on how to edit these files the proper way.



I have a Debian Internet server that I use to host some personal domains and runs Squid and rTorrent. The server is up and running with no problems. However, I am confused about a few things.



Lets say that I named my server (foo), my domain is (example.com) and my public IP is 95.211.133.200 now:





  1. should /etc/hostname contains:



    tango.example.com


    or



    tango <----- just the server name



  2. should /etc/hosts contain:



    127.0.0.1       localhost.localdomain   localhost
    95.211.133.200 foo.example.com foo



  3. should /etc/resolf.conf contain (along with the name servers) both:



    domain example.com
    search example.com


    or just the first one.



    Are there any other files that I should edit in order to make things right?




  4. last thing, the command:



    domainname

    returns: (none)


    I believe it should return (example.com). What should I do to correct that?












share|improve this question
















I have been searching the Internet for a real nop tutorial on the subject but could not found any direct info. on how to edit these files the proper way.



I have a Debian Internet server that I use to host some personal domains and runs Squid and rTorrent. The server is up and running with no problems. However, I am confused about a few things.



Lets say that I named my server (foo), my domain is (example.com) and my public IP is 95.211.133.200 now:





  1. should /etc/hostname contains:



    tango.example.com


    or



    tango <----- just the server name



  2. should /etc/hosts contain:



    127.0.0.1       localhost.localdomain   localhost
    95.211.133.200 foo.example.com foo



  3. should /etc/resolf.conf contain (along with the name servers) both:



    domain example.com
    search example.com


    or just the first one.



    Are there any other files that I should edit in order to make things right?




  4. last thing, the command:



    domainname

    returns: (none)


    I believe it should return (example.com). What should I do to correct that?









linux hostname hosts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 8 '12 at 0:50









Linger

2,796102740




2,796102740










asked Apr 2 '12 at 22:16









FirewallFirewall

62




62




migrated from serverfault.com Apr 2 '12 at 22:23


This question came from our site for system and network administrators.









migrated from serverfault.com Apr 2 '12 at 22:23


This question came from our site for system and network administrators.















  • Your shift key appears to be broken.

    – Chris S
    Apr 2 '12 at 22:21






  • 1





    This sounds suspiciously like a homework assignment I once had. Anyway, all of these questions can be answered in man pages: resolv.conf(5), hostname(1) and hosts(5)

    – AdmiralNemo
    Apr 2 '12 at 23:09



















  • Your shift key appears to be broken.

    – Chris S
    Apr 2 '12 at 22:21






  • 1





    This sounds suspiciously like a homework assignment I once had. Anyway, all of these questions can be answered in man pages: resolv.conf(5), hostname(1) and hosts(5)

    – AdmiralNemo
    Apr 2 '12 at 23:09

















Your shift key appears to be broken.

– Chris S
Apr 2 '12 at 22:21





Your shift key appears to be broken.

– Chris S
Apr 2 '12 at 22:21




1




1





This sounds suspiciously like a homework assignment I once had. Anyway, all of these questions can be answered in man pages: resolv.conf(5), hostname(1) and hosts(5)

– AdmiralNemo
Apr 2 '12 at 23:09





This sounds suspiciously like a homework assignment I once had. Anyway, all of these questions can be answered in man pages: resolv.conf(5), hostname(1) and hosts(5)

– AdmiralNemo
Apr 2 '12 at 23:09










1 Answer
1






active

oldest

votes


















0














/etc/hostname should have just foo



/etc/hosts looks fine



/etc/resolv.conf should probably be example.com for both, depending on your use case. Note that you named it /etc/resolf.conf and it should be v and not f



I don't know about domainname






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f407827%2fhow-to-properly-edit-hosts-hostname-and-resolf-conf%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    /etc/hostname should have just foo



    /etc/hosts looks fine



    /etc/resolv.conf should probably be example.com for both, depending on your use case. Note that you named it /etc/resolf.conf and it should be v and not f



    I don't know about domainname






    share|improve this answer




























      0














      /etc/hostname should have just foo



      /etc/hosts looks fine



      /etc/resolv.conf should probably be example.com for both, depending on your use case. Note that you named it /etc/resolf.conf and it should be v and not f



      I don't know about domainname






      share|improve this answer


























        0












        0








        0







        /etc/hostname should have just foo



        /etc/hosts looks fine



        /etc/resolv.conf should probably be example.com for both, depending on your use case. Note that you named it /etc/resolf.conf and it should be v and not f



        I don't know about domainname






        share|improve this answer













        /etc/hostname should have just foo



        /etc/hosts looks fine



        /etc/resolv.conf should probably be example.com for both, depending on your use case. Note that you named it /etc/resolf.conf and it should be v and not f



        I don't know about domainname







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 8 '12 at 1:34









        UtahJarheadUtahJarhead

        1,6421915




        1,6421915






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f407827%2fhow-to-properly-edit-hosts-hostname-and-resolf-conf%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Probability when a professor distributes a quiz and homework assignment to a class of n students.

            Aardman Animations

            Are they similar matrix