If you can’t reach (eg ping returns nothing) your server from outside network, check your firewall rules at first. On CentOS it is simple:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| $ sudo iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination
|
If you don’t see any suspicious firewall rules, use tcpdump utility to check if server actually receives any ping packets.
Check that server receives ping echo requests (see http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol for ICMP control messages):
1 2 3 4 5 6 7
| $ tcpdump -nni venet0 -e icmp[icmptype] == 0 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on venet0, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes 10:38:53.926767 Out ethertype IPv4 (0x0800), length 76: 172.245.215.48 > 46.246.9.143: ICMP echo reply, id 1, seq 154, length 40 10:38:54.937709 Out ethertype IPv4 (0x0800), length 76: 172.245.215.48 > 46.246.9.143: ICMP echo reply, id 1, seq 155, length 40 10:38:55.927586 Out ethertype IPv4 (0x0800), length 76: 172.245.215.48 > 46.246.9.143: ICMP echo reply, id 1, seq 156, length 40
|
Check that server sends ping echo replies:
1 2 3 4 5 6 7
| $ tcpdump -nni venet0 -e icmp[icmptype] == 8 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on venet0, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes 10:39:37.619442 In ethertype IPv4 (0x0800), length 76: 46.246.9.143 > 172.245.215.48: ICMP echo request, id 1, seq 162, length 40 10:39:38.615616 In ethertype IPv4 (0x0800), length 76: 46.246.9.143 > 172.245.215.48: ICMP echo request, id 1, seq 163, length 40 10:39:39.623875 In ethertype IPv4 (0x0800), length 76: 46.246.9.143 > 172.245.215.48: ICMP echo request, id 1, seq 164, length 40
|
Run tcpdump and try to ping your server again.