1827885 Members
1576 Online
109969 Solutions
New Discussion

Re: pinging localhost

 
ROSS HANSON
Regular Advisor

pinging localhost

I have two RedHat linux boxes. On one I can do a "ping localhost" with no problems. The other I cannot. I copied the /etc/hosts file from the good box to the bad. Of course, I changed ips and names. I am still unable to do a ping localhost on the bad box. I can ping any other box on our network by name but still not localhost.
I can ping 127.0.0.1 on the bad box but I am also unable to ping loopback

Where else should I be looking?
Ross Hanson
6 REPLIES 6
Dan Beeler_1
New Member

Re: pinging localhost

Sounds like you may have an error in the /etc/hosts file. I would verify that localhost is typed correctly.

What do you get when you run an ifconfig -a?

You should see something for lo

if it doesn't show this interface, then you should activate the service "local" in your "setup->system services".

Steven E. Protter
Exalted Contributor

Re: pinging localhost

Proper ifconfig -a output for localhost

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:202602 errors:0 dropped:0 overruns:0 frame:0
TX packets:202602 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:27171273 (25.9 Mb) TX bytes:27171273 (25.9 Mb)

take a look at /etc/hosts he should list the local box first.

compare these files on the servers
/etc/sysconfig/network-scripts/ifcfg-lo

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Caesar_3
Esteemed Contributor

Re: pinging localhost

Hello!

First could be problems in your /etc/hosts
file (bad entrys)
Create new file.
Also could be that you don't have read permision on the /etc/hosts
Check the permitions (should be -rw-r--r--)

Caesar
ROSS HANSON
Regular Advisor

Re: pinging localhost

Here is my /etc/hosts file:

127.0.0.1 linux localhost.localdomain localhost


the permissions on the file are
-rw-r--r-- 1 root root 43 Jul 25 14:52 /etc/hosts
Ross Hanson
tpfraz
Advisor

Re: pinging localhost

Hi Ross,
Try removing the word "linux" from your hosts file. So that it reads
127.0.0.1 localhost.localdomain localhost

Thats the "IP", the "hostname", and the "alias".


Caesar_3
Esteemed Contributor

Re: pinging localhost

Hello!

Check if you can ping linux (ping linux)
if so then put the localhost wright after the
ip address.

Caesar