1827809 Members
1907 Online
109969 Solutions
New Discussion

unable to ping localhost

 
SOLVED
Go to solution
jedd
Advisor

unable to ping localhost

hello all,
i'm having a weird problem, i changed ip address and netmask on 10.20 box with /sbin/set_parms initial. i think everything worked okay, but now i can not ping "localhost", but i can ping "127.0.0.1". the network doesn't have a DNS. do i need resolv.conf and nsswitch.conf in my /etc. my netstat -rn shows the right gateway and 127.0.0.1 shows up. i can ping the other boxes in the same network and vice-versa. so NIC is working okay. why can't i ping "localhost". any help would be appreciated. also do i need to remove any traces of DNS entries on this box. it was inside before being moved to DMZ network.
4 REPLIES 4
Shahul
Esteemed Contributor

Re: unable to ping localhost

Hi

If U can ping to 127.0.0.1, then U should be able to ping to localhost. Ur problem is in /etc/hosts file. Please check the entry in /etc/hosts file, It shold be like this

127.0.0.1 localhost loopback

Best of luck

Shahul
Santosh Nair_1
Honored Contributor
Solution

Re: unable to ping localhost

You con't need to set up a resolv.conf if you don't have a DNS server on the network, but I would set up /etc/nsswitch.conf just a matter of convention. You could probably just copy /etc/nsswitch.files (or /etc/nsswitch.nis if you're using NIS) to /etc/nsswitch.conf.

-Santosh
Life is what's happening while you're busy making other plans
James R. Ferguson
Acclaimed Contributor

Re: unable to ping localhost

Hi:

First, make sure that your /etc/hosts contains the following line:

127.0.0.1 localhost loopback

Then, since you say you don't want any DNS in operation, edit your /etc/nsswitch.conf file so that its entries specify "host" only, as:

hosts: files

Regards!

...JRF...
Sanjay_6
Honored Contributor

Re: unable to ping localhost

Hi Jedd,

does you /etc/hosts file reflect the chnages you have made. How are you trying to ping your own server. Through IP or through the hostname.

Since, you are not using DNS, you don't need a /etc/resolv.conf . If there is one, you can safely remove it. Also you can keep /etc/nsswitch.conf file and have this entry for hosts over there
hosts files

Also see that the entry for localhost is there as advised by other forum mebers already. Also check that the new hostname and ip of your system are correctly reflected in your /etc/hosts file. you may still have the old name and ip in that file and that might be creating problem for you.

hope this helps.

Thanks