Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    localhost messed up in /etc/host.conf

    I was trying to make my computer have a static ip address but it got messed up and I returned everything to what it used to be. But somehow my /etc/host.conf file got messed up and I can't really do much since I am using the computer as a server. Can someone tell me what code that I have to add back into the file? I remember there used to be like 2 or 3 lines of code in there when I looked after I first installed, but now there are 3 words. I forget what they say.

    Thanks for the help.

  2. #2
    Linux Engineer adrenaline's Avatar
    Join Date
    Aug 2004
    Seattle, Washington
    The file is called hosts
    it is in etc.
    in a term type
    su -
    cd /etc
    pico or vi hosts #now you can edit it
    if you would like help post what it looks like
    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

  3. #3
    I usually use gedit to edit it.

    When I start up linux, I get the error that it can't find localhost.localdomain or something in the file /etc/host.conf. When I opened up that file I found this
    order hosts,bind
    Can anyone tell me what text I should add to the file so I can run my webserver????

  4. $spacer_open
  5. #4
    Linux Newbie
    Join Date
    Jun 2004


    looks like your going to have to take a crash course in vi. Its easy

    do vi /etc/host.conf

    once vi brings up your file, use the arrows to go over to the area you want to edit and press the I on the keyboard for insert mode. this allows you to writ to the file. After you finish editing the file press esc to take you to command mode. You'll see what mode your in on the bottom right hand corner of the screen. The command to close your vi session and write to the file is :wq. I will admin, your going to have to print out a vi command cheat cheat of the web. It will make things easier.

    good luck

  6. #5
    Ok isn't that just like gedit?? What should I add there is what I need to know. I have been adding localhost
    and it is not working. I am getting this error message
    Starting httpd: /etc/host.conf: line 1: bad command ` localhost'
    httpd: Could not determine the server's fully qualified domain name, using for ServerName

  7. #6
    Linux Newbie
    Join Date
    Jun 2004


    Are you running a webserver on that machine?

    at the prompt type


    whatever the host name is along with your static ip is, thats what you need to enter into your host.conf file


    my hostname is pegasus.

    If i had a static ip I would write it down and enter it into my host.conf file like so...
    #hostname # static ipaddres

    save and exit

    upon reboot the problem you are having with the name resolution should be fixed.

  8. #7
    its still not working. I keep getting an error that says bad command. It used to be working then I tried to make the internal ip address static but it got messed up and I changed everything back. I assume that it was obtain your ip address automatically before. How can I change it back to that. I can get internet acess, but nothing else for the server and when I log in I get an error also.

  9. #8
    Linux Newbie
    Join Date
    Jun 2004
    I assume you have FC3, use the internet connection configuration utility

    system-cofig-network or network device utility to configure your network card, make sure you dont have 2 instances of the same device if you do remove one of them. Then try to set everything up for DHCP configuration.

    Also please try to look in

    /var/log/messages , at the end of the file you should see the errors in more detail. Post it here it will help us help you.

  10. #9
    Here is my message file.

    edit by moderator (scientica): please see the "Moderator Notice" bellow for details about this edit/truncation (removed corrupted data).

  11. #10
    Linux Guru
    Join Date
    May 2004
    Quote Originally Posted by Burian
    Ok isn't that just like gedit?? What should I add there is what I need to know.
    Have you found a solution, yet, Burian? Maybe you have discovered by now that there are two different files: /etc/hosts and /etc/host.conf. I'm no expert, but for your reference, my files look kind of like this:
    order hosts,bind
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    #     IP                fqdn             alias localhost.localdomain   localhost
    # elite486                elite486 cpqnbook                cpqnbook
    The first line, 127.000.... is for the loopback interface and that's what the warning above it is for. The other lines are for hosts on the network, one for each host on the network (more or less).

    To edit a text file in X-windows in the MS Windows fashion, gedit will work fine. If you are logged in as a normal user (as most recommend), you can still use gedit if you open a terminal, 'su -' to get root privledges, and then enter at the command line, for example
    #  gedit /etc/hosts
    //got nothin'
    ///this use to look better

Posting Permissions

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