2

I got a freshly installed red hat box on a server.

I can ping another machine on the network usnig both ip and server name but I can't ping localhost or 127.0.0.1 or 192.168.4.42 (local ip)

[root@comp2 ~]# ping comp1
PING vcas1 (192.168.4.41) 56(84) bytes of data.
64 bytes from vcas1 (192.168.4.41): icmp_seq=1 ttl=64 time=0.104 ms
64 bytes from vcas1 (192.168.4.41): icmp_seq=2 ttl=64 time=0.100 ms

--- comp1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.100/0.102/0.104/0.002 ms
[root@comp2 ~]# 

[root@comp2 ~]# ping 192.168.4.41
PING 192.168.4.41 (192.168.4.41) 56(84) bytes of data.
64 bytes from 192.168.4.41: icmp_seq=1 ttl=64 time=0.119 ms
64 bytes from 192.168.4.41: icmp_seq=2 ttl=64 time=0.105 ms

--- 192.168.4.41 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.105/0.112/0.119/0.007 ms

But I can't ping localhost or local ip address.

[root@comp2 ~]# ping 192.168.4.42
PING 192.168.4.42 (192.168.4.42) 56(84) bytes of data.

--- 192.168.4.42 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms
PING comp2 (192.168.4.42) 56(84) bytes of data.

--- comp2 ping statistics ---
17 packets transmitted, 0 received, 100% packet loss, time 15999ms

[root@comp2 ~]# ping 192.168.4.42
PING 192.168.4.42 (192.168.4.42) 56(84) bytes of data.

--- 192.168.4.42 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms

[root@comp2 ~]# ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.

--- localhost.localdomain ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms

This is my /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.4.41    comp1
192.168.4.42    comp2

and finally this is my ifconfig:

[root@comp2 ~]# /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:26:55:D4:4E:81  
          inet addr:10.0.0.14  Bcast:10.127.255.255  Mask:255.128.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:271591 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3079 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:16571921 (15.8 MiB)  TX bytes:228424 (223.0 KiB)
          Memory:fbfa0000-fbfc0000 

eth1      Link encap:Ethernet  HWaddr 00:26:55:D4:4E:80  
          inet addr:192.168.4.42  Bcast:192.168.4.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:174349 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34537 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12202232 (11.6 MiB)  TX bytes:3230241 (3.0 MiB)
          Memory:fbfe0000-fc000000 

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:16398 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16398 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:829344 (809.9 KiB)  TX bytes:829344 (809.9 KiB)

What's going on?

EDIT:

[root@comp2 ~]# /sbin/iptables -F
[root@comp2 ~]# /etc/init.d/iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
[root@comp2 ~]# ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.

--- localhost.localdomain ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 4999ms

Still nothing.

[root@comp2 ~]#/sbin/ip route show
192.168.4.0/24 dev eth1  proto kernel  scope link  src 192.168.4.42 
169.254.0.0/16 dev eth1  scope link 
10.0.0.0/9 dev eth0  proto kernel  scope link  src 10.0.0.14 
default via 10.0.0.1 dev eth0 

[root@comp2 ~]# /sbin/route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.4.0     *               255.255.255.0   U     0      0        0 eth1
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
10.0.0.0        *               255.128.0.0     U     0      0        0 eth0
default         VideoGateway.Om 0.0.0.0         UG    0      0        0 eth0

New:

This is something I should have done already but equally from server comp1 (192.168.4.41), I can't ping comp2(192.168.4.42)

9
  • flush and switch off iptables service. Dec 9, 2011 at 19:35
  • that didn't do it ^^' Dec 9, 2011 at 19:44
  • ok, what does ip route show or route or netstat -nr say? Dec 9, 2011 at 19:49
  • route add -net 127.0.0.1 netmask 255.255.255.255 <interface> Dec 9, 2011 at 19:50
  • I can't thank you enough for helping me Nikhil. Dec 9, 2011 at 19:54

3 Answers 3

1

It is the route table reconfiguration that is needed. Update GATEWAY variable in /etc/sysconfig/networking-scripts/ifcfg-ethX. Route information update in /etc/sysconfig/networking-scripts/route-ethX is also needed. Once the proper and correct network configuration in the files are updated, restart the network with /sbin/service network restart to get the new network configuration live on the interfaces.

5
  • Would that fix the ping issue from machine vcas1 to vcas2 (the problematic one)? Dec 9, 2011 at 19:59
  • not completely but we need to add other route information as well, look at the route file in /etc/sysconfig/network-scripts Dec 9, 2011 at 20:00
  • I am available on chat, if you need to take up this further. Dec 9, 2011 at 20:00
  • did you mess with netmask/broadcast addresses of the interface? Dec 9, 2011 at 20:03
  • I would also recommend looking at the route or ip r commands to take a look at the current routing table status.
    – lutzky
    Dec 10, 2011 at 9:31
1

Check the output of following command.

cat /proc/sys/net/ipv4/icmp_echo_ignore_all

If it is 1 then do following.

echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all

To store it permanently do following.

echo "net.ipv4.icmp_echo_ignore_all=0" >> /etc/sysctl.conf

If value of icmp_echo_ignore_all is 1 then kernel ignores ICMP ECHO requests. Some sysadmins disable the ping replies to avoid ping flood(ping -f).

1

It seem your lo interface has not yet been brought up. Please try the following commands:

ifup lo

OR

ifup -a

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .