LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-27-2005, 11:15 AM   #1
auji
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat
Posts: 9

Rep: Reputation: 0
can't resolve localhost


Hello,
I cannot ping my oun machine by using the hostname. It will work fine using the IP.
Typing hostname will give me the correct hostname. The /etc/hosts has all the correct entries. Can someone give me a clue as to how to fix it? Thanks very much!
 
Old 09-27-2005, 12:07 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Is the loopback device up?
ifconfig
 
Old 09-27-2005, 12:52 PM   #3
auji
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat
Posts: 9

Original Poster
Rep: Reputation: 0
Yes, the lo device 127.0.0.1 is up.
 
Old 09-27-2005, 01:07 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
What do you have in your hosts file:
cat /etc/hosts
 
Old 09-27-2005, 02:25 PM   #5
auji
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat
Posts: 9

Original Poster
Rep: Reputation: 0
As I said, the /etc/hosts file is fine and no change to it will correct the problem. Here it is anyway... This has always worked, but now I can't ping linea.

127.0.0.1 linea localhost.localdomain localhost
192.168.1.103 linea

The problem has something to do with the resolver and is not a typical tweak. Thanks for taking shots at it.
 
Old 09-27-2005, 02:33 PM   #6
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
Are you able to ping "localhost"? If not, you might have a problem with your nsswitch.conf file.
 
Old 09-27-2005, 03:34 PM   #7
auji
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat
Posts: 9

Original Poster
Rep: Reputation: 0
Nope, can't ping localhost. Here is my nsswitch.conf file. In "hosts:" I moved "nis" to the end of the line so it would be sure to find "files" . Nada.

passwd: compat
group: compat

hosts: files dns nis

services: nis [NOTFOUND=return] files
networks: nis [NOTFOUND=return] files
protocols: nis [NOTFOUND=return] files
rpc: nis [NOTFOUND=return] files
ethers: nis [NOTFOUND=return] files
netmasks: nis [NOTFOUND=return] files
netgroup: nis
bootparams: nis [NOTFOUND=return] files
publickey: nis [NOTFOUND=return] files
automount: files
aliases: nis [NOTFOUND=return] files
 
Old 09-27-2005, 03:52 PM   #8
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
What is the exact error message when you try to ping "localhost". Also, please post the output of your resolv.conf file.
 
Old 09-27-2005, 04:33 PM   #9
auji
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat
Posts: 9

Original Poster
Rep: Reputation: 0
[root@linea root]# ping localhost
ping: unknown host localhost

cat /etc/resolv.conf
nameserver 63.249.95.8
nameserver 63.249.95.9
nameserver 192.168.1.1

Seems like resolv.conf would be the problem but I have my router and 2 DNS servers listed.

When I boot up I get," Could not look up Internet address for linea. It may be possible to correct this problem by adding lines to /etc/hosts.

Thanks
 
Old 09-27-2005, 06:41 PM   #10
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
First of all what distro are you using? I think there maybe an error in your /etc/hosts file. You can try renaming it and then re-entering it manually into a new file. Sometimes there's a file corruption of some type that can't be seen visually.
 
Old 09-27-2005, 08:43 PM   #11
auji
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat
Posts: 9

Original Poster
Rep: Reputation: 0
I'm using RedHat 9.
Tried eliminating any possable errors in the hosts file by creating another manually. No difference.
I did notice that I can't ping anything in the host file. The /etc/hosts file is not being read, even when I create a new one with just a couple of lines.
This all started when I attempted to upgrade MySql and found I had to also upgrade the libraries... This must have screwed up something relating to the resolver.
Thanks for your Ideas and feedback aznluvsmc.
 
Old 09-27-2005, 09:00 PM   #12
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
Do you know what libraries you upgraded?
 
Old 09-28-2005, 12:23 PM   #13
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Are you using nscd? Try turning it off then ping:
service nscd stop
ping localhost
 
Old 09-28-2005, 01:32 PM   #14
linuxmanju
Member
 
Registered: Sep 2003
Location: India
Distribution: Debian
Posts: 50

Rep: Reputation: 15
127.0.0.1 linea localhost.localdomain localhost
192.168.1.103 linea
_____________________________
can u remove linea in the second coloumn and try..
something like

127.0.0.1 localhost.localdomain localhost
192.168.1.103 linea
 
Old 09-28-2005, 05:12 PM   #15
auji
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat
Posts: 9

Original Poster
Rep: Reputation: 0
Not running nscd. The /etc/hosts file isn't read no matter what is listed in any order. It must have something to do with ld.so, glibc or libc libraries as these are the aRPMs I attempted to upgrade. Tried doing a Redhat upgrade, but now think I'll have to do a complete install which is overkill to fix a broken library. Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to resolve any hostnames, including localhost calamari Linux - Networking 10 11-02-2005 01:17 PM
Change localhost name in username@localhost n175uj Linux - Newbie 4 07-01-2005 08:25 PM
Message from syslogd@localhost localhost kernel: Disabling IRQ #21 ylts Linux - Hardware 0 02-26-2005 08:01 AM
postfix can't resolve localhost yapp Linux - Networking 2 12-02-2003 01:48 PM
dns requests from localhost to localhost keex Linux - Networking 2 11-13-2003 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration