I have new CentOS 7 box and I have a problem with the ping command.
When I try to ping

ping google.com

I get time out and 100% packet loss, but I can dig/nslookup google.com, and I can browse google.com

I tried to disable firewalld but the result is still the same, can't ping to google.com from my CentOS 7

Where is the problem? I thought before in the firewalld, but firewalld service is now disabled. How i can fix this problem?


Since only root can send ICMP packets, ping from VM may fail if your supervisor is executed by non-root user.

As mentioned in answer to this question, you can config net.ipv4.ping_group_range to allow the user running supervisor to send ICMP packets.


Have you tried with the same machine or system connected to another network? Have you tried with another machine on the same network? From your current description (which may not be accurate) the most probable explanation is that the ping is blocked by your ISP.

My results form ICMP:

# ping google.com
PING google.com ( 56(84) bytes of data.
64 bytes from fra07s27-in-f1.1e100.net ( icmp_seq=1 ttl=57 time=12.8 ms
64 bytes from fra07s27-in-f1.1e100.net ( icmp_seq=2 ttl=57 time=15.8 ms
64 bytes from fra07s27-in-f1.1e100.net ( icmp_seq=3 ttl=57 time=14.3 ms
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 3518ms
rtt min/avg/max/mdev = 12.861/14.365/15.898/1.240 ms

And my results for HTTP:

# curl -I http://www.google.com 
HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.cz/?gfe_rd=cr&ei=X_inVOCAAayh8wfy7IDoDg
Content-Length: 258
Date: Sat, 03 Jan 2015 14:10:39 GMT
Server: GFE/2.0
Alternate-Protocol: 80:quic,p=0.02

Your firewall wouldn't normally block you from pinging another machine using the IPv4 ICMP echo request.

  • i can ping to other machine in the network, can ping to gateway. this virtual machine build on top of vmware 11. from the host os (win 8) i can ping to google.com or to any domain using same provider. is this vmware configuration problem? how to check if vmware workstation block the icmp? because i can't ping to internet. Jan 4 '15 at 3:45
  • just try another setting, previously i use NAT for guest os (can't ping to internet but can browse and nslookup). Now i change guest os to bridge mode i can ping and browse. i don't know what is the problem with NAT setting in vmware workstation? Jan 4 '15 at 3:52
  • There's nothing about vmware or virtualization or even second NAT in your question. You should edit it with details to invite better answers. Jan 4 '15 at 9:06

You need to setup the nameserver for google.com to resolve to

So depending on what you prefer nano or vi on linux you need to do the following:

nano /etc/resolv.conf or vi /etc/resolv.conf

You should see DNS1: xxx.xxx.xxx.xxx and DNS2: xxx.xxx.xxx.xxx

Nano - Just hit enter under the DNS records to create a new line and type down "nameserver" hit I believe it was ctrl x to exit it will ask you if you would like to save hit y then hit enter to save in the same file location.

VI - Just hit insert go at the end of the final DNS record hit enter, this will create a new line type "nameserver" hit shift key with ; and then type wq, this command will write then quit the prompt.

Final step to both type ping google.com -c 4 and you will get ping from google.com


Being unable to ping google can be due to several reasons.

  • One reason can be that your Gateway is not properly configured in /etc/sysconfig/network-scripts/ifcfg-interfacename
  • Another reason can be that you have not configured DNS properly in /etc/sysconfig/network-scripts/ifcfg-interfacename file

Please check whether you have configured them correctly. And also disabling the Firewall is not a good option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.