LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   can't resolve localhost (https://www.linuxquestions.org/questions/linux-networking-3/cant-resolve-localhost-367521/)

auji 09-27-2005 11:15 AM

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!

david_ross 09-27-2005 12:07 PM

Is the loopback device up?
ifconfig

auji 09-27-2005 12:52 PM

Yes, the lo device 127.0.0.1 is up.

david_ross 09-27-2005 01:07 PM

What do you have in your hosts file:
cat /etc/hosts

auji 09-27-2005 02:25 PM

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.

aznluvsmc 09-27-2005 02:33 PM

Are you able to ping "localhost"? If not, you might have a problem with your nsswitch.conf file.

auji 09-27-2005 03:34 PM

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

aznluvsmc 09-27-2005 03:52 PM

What is the exact error message when you try to ping "localhost". Also, please post the output of your resolv.conf file.

auji 09-27-2005 04:33 PM

[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

aznluvsmc 09-27-2005 06:41 PM

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.

auji 09-27-2005 08:43 PM

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.

aznluvsmc 09-27-2005 09:00 PM

Do you know what libraries you upgraded?

david_ross 09-28-2005 12:23 PM

Are you using nscd? Try turning it off then ping:
service nscd stop
ping localhost

linuxmanju 09-28-2005 01:32 PM

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

auji 09-28-2005 05:12 PM

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.


All times are GMT -5. The time now is 04:28 PM.